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>
This commit is contained in:
Christoph Hellwig 2023-12-07 08:27:10 +01:00 committed by Christian Brauner
parent 30deff8531
commit 19871b5c7a
6 changed files with 8 additions and 6 deletions

View File

@ -482,7 +482,7 @@ static void blkdev_readahead(struct readahead_control *rac)
}
static int blkdev_map_blocks(struct iomap_writepage_ctx *wpc,
struct inode *inode, loff_t offset)
struct inode *inode, loff_t offset, unsigned int len)
{
loff_t isize = i_size_read(inode);

View File

@ -2465,7 +2465,7 @@ out:
}
static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
loff_t offset)
loff_t offset, unsigned int len)
{
int ret;

View File

@ -1773,7 +1773,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
do {
unsigned map_len;
error = wpc->ops->map_blocks(wpc, inode, pos);
error = wpc->ops->map_blocks(wpc, inode, pos, dirty_len);
if (error)
break;
trace_iomap_writepage_map(inode, &wpc->iomap);

View File

@ -276,7 +276,8 @@ static int
xfs_map_blocks(
struct iomap_writepage_ctx *wpc,
struct inode *inode,
loff_t offset)
loff_t offset,
unsigned int len)
{
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;

View File

@ -125,7 +125,8 @@ static void zonefs_readahead(struct readahead_control *rac)
* which implies that the page range can only be within the fixed inode size.
*/
static int zonefs_write_map_blocks(struct iomap_writepage_ctx *wpc,
struct inode *inode, loff_t offset)
struct inode *inode, loff_t offset,
unsigned int len)
{
struct zonefs_zone *z = zonefs_inode_zone(inode);

View File

@ -318,7 +318,7 @@ struct iomap_writeback_ops {
* by the file system if it is still valid.
*/
int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode,
loff_t offset);
loff_t offset, unsigned len);
/*
* Optional, allows the file systems to perform actions just before