diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-06-30 14:44:19 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:42 -0400 |
commit | 0ba95acc4499c84156144316dfb08d68930cc1a9 (patch) | |
tree | 903824401ad3ef0311234331d3aa4d5e7ce96f2b /fs/bcachefs/ec.h | |
parent | f6b94a3baa956ff10a52a545a9ad60f35e88e683 (diff) | |
download | linux-0ba95acc4499c84156144316dfb08d68930cc1a9.tar.gz linux-0ba95acc4499c84156144316dfb08d68930cc1a9.tar.bz2 linux-0ba95acc4499c84156144316dfb08d68930cc1a9.zip |
bcachefs: Allow existing stripes to be updated with new data buckets
This solves internal fragmentation within stripes. We already have
copygc, which evacuates buckets that are partially or mostly empty, but
it's up to the ec code that manages stripes to deal with stripes that
have empty buckets in them.
This patch changes the path for creating new stripes to check if there's
existing stripes with empty buckets - and if so, update them with new
data buckets instead of creating new stripes.
TODO: improve the disk space accounting so that we can only use this
(more expensive path) when we have too much fragmentation in existing
stripes.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/ec.h')
-rw-r--r-- | fs/bcachefs/ec.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/ec.h b/fs/bcachefs/ec.h index d7396885792e..ad9078fdb045 100644 --- a/fs/bcachefs/ec.h +++ b/fs/bcachefs/ec.h @@ -97,6 +97,9 @@ struct ec_stripe_new { u8 nr_parity; bool allocated; bool pending; + bool existing_stripe; + u64 existing_stripe_idx; + unsigned long blocks_allocated[BITS_TO_LONGS(EC_STRIPE_MAX)]; struct open_buckets blocks; @@ -125,9 +128,6 @@ struct ec_stripe_head { struct dev_stripe_state block_stripe; struct dev_stripe_state parity_stripe; - struct open_buckets blocks; - struct open_buckets parity; - struct ec_stripe_new *s; }; |