From: Johannes Thumshirn Date: Wed, 31 May 2023 11:50:37 +0000 (-0700) Subject: md: raid1: use __bio_add_page for adding single page to bio X-Git-Tag: unmap-fix-20230629~58^2~147 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f83123223a8447a1369409568f698c68a230010e;p=users%2Fdwmw2%2Flinux.git md: raid1: use __bio_add_page for adding single page to bio The sync request code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Reviewed-by: Christoph Hellwig Reviewed-by: Damien Le Moal Acked-by: Song Liu Signed-off-by: Johannes Thumshirn Link: https://lore.kernel.org/r/6cf7f66c6e646231200d025dfd5f2d3ae75c8fe5.1685532726.git.johannes.thumshirn@wdc.com Signed-off-by: Jens Axboe --- diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 9cfb25967f7b1..3570da63969b5 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2917,7 +2917,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, * won't fail because the vec table is big * enough to hold all these pages */ - bio_add_page(bio, page, len, 0); + __bio_add_page(bio, page, len, 0); } } nr_sectors += len>>9;