Skip to content

Commit be3436b

Browse files
author
Brian Foster
committed
iomap: improve argument passing to iomap_read_folio_sync
JIRA: https://issues.redhat.com/browse/RHEL-121230 commit e6caf01 Author: Christoph Hellwig <hch@lst.de> Date: Thu Jul 10 15:33:36 2025 +0200 iomap: improve argument passing to iomap_read_folio_sync Pass the iomap_iter and derive the map inside iomap_read_folio_sync instead of in the caller, and use the more descriptive srcmap name for the source iomap. Stop passing the offset into folio argument as it can be derived from the folio and the file offset. Rename the variables for the offset into the file and the length to be more descriptive and match the rest of the code. Rename the function itself to iomap_read_folio_range to make the use more clear. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/20250710133343.399917-13-hch@lst.de Reviewed-by: Joanne Koong <joannelkoong@gmail.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Brian Foster <bfoster@redhat.com>
1 parent 893a600 commit be3436b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/iomap/buffered-io.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -659,22 +659,22 @@ iomap_write_failed(struct inode *inode, loff_t pos, unsigned len)
659659
pos + len - 1);
660660
}
661661

662-
static int iomap_read_folio_sync(loff_t block_start, struct folio *folio,
663-
size_t poff, size_t plen, const struct iomap *iomap)
662+
static int iomap_read_folio_range(const struct iomap_iter *iter,
663+
struct folio *folio, loff_t pos, size_t len)
664664
{
665+
const struct iomap *srcmap = iomap_iter_srcmap(iter);
665666
struct bio_vec bvec;
666667
struct bio bio;
667668

668-
bio_init(&bio, iomap->bdev, &bvec, 1, REQ_OP_READ);
669-
bio.bi_iter.bi_sector = iomap_sector(iomap, block_start);
670-
bio_add_folio_nofail(&bio, folio, plen, poff);
669+
bio_init(&bio, srcmap->bdev, &bvec, 1, REQ_OP_READ);
670+
bio.bi_iter.bi_sector = iomap_sector(srcmap, pos);
671+
bio_add_folio_nofail(&bio, folio, len, offset_in_folio(folio, pos));
671672
return submit_bio_wait(&bio);
672673
}
673674

674675
static int __iomap_write_begin(const struct iomap_iter *iter, size_t len,
675676
struct folio *folio)
676677
{
677-
const struct iomap *srcmap = iomap_iter_srcmap(iter);
678678
struct iomap_folio_state *ifs;
679679
loff_t pos = iter->pos;
680680
loff_t block_size = i_blocksize(iter->inode);
@@ -723,8 +723,8 @@ static int __iomap_write_begin(const struct iomap_iter *iter, size_t len,
723723
if (iter->flags & IOMAP_NOWAIT)
724724
return -EAGAIN;
725725

726-
status = iomap_read_folio_sync(block_start, folio,
727-
poff, plen, srcmap);
726+
status = iomap_read_folio_range(iter, folio,
727+
block_start, plen);
728728
if (status)
729729
return status;
730730
}

0 commit comments

Comments
 (0)