]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drbd: use __bio_add_page to add page to bio
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 31 May 2023 11:50:25 +0000 (04:50 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 31 May 2023 15:50:02 +0000 (09:50 -0600)
The drbd code only adds a single page to a newly created bio. So use
__bio_add_page() to add the page which is guaranteed to succeed in this
case.

This brings us closer to marking bio_add_page() as __must_check.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/435007afac14f3766455559059d21843771fae53.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_bitmap.c

index 6ac8c54b44c75a71edc97359f8110d0f3c0786e0..85ca000a05646926fddc4c9186dcf19aa214453e 100644 (file)
@@ -1043,9 +1043,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho
        bio = bio_alloc_bioset(device->ldev->md_bdev, 1, op, GFP_NOIO,
                        &drbd_md_io_bio_set);
        bio->bi_iter.bi_sector = on_disk_sector;
-       /* bio_add_page of a single page to an empty bio will always succeed,
-        * according to api.  Do we want to assert that? */
-       bio_add_page(bio, page, len, 0);
+       __bio_add_page(bio, page, len, 0);
        bio->bi_private = ctx;
        bio->bi_end_io = drbd_bm_endio;