summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-ioctl.c
AgeCommit message (Collapse)Author
2023-09-19bcachefs: fs-ioctl: Fix copy_to_user() error codeDan Carpenter
The copy_to_user() function returns the number of bytes that it wasn't able to copy but we want to return -EFAULT to the user. Fixes: e0750d947352 ("bcachefs: Initial commit") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-08bcachefs: Add btree_trans* to inode_set_fnJoshua Ashton
This will be used when we need to re-hash a directory tree when setting flags. It is not possible to have concurrent btree_trans on a thread. Signed-off-by: Joshua Ashton <joshua@froggi.es>
2023-08-28bcachefs: Convert -ENOENT to private error codesKent Overstreet
As with previous conversions, replace -ENOENT uses with more informative private error codes. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Improve error handling in bch2_ioctl_subvolume_destroy()Kent Overstreet
Pure style fixes Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Support FS_XFLAG_PROJINHERITKent Overstreet
We already have support for the flag's semantics: inode options are inherited by children if they were explicitly set on the parent. This patch just maps the FS_XFLAG_PROJINHERIT flag to the "this option was epxlicitly set" bit. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Errcodes can now subtype standard error codesKent Overstreet
The next patch is going to be adding private error codes for all the places we return -ENOSPC. Additionally, this patch updates return paths at all module boundaries to call bch2_err_class(), to return the standard error code. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Add BCH_SUBVOLUME_UNLINKEDKent Overstreet
Snapshot deletion needs to become a multi step process, where we unlink, then tear down the page cache, then delete the subvolume - the deleting flag is equivalent to an inode with i_nlink = 0. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Delete dentry when deleting snapshotsKent Overstreet
This fixes a bug where subsequently doing creates with the same name fails. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Snapshot creation, deletionKent Overstreet
This is the final patch in the patch series implementing snapshots. This patch implements two new ioctls that work like creation and deletion of directories, but fancier. - BCH_IOCTL_SUBVOLUME_CREATE, for creating new subvolumes and snaphots - BCH_IOCTL_SUBVOLUME_DESTROY, for deleting subvolumes and snapshots Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Plumb through subvolume idKent Overstreet
To implement snapshots, we need every filesystem btree operation (every btree operation without a subvolume) to start by looking up the subvolume and getting the current snapshot ID, with bch2_subvolume_get_snapshot() - then, that snapshot ID is used for doing btree lookups in BTREE_ITER_FILTER_SNAPSHOTS mode. This patch adds those bch2_subvolume_get_snapshot() calls, and also switches to passing around a subvol_inum instead of just an inode number. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Add subvolume to ei_inode_infoKent Overstreet
Filesystem operations generally operate within a subvolume: at the start of every btree transaction we'll be looking up (and locking) the subvolume to get the current snapshot ID, which we then use for our other btree lookups in BTREE_ITER_FILTER_SNAPSHOTS mode. But inodes don't record what subvolume they're in - they can't, because if they did we'd have to update every single inode within a subvolume when taking a snapshot in order to keep that field up to date. So it needs to be tracked in memory, based on how we got to that inode. Hence this patch adds a subvolume field to ei_inode_info, and switches to iget5() so we can index by it in the inode hash table. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Improve FS_IOC_GOINGDOWN ioctlKent Overstreet
We weren't interpreting the flags argument at all. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-08-28bcachefs: Kill ei_str_hashKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Some project id fixesKent Overstreet
Inode options that are accessible via the xattr interface are stored with a +1 bias, so that a value of 0 means unset. We weren't handling this consistently. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Factor out fs-common.cKent Overstreet
This refactoring makes the code easier to understand by separating the bcachefs btree transactional code from the linux VFS code - but more importantly, it's also to share code with the fuse port. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Improve bch2_lock_inodes()Kent Overstreet
Can now be used for the two different types of locks we have so far Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: some improvements to startup messages and optionsKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: fix new reinherit_attrs ioctlKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: more project quota fixesKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: bch2_ioc_reinherit_attrs()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Add flags to indicate if inode opts were inherited or explicitly setKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: bch2_fs_quota_transferKent Overstreet
improve quota transfer locking & make ei_qid usage more consistent Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Fix mtime/ctime updatesKent Overstreet
Also make inode flags consistent with how the rest of the inode is updated Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-28bcachefs: Initial commitKent Overstreet
Initially forked from drivers/md/bcache, bcachefs is a new copy-on-write filesystem with every feature you could possibly want. Website: https://bcachefs.org Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>