diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-11-09 19:02:48 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:32 -0400 |
commit | 085ab69357e091613625f1505d667b6a5a3ec881 (patch) | |
tree | df5f4d2d258b9bade329e662464a6a3139a7f384 /fs/bcachefs/bset.h | |
parent | ad44bdc351faeacb9b7294f1689ac76babf379ad (diff) | |
download | linux-stable-085ab69357e091613625f1505d667b6a5a3ec881.tar.gz linux-stable-085ab69357e091613625f1505d667b6a5a3ec881.tar.bz2 linux-stable-085ab69357e091613625f1505d667b6a5a3ec881.zip |
bcachefs: Rework of cut_front & cut_back
This changes bch2_cut_front and bch2_cut_back so that they're able to
shorten the size of the value, and it also changes the extent update
path to update the accounting in the btree node when this happens.
When the size of the value is shortened, they zero out the space that's
no longer used, so it's interpreted as noops (as implemented in the last
patch).
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bset.h')
-rw-r--r-- | fs/bcachefs/bset.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/bcachefs/bset.h b/fs/bcachefs/bset.h index 0e9bd8022d35..b93c4f287480 100644 --- a/fs/bcachefs/bset.h +++ b/fs/bcachefs/bset.h @@ -584,6 +584,16 @@ static inline void btree_keys_account_key(struct btree_nr_keys *n, n->unpacked_keys += sign; } +static inline void btree_keys_account_val_delta(struct btree *b, + struct bkey_packed *k, + int delta) +{ + struct bset_tree *t = bch2_bkey_to_bset(b, k); + + b->nr.live_u64s += delta; + b->nr.bset_u64s[t - b->set] += delta; +} + #define btree_keys_account_key_add(_nr, _bset_idx, _k) \ btree_keys_account_key(_nr, _bset_idx, _k, 1) #define btree_keys_account_key_drop(_nr, _bset_idx, _k) \ |