diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-01 21:47:07 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:55 -0400 |
commit | 910659763edaba58aa04bd5924dd933bc08cc56f (patch) | |
tree | 572a22a75d5a45db070052e7830b13088426e00d /fs/bcachefs/backpointers.h | |
parent | 3329cf1bb91d6293a96cf35ad72b2a2e1e1c0e3d (diff) | |
download | linux-910659763edaba58aa04bd5924dd933bc08cc56f.tar.gz linux-910659763edaba58aa04bd5924dd933bc08cc56f.tar.bz2 linux-910659763edaba58aa04bd5924dd933bc08cc56f.zip |
bcachefs: Mark stripe buckets with correct data type
Currently, we don't use bucket data type for tracking whether buckets
are part of a stripe; parity buckets are BCH_DATA_parity, but data
buckets in a stripe are BCH_DATA_user. There's a separate counter,
buckets_ec, outside the BCH_DATA_TYPES system for tracking number of
buckets on a device that are part of a stripe.
The trouble with this approach is that it's too coarse grained, and we
need better information on fragmentation for debugging copygc.
With this patch, data buckets in a stripe are now tracked as
BCH_DATA_stripe buckets.
This doesn't yet differentiate between erasure coded and non-erasure
coded data in a stripe bucket, nor do we yet track empty data buckets in
stripes.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/backpointers.h')
-rw-r--r-- | fs/bcachefs/backpointers.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/bcachefs/backpointers.h b/fs/bcachefs/backpointers.h index ded1ab7fb0bc..314fee21dc27 100644 --- a/fs/bcachefs/backpointers.h +++ b/fs/bcachefs/backpointers.h @@ -96,12 +96,20 @@ static inline int bch2_bucket_backpointer_mod(struct btree_trans *trans, return bch2_trans_update_buffered(trans, BTREE_ID_backpointers, &bp_k->k_i); } +static inline enum bch_data_type bkey_ptr_data_type(enum btree_id btree_id, unsigned level, + struct bkey_s_c k, struct extent_ptr_decoded p) +{ + return level ? BCH_DATA_btree : + p.has_ec ? BCH_DATA_stripe : + BCH_DATA_user; +} + static inline void bch2_extent_ptr_to_bp(struct bch_fs *c, enum btree_id btree_id, unsigned level, struct bkey_s_c k, struct extent_ptr_decoded p, struct bpos *bucket_pos, struct bch_backpointer *bp) { - enum bch_data_type data_type = level ? BCH_DATA_btree : BCH_DATA_user; + enum bch_data_type data_type = bkey_ptr_data_type(btree_id, level, k, p); s64 sectors = level ? btree_sectors(c) : k.k->size; u32 bucket_offset; |