Re: [Cluster-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Christoph Hellwig
On Tue, May 30, 2023 at 08:49:22AM -0700, Johannes Thumshirn wrote:
> 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() function.

Looks good:

Reviewed-by: Christoph Hellwig 



Re: [Cluster-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Matthew Wilcox
On Tue, May 30, 2023 at 08:49:22AM -0700, Johannes Thumshirn wrote:
> 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() function.
> 
> Signed-off-by: Johannes Thumshirn 

Reviewed-by: Matthew Wilcox (Oracle) 



[Cluster-devel] [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible

2023-05-30 Thread Johannes Thumshirn
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() function.

Signed-off-by: Johannes Thumshirn 
---
 fs/iomap/buffered-io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 063133ec77f4..42c5fc0ad329 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -312,7 +312,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter 
*iter,
ctx->bio->bi_opf |= REQ_RAHEAD;
ctx->bio->bi_iter.bi_sector = sector;
ctx->bio->bi_end_io = iomap_read_end_io;
-   bio_add_folio(ctx->bio, folio, plen, poff);
+   __bio_add_folio(ctx->bio, folio, plen, poff);
}
 
 done:
@@ -539,7 +539,7 @@ static int iomap_read_folio_sync(loff_t block_start, struct 
folio *folio,
 
bio_init(, iomap->bdev, , 1, REQ_OP_READ);
bio.bi_iter.bi_sector = iomap_sector(iomap, block_start);
-   bio_add_folio(, folio, plen, poff);
+   __bio_add_folio(, folio, plen, poff);
return submit_bio_wait();
 }
 
@@ -1582,7 +1582,7 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, 
struct folio *folio,
 
if (!bio_add_folio(wpc->ioend->io_bio, folio, len, poff)) {
wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio);
-   bio_add_folio(wpc->ioend->io_bio, folio, len, poff);
+   __bio_add_folio(wpc->ioend->io_bio, folio, len, poff);
}
 
if (iop)
-- 
2.40.1