Re: [PATCH v2 3/5] mpage: split bi_end_io callback for reads and writes

From: Christoph Hellwig
Date: Tue Apr 04 2023 - 11:09:26 EST


> struct page *page = bv->bv_page;
> - page_endio(page, bio_op(bio),
> + page_endio(page, REQ_OP_READ,
> + blk_status_to_errno(bio->bi_status));

Nit: I think we can do without the page local variable here.

> + bio_for_each_segment_all(bv, bio, iter_all) {
> + struct page *page = bv->bv_page;
> + page_endio(page, REQ_OP_WRITE,
> blk_status_to_errno(bio->bi_status));

Same here.

> }
>
> @@ -59,7 +73,11 @@ static void mpage_end_io(struct bio *bio)
>
> static struct bio *mpage_bio_submit(struct bio *bio)
> {
> - bio->bi_end_io = mpage_end_io;
> + if (op_is_write(bio_op(bio)))
> + bio->bi_end_io = mpage_write_end_io;
> + else
> + bio->bi_end_io = mpage_read_end_io;
> +

I'd also split mpage_bio_submit as all allers are clearly either
for reads or writes.