Skip to content

Commit 31754ea

Browse files
josefbacikbrauner
authored andcommitted
iomap: add a private argument for iomap_file_buffered_write
In order to switch fuse over to using iomap for buffered writes we need to be able to have the struct file for the original write, in case we have to read in the page to make it uptodate. Handle this by using the existing private field in the iomap_iter, and add the argument to iomap_file_buffered_write. This will allow us to pass the file in through the iomap buffered write path, and is flexible for any other file systems needs. Signed-off-by: Josef Bacik <[email protected]> Link: https://lore.kernel.org/r/7f55c7c32275004ba00cddf862d970e6e633f750.1724755651.git.josef@toxicpanda.com Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent d1dd75d commit 31754ea

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

block/fops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ blkdev_direct_write(struct kiocb *iocb, struct iov_iter *from)
665665

666666
static ssize_t blkdev_buffered_write(struct kiocb *iocb, struct iov_iter *from)
667667
{
668-
return iomap_file_buffered_write(iocb, from, &blkdev_iomap_ops);
668+
return iomap_file_buffered_write(iocb, from, &blkdev_iomap_ops, NULL);
669669
}
670670

671671
/*

fs/gfs2/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
10571057
}
10581058

10591059
pagefault_disable();
1060-
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
1060+
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops, NULL);
10611061
pagefault_enable();
10621062
if (ret > 0)
10631063
written += ret;

fs/iomap/buffered-io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,13 +1022,14 @@ static loff_t iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
10221022

10231023
ssize_t
10241024
iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i,
1025-
const struct iomap_ops *ops)
1025+
const struct iomap_ops *ops, void *private)
10261026
{
10271027
struct iomap_iter iter = {
10281028
.inode = iocb->ki_filp->f_mapping->host,
10291029
.pos = iocb->ki_pos,
10301030
.len = iov_iter_count(i),
10311031
.flags = IOMAP_WRITE,
1032+
.private = private,
10321033
};
10331034
ssize_t ret;
10341035

fs/xfs/xfs_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ xfs_file_buffered_write(
760760

761761
trace_xfs_file_buffered_write(iocb, from);
762762
ret = iomap_file_buffered_write(iocb, from,
763-
&xfs_buffered_write_iomap_ops);
763+
&xfs_buffered_write_iomap_ops, NULL);
764764

765765
/*
766766
* If we hit a space limit, try to free up some lingering preallocated

fs/zonefs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static ssize_t zonefs_file_buffered_write(struct kiocb *iocb,
563563
if (ret <= 0)
564564
goto inode_unlock;
565565

566-
ret = iomap_file_buffered_write(iocb, from, &zonefs_write_iomap_ops);
566+
ret = iomap_file_buffered_write(iocb, from, &zonefs_write_iomap_ops, NULL);
567567
if (ret == -EIO)
568568
zonefs_io_error(inode, true);
569569

include/linux/iomap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static inline const struct iomap *iomap_iter_srcmap(const struct iomap_iter *i)
257257
}
258258

259259
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
260-
const struct iomap_ops *ops);
260+
const struct iomap_ops *ops, void *private);
261261
int iomap_file_buffered_write_punch_delalloc(struct inode *inode,
262262
struct iomap *iomap, loff_t pos, loff_t length, ssize_t written,
263263
int (*punch)(struct inode *inode, loff_t pos, loff_t length));

0 commit comments

Comments
 (0)