From ac124c88859e6520e01d11a346e38f901052d657 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 3 Dec 2024 21:33:02 -0500 Subject: Update bcachefs sources to 4a32728376a8 bcachefs: bcachefs_metadata_version_inode_depth Signed-off-by: Kent Overstreet --- libbcachefs/fs-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libbcachefs/fs-common.c') 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; -- cgit v1.2.3