diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-29 05:52:19 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:06 +0200 |
commit | 5db95e50e11bdd0a191a22fdbc1e68ec900aff89 (patch) | |
tree | 99e22b3d5ec168ab654cb7d4985b67aab19e7456 /fs/bcachefs/bkey_methods.c | |
parent | bcachefs: Refactor extent_handle_overwrites() (diff) | |
download | linux-5db95e50e11bdd0a191a22fdbc1e68ec900aff89.tar.xz linux-5db95e50e11bdd0a191a22fdbc1e68ec900aff89.zip |
bcachefs: Re-implement extent merging in transaction commit path
We haven't had extent merging in quite some time. It used to be done by
the btree code when sorting btree nodes, but that was eliminated as part
of the work to separate extent handling from core btree code.
This patch re-implements extent merging in the transaction commit path.
We don't currently have the ability to merge reflink pointers, we need
to do some work on the triggers code to be able to do that without
ending up with incorrect refcounts.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/bkey_methods.c')
-rw-r--r-- | fs/bcachefs/bkey_methods.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c index ff9d770aabea..1ad6a9d30bb5 100644 --- a/fs/bcachefs/bkey_methods.c +++ b/fs/bcachefs/bkey_methods.c @@ -296,7 +296,11 @@ bool bch2_bkey_merge(struct bch_fs *c, struct bkey_s l, struct bkey_s_c r) { const struct bkey_ops *ops = &bch2_bkey_ops[l.k->type]; - return bch2_bkey_maybe_mergable(l.k, r.k) && ops->key_merge(c, l, r); + return bch2_bkey_maybe_mergable(l.k, r.k) && + (u64) l.k->size + r.k->size <= KEY_SIZE_MAX && + bch2_bkey_ops[l.k->type].key_merge && + !bch2_key_merging_disabled && + ops->key_merge(c, l, r); } static const struct old_bkey_type { |