Commit fbc519ab authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Don't submit bio in write path under lock

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2d78737d
...@@ -1008,6 +1008,8 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp) ...@@ -1008,6 +1008,8 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp)
bkey_start_pos(&key_to_write->k), bkey_start_pos(&key_to_write->k),
total_input >> 9); total_input >> 9);
bch2_alloc_sectors_done(c, wp);
dst->bi_end_io = bch2_write_endio; dst->bi_end_io = bch2_write_endio;
dst->bi_private = &op->cl; dst->bi_private = &op->cl;
dst->bi_opf = REQ_OP_WRITE; dst->bi_opf = REQ_OP_WRITE;
...@@ -1022,6 +1024,8 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp) ...@@ -1022,6 +1024,8 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp)
"rewriting existing data (memory corruption?)"); "rewriting existing data (memory corruption?)");
ret = -EIO; ret = -EIO;
err: err:
bch2_alloc_sectors_done(c, wp);
if (to_wbio(dst)->bounce) if (to_wbio(dst)->bounce)
bch2_bio_free_pages_pool(c, dst); bch2_bio_free_pages_pool(c, dst);
if (to_wbio(dst)->put_bio) if (to_wbio(dst)->put_bio)
...@@ -1072,10 +1076,9 @@ static void __bch2_write(struct closure *cl) ...@@ -1072,10 +1076,9 @@ static void __bch2_write(struct closure *cl)
goto flush_io; goto flush_io;
} }
ret = bch2_write_extent(op, wp);
bch2_open_bucket_get(c, wp, &op->open_buckets); bch2_open_bucket_get(c, wp, &op->open_buckets);
bch2_alloc_sectors_done(c, wp);
ret = bch2_write_extent(op, wp);
if (ret < 0) if (ret < 0)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment