diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-03 21:33:02 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-03 21:51:54 -0500 |
commit | ac124c88859e6520e01d11a346e38f901052d657 (patch) | |
tree | 2a9102c5c02b725507bf33bc0c83b26c7e8fdfa8 /libbcachefs/fs-common.c | |
parent | c560ff06f4798f27aa7b3ae322c83d5a9ba37b13 (diff) |
Update bcachefs sources to 4a32728376a8 bcachefs: bcachefs_metadata_version_inode_depth
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/fs-common.c')
-rw-r--r-- | libbcachefs/fs-common.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libbcachefs/fs-common.c b/libbcachefs/fs-common.c index dcaa47f6..d2966b67 100644 --- a/libbcachefs/fs-common.c +++ b/libbcachefs/fs-common.c @@ -172,6 +172,10 @@ int bch2_create_trans(struct btree_trans *trans, new_inode->bi_dir_offset = dir_offset; } + if (S_ISDIR(mode) && + !new_inode->bi_subvol) + new_inode->bi_depth = dir_u->bi_depth + 1; + inode_iter.flags &= ~BTREE_ITER_all_snapshots; bch2_btree_iter_set_snapshot(&inode_iter, snapshot); @@ -512,6 +516,15 @@ int bch2_rename_trans(struct btree_trans *trans, dst_dir_u->bi_nlink++; } + if (S_ISDIR(src_inode_u->bi_mode) && + !src_inode_u->bi_subvol) + src_inode_u->bi_depth = dst_dir_u->bi_depth + 1; + + if (mode == BCH_RENAME_EXCHANGE && + S_ISDIR(dst_inode_u->bi_mode) && + !dst_inode_u->bi_subvol) + dst_inode_u->bi_depth = src_dir_u->bi_depth + 1; + if (dst_inum.inum && is_subdir_for_nlink(dst_inode_u)) { dst_dir_u->bi_nlink--; src_dir_u->bi_nlink += mode == BCH_RENAME_EXCHANGE; |