> > The buffer_head submission 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: Damien Le Moal <damien.lem...@opensource.wdc.com> > Signed-off-by: Johannes Thumshirn <johannes.thumsh...@wdc.com> > --- > fs/buffer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/buffer.c b/fs/buffer.c > index a7fc561758b1..5abc26d8399d 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -2760,7 +2760,7 @@ static void submit_bh_wbc(blk_opf_t opf, struct > buffer_head *bh, > > bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); > > - bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); > + __bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); > BUG_ON(bio->bi_iter.bi_size != bh->b_size); Can `BUG_ON` be deleted now ? > > bio->bi_end_io = end_bio_bh_io_sync; > -- > 2.40.0 -- thanks, Gou Hao
- [Cluster-devel] [PATCH v5 00/20] bio: check return valu... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 01/20] swap: use __bio_a... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 02/20] drbd: use __bio_a... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 03/20] dm: dm-zoned: use... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 04/20] fs: buffer: use _... Johannes Thumshirn
- Re: [Cluster-devel] [PATCH v5 04/20] fs: buffe... gouhao
- [Cluster-devel] [PATCH v5 05/20] md: use __bio_add... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 07/20] md: raid5: use __... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 08/20] jfs: logmgr: use ... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 06/20] md: raid5-log: us... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 09/20] gfs2: use __bio_a... Johannes Thumshirn
- Re: [Cluster-devel] [PATCH v5 09/20] gfs2: use... Bob Peterson
- Re: [Cluster-devel] [PATCH v5 09/20] gfs2:... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 10/20] zonefs: use __bio... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 11/20] zram: use __bio_a... Johannes Thumshirn
- [Cluster-devel] [PATCH v5 12/20] floppy: use __bio... Johannes Thumshirn