Commit 19871b5c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Christian Brauner
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231207072710.176093-15-hch@lst.de


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 30deff85
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -2465,7 +2465,7 @@ int __gfs2_punch_hole(struct file *file, loff_t offset, loff_t length)
}

static int gfs2_map_blocks(struct iomap_writepage_ctx *wpc, struct inode *inode,
		loff_t offset)
		loff_t offset, unsigned int len)
{
	int ret;

+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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);

Loading