summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/ec.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-12-14 19:41:03 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:50 -0400
commit81d8599e192e85fa7e01d8a6e8e4095177ff46a3 (patch)
tree02dadb2c9c063c69ffe931aa6a0d2f4c8f0111e0 /fs/bcachefs/ec.h
parent35a067b42dcfd884fb132128ae94f240c6511fea (diff)
downloadlinux-81d8599e192e85fa7e01d8a6e8e4095177ff46a3.tar.gz
linux-81d8599e192e85fa7e01d8a6e8e4095177ff46a3.tar.bz2
linux-81d8599e192e85fa7e01d8a6e8e4095177ff46a3.zip
bcachefs: Don't read existing stripes synchronously in write path
Previously, in the stripe creation path, when reusing an existing stripe we'd read the existing stripe synchronously - ouch. Now, we allocate two stripe bufs if we're using an existing stripe, so that we can do the read asynchronously - and, we read the full stripe so that we can run recovery, if necessary. 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.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/bcachefs/ec.h b/fs/bcachefs/ec.h
index 450bb1a113a3..1d4aad50db4d 100644
--- a/fs/bcachefs/ec.h
+++ b/fs/bcachefs/ec.h
@@ -88,6 +88,7 @@ struct ec_stripe_new {
struct ec_stripe_head *h;
struct mutex lock;
struct list_head list;
+ struct closure iodone;
/* counts in flight writes, stripe is created when pin == 0 */
atomic_t pin;
@@ -98,8 +99,7 @@ struct ec_stripe_new {
u8 nr_parity;
bool allocated;
bool pending;
- bool existing_stripe;
- u64 existing_stripe_idx;
+ bool have_existing_stripe;
unsigned long blocks_allocated[BITS_TO_LONGS(BCH_BKEY_PTRS_MAX)];
@@ -111,7 +111,8 @@ struct ec_stripe_new {
struct keylist keys;
u64 inline_keys[BKEY_U64s * 8];
- struct ec_stripe_buf stripe;
+ struct ec_stripe_buf new_stripe;
+ struct ec_stripe_buf existing_stripe;
};
struct ec_stripe_head {