]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Add comments for inode snapshot requirements
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 2 May 2025 16:23:59 +0000 (12:23 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:41 +0000 (20:14 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/io_write.c
fs/bcachefs/xattr.c

index add141ac45b5fe0a4a2dbf4f242aa63c7412ad22..399df8fede8bda43e29eab1617daa58f72470f0e 100644 (file)
@@ -279,6 +279,12 @@ static inline int bch2_extent_update_i_size_sectors(struct btree_trans *trans,
                inode_update_flags = 0;
        }
 
+       /*
+        * extents, dirents and xattrs updates require that an inode update also
+        * happens - to ensure that if a key exists in one of those btrees with
+        * a given snapshot ID an inode is also present - so we may have to skip
+        * the nojournal optimization:
+        */
        if (inode->k.p.snapshot != iter.snapshot) {
                inode->k.p.snapshot = iter.snapshot;
                inode_update_flags = 0;
index 6b64cec78fb91f161b63e8df8f5cd6ad9280d141..627f153798c67934f5886a5533d92e365fee43dd 100644 (file)
@@ -176,6 +176,11 @@ int bch2_xattr_set(struct btree_trans *trans, subvol_inum inum,
        if (ret)
                return ret;
 
+       /*
+        * Besides the ctime update, extents, dirents and xattrs updates require
+        * that an inode update also happens - to ensure that if a key exists in
+        * one of those btrees with a given snapshot ID an inode is also present
+        */
        inode_u->bi_ctime = bch2_current_time(c);
 
        ret = bch2_inode_write(trans, &inode_iter, inode_u);