diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-16 00:46:26 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:12 -0400 |
commit | b9e1adf57988fb4632b86c43fde1551a24299b86 (patch) | |
tree | 3f6d8942ede2c864a84cb66501bf80d7682c60a7 /fs/bcachefs/dirent.h | |
parent | 14b393ee768e8339b9c64f82df24e8c081bdbff9 (diff) | |
download | linux-stable-b9e1adf57988fb4632b86c43fde1551a24299b86.tar.gz linux-stable-b9e1adf57988fb4632b86c43fde1551a24299b86.tar.bz2 linux-stable-b9e1adf57988fb4632b86c43fde1551a24299b86.zip |
bcachefs: Add support for dirents that point to subvolumes
Dirents currently always point to inodes. Subvolumes add a new type of
dirent, with d_type DT_SUBVOL, that instead points to an entry in the
subvolumes btree, and the subvolume has a pointer to the root inode.
This patch adds bch2_dirent_read_target() to get the inode (and
potentially subvolume) a dirent points to, and changes existing code to
use that instead of reading from d_inum directly.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/dirent.h')
-rw-r--r-- | fs/bcachefs/dirent.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.h b/fs/bcachefs/dirent.h index c14f6029e1c9..3cd05a2454e1 100644 --- a/fs/bcachefs/dirent.h +++ b/fs/bcachefs/dirent.h @@ -37,6 +37,17 @@ int bch2_dirent_delete_at(struct btree_trans *, const struct bch_hash_info *, struct btree_iter *); +int __bch2_dirent_read_target(struct btree_trans *, struct bkey_s_c_dirent, + u32 *, u32 *, u64 *, bool); + +int bch2_dirent_read_target(struct btree_trans *, + struct bkey_s_c_dirent, u64 *); + +static inline unsigned vfs_d_type(unsigned type) +{ + return type == DT_SUBVOL ? DT_DIR : type; +} + enum bch_rename_mode { BCH_RENAME, BCH_RENAME_OVERWRITE, @@ -52,7 +63,8 @@ int bch2_dirent_rename(struct btree_trans *, int __bch2_dirent_lookup_trans(struct btree_trans *, struct btree_iter *, u64, const struct bch_hash_info *, - const struct qstr *, unsigned); + const struct qstr *, u64 *, + unsigned); u64 bch2_dirent_lookup(struct bch_fs *, u64, const struct bch_hash_info *, const struct qstr *); |