Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: iomap: use bio_add_folio_nofail where possible

When the iomap buffered-io code can't add a folio to a bio, it allocates a
new bio and adds the folio to that one. This is done using bio_add_folio(),
but doesn't check for errors.

As adding a folio to a newly created bio can't fail, use the newly
introduced bio_add_folio_nofail() function.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/58fa893c24c67340a63323f09a179fefdca07f2a.1685532726.git.johannes.thumshirn@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Johannes Thumshirn and committed by
Jens Axboe
c2478469 7a150f1e

+3 -3
+3 -3
fs/iomap/buffered-io.c
··· 312 312 ctx->bio->bi_opf |= REQ_RAHEAD; 313 313 ctx->bio->bi_iter.bi_sector = sector; 314 314 ctx->bio->bi_end_io = iomap_read_end_io; 315 - bio_add_folio(ctx->bio, folio, plen, poff); 315 + bio_add_folio_nofail(ctx->bio, folio, plen, poff); 316 316 } 317 317 318 318 done: ··· 539 539 540 540 bio_init(&bio, iomap->bdev, &bvec, 1, REQ_OP_READ); 541 541 bio.bi_iter.bi_sector = iomap_sector(iomap, block_start); 542 - bio_add_folio(&bio, folio, plen, poff); 542 + bio_add_folio_nofail(&bio, folio, plen, poff); 543 543 return submit_bio_wait(&bio); 544 544 } 545 545 ··· 1582 1582 1583 1583 if (!bio_add_folio(wpc->ioend->io_bio, folio, len, poff)) { 1584 1584 wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio); 1585 - bio_add_folio(wpc->ioend->io_bio, folio, len, poff); 1585 + bio_add_folio_nofail(wpc->ioend->io_bio, folio, len, poff); 1586 1586 } 1587 1587 1588 1588 if (iop)