Message ID | 820f11140138c2deb4a649014556aef27474c13b.1680172791.git.johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | bio: check return values of bio_add_page | expand |
On 3/30/23 5:43AM, Johannes Thumshirn wrote: > The JFS IO 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. > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com> > --- > fs/jfs/jfs_logmgr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c > index 695415cbfe98..15c645827dec 100644 > --- a/fs/jfs/jfs_logmgr.c > +++ b/fs/jfs/jfs_logmgr.c > @@ -1974,7 +1974,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) > > bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); > bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); > - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); > + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); > BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); > > bio->bi_end_io = lbmIODone; > @@ -2115,7 +2115,7 @@ static void lbmStartIO(struct lbuf * bp) > > bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); > bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); > - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); > + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); > BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); > > bio->bi_end_io = lbmIODone;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 695415cbfe98..15c645827dec 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1974,7 +1974,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone; @@ -2115,7 +2115,7 @@ static void lbmStartIO(struct lbuf * bp) bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone;