diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-10-19 21:41:20 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-21 01:36:16 -0500 |
| commit | 6aa0bd0fd59a1ab9ecd5c51332c29fac0d8969c8 (patch) | |
| tree | 678fb1ae92568bf92bfe66c893feec349f390d46 /fs/bcachefs/extents.c | |
| parent | bcachefs: bch2_write_inode() now checks for changing rebalance options (diff) | |
| download | linux-6aa0bd0fd59a1ab9ecd5c51332c29fac0d8969c8.tar.gz linux-6aa0bd0fd59a1ab9ecd5c51332c29fac0d8969c8.zip | |
bcachefs: get_update_rebalance_opts()
bch2_move_get_io_opts() now synchronizes options loaded from the
filesystem and inode (if present, i.e. not walking the reflink btree
directly) with options from the bch_extent_rebalance_entry, updating the
extent if necessary.
Since bch_extent_rebalance tracks where its option came from we can
preserve "inode options override filesystem options", even for indirect
extents where we don't have access to the inode the options came from.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.c')
| -rw-r--r-- | fs/bcachefs/extents.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index 467ffed0809e..4988056ab4f1 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -1521,6 +1521,23 @@ incompressible: return sectors; } +bool bch2_bkey_rebalance_needs_update(struct bch_fs *c, struct bch_io_opts *opts, + struct bkey_s_c k) +{ + if (!bkey_extent_is_direct_data(k.k)) + return 0; + + const struct bch_extent_rebalance *old = bch2_bkey_rebalance_opts(k); + + if (k.k->type == KEY_TYPE_reflink_v || + bch2_bkey_ptrs_need_rebalance(c, k, opts->background_target, opts->background_compression)) { + struct bch_extent_rebalance new = io_opts_to_rebalance_opts(opts); + return old == NULL || memcmp(old, &new, sizeof(new)); + } else { + return old != NULL; + } +} + int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bch_io_opts *opts, struct bkey_i *_k) { |
