Skip to content

Commit 19871b5

Browse files
Christoph Hellwigbrauner
authored andcommitted
iomap: pass the length of the dirty region to ->map_blocks
Let the file system know how much dirty data exists at the passed in offset. This allows file systems to allocate the right amount of space that actually is written back if they can't eagerly convert (e.g. because they don't support unwritten extents). Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20231207072710.176093-15-hch@lst.de Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 30deff8 commit 19871b5

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

block/fops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static void blkdev_readahead(struct readahead_control *rac)
482482
}
483483

484484
static int blkdev_map_blocks(struct iomap_writepage_ctx *wpc,
485-
struct inode *inode, loff_t offset)
485+
struct inode *inode, loff_t offset, unsigned int len)
486486
{
487487
loff_t isize = i_size_read(inode);
488488

fs/gfs2/bmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2465,7 +2465,7 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length)
24652465
}
24662466

24672467
static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
2468-
loff_t offset)
2468+
loff_t offset, unsigned int len)
24692469
{
24702470
int ret;
24712471

fs/iomap/buffered-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17731773
do {
17741774
unsigned map_len;
17751775

1776-
error = wpc->ops->map_blocks(wpc, inode, pos);
1776+
error = wpc->ops->map_blocks(wpc, inode, pos, dirty_len);
17771777
if (error)
17781778
break;
17791779
trace_iomap_writepage_map(inode, &wpc->iomap);

fs/xfs/xfs_aops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ static int
276276
xfs_map_blocks(
277277
struct iomap_writepage_ctx *wpc,
278278
struct inode *inode,
279-
loff_t offset)
279+
loff_t offset,
280+
unsigned int len)
280281
{
281282
struct xfs_inode *ip = XFS_I(inode);
282283
struct xfs_mount *mp = ip->i_mount;

fs/zonefs/file.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ static void zonefs_readahead(struct readahead_control *rac)
125125
* which implies that the page range can only be within the fixed inode size.
126126
*/
127127
static int zonefs_write_map_blocks(struct iomap_writepage_ctx *wpc,
128-
struct inode *inode, loff_t offset)
128+
struct inode *inode, loff_t offset,
129+
unsigned int len)
129130
{
130131
struct zonefs_zone *z = zonefs_inode_zone(inode);
131132

include/linux/iomap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ struct iomap_writeback_ops {
318318
* by the file system if it is still valid.
319319
*/
320320
int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode,
321-
loff_t offset);
321+
loff_t offset, unsigned len);
322322

323323
/*
324324
* Optional, allows the file systems to perform actions just before

0 commit comments

Comments
 (0)