summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-05-22 17:37:25 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:04 -0400
commit731bdd2eff41808ded960fbe62a83672904e1600 (patch)
treef45dc3efc827f42ada2aa6a6b56ad350b9d7e673 /fs/bcachefs/io.c
parent2eba51a69a7aba82bd4639a71b0906be7e23ca5c (diff)
downloadlwn-731bdd2eff41808ded960fbe62a83672904e1600.tar.gz
lwn-731bdd2eff41808ded960fbe62a83672904e1600.zip
bcachefs: Add a workqueue for btree io completions
Also, clean up workqueue usage - we shouldn't be using system workqueues, pretty much everything we do needs to be on our own WQ_MEM_RECLAIM workqueues. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r--fs/bcachefs/io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index eafefb651d1e..bf59875db546 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -1440,7 +1440,7 @@ static void promote_start(struct promote_op *op, struct bch_read_bio *rbio)
bch2_migrate_read_done(&op->write, rbio);
closure_init(cl, NULL);
- closure_call(&op->write.op.cl, bch2_write, c->wq, cl);
+ closure_call(&op->write.op.cl, bch2_write, c->btree_update_wq, cl);
closure_return_with_destructor(cl, promote_done);
}
@@ -1823,6 +1823,13 @@ static void __bch2_read_endio(struct work_struct *work)
if (bch2_crc_cmp(csum, rbio->pick.crc.csum) && !c->opts.no_data_io)
goto csum_err;
+ /*
+ * XXX
+ * We need to rework the narrow_crcs path to deliver the read completion
+ * first, and then punt to a different workqueue, otherwise we're
+ * holding up reads while doing btree updates which is bad for memory
+ * reclaim.
+ */
if (unlikely(rbio->narrow_crcs))
bch2_rbio_narrow_crcs(rbio);