]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Add bch_io_opts fields for indicating whether the opts came from the inode
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 20 Oct 2024 03:26:11 +0000 (23:26 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:16 +0000 (01:36 -0500)
This is going to be used in the bch_extent_rebalance improvements, which
propagate io_path options into the extent (important for rebalance,
which needs something present in the extent for transactionally tagging
them in the rebalance_work btree, and also for indirect extents).

By tracking in bch_extent_rebalance whether the option came from the
filesystem or the inode we can correctly handle options being changed on
indirect extents.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/inode.c
fs/bcachefs/opts.h

index fbdd11802bdf2e2752c913ce3c6c19708cea3f5d..5dd9d3edae7774fa3e2d2167f07c6673bcd233f8 100644 (file)
@@ -1142,7 +1142,13 @@ struct bch_opts bch2_inode_opts_to_opts(struct bch_inode_unpacked *inode)
 void bch2_inode_opts_get(struct bch_io_opts *opts, struct bch_fs *c,
                         struct bch_inode_unpacked *inode)
 {
-#define x(_name, _bits)                opts->_name = inode_opt_get(c, inode, _name);
+#define x(_name, _bits)                                                        \
+       if ((inode)->bi_##_name) {                                      \
+               opts->_name = inode->bi_##_name - 1;                    \
+               opts->_name##_from_inode = true;                        \
+       } else {                                                        \
+               opts->_name = c->opts._name;                            \
+       }
        BCH_INODE_OPTS()
 #undef x
 
index 13555bc35f00c16f2140c0d6af74b1f61ad94dab..918eb673011742cd16ea4cfd90cbc3fc4c8f51c0 100644 (file)
@@ -624,6 +624,9 @@ struct bch_io_opts {
 #define x(_name, _bits)        u##_bits _name;
        BCH_INODE_OPTS()
 #undef x
+#define x(_name, _bits)        u64 _name##_from_inode:1;
+       BCH_INODE_OPTS()
+#undef x
 };
 
 static inline void bch2_io_opts_fixups(struct bch_io_opts *opts)