[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250818132905.323-1-luochunsheng@ustc.edu>
Date: Mon, 18 Aug 2025 21:29:05 +0800
From: Chunsheng Luo <luochunsheng@...c.edu>
To: miklos@...redi.hu
Cc: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chunsheng Luo <luochunsheng@...c.edu>
Subject: [PATCH] fuse: clarify extending writes handling
Only flush extending writes (up to LLONG_MAX) for files with upcoming
write operations, and Fix confusing 'end' parameter usage.
Signed-off-by: Chunsheng Luo <luochunsheng@...c.edu>
---
fs/fuse/file.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 95275a1e2f54..d2b8e3a7d4a4 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2851,7 +2851,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end)
{
- int err = filemap_write_and_wait_range(inode->i_mapping, start, LLONG_MAX);
+ int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
if (!err)
fuse_sync_writes(inode);
@@ -2894,9 +2894,8 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
}
if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)) {
- loff_t endbyte = offset + length - 1;
-
- err = fuse_writeback_range(inode, offset, endbyte);
+ /* flush extending writes for upcoming write operations */
+ err = fuse_writeback_range(inode, offset, LLONG_MAX);
if (err)
goto out;
}
@@ -3017,7 +3016,8 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
* To fix this a mapping->invalidate_lock could be used to prevent new
* faults while the copy is ongoing.
*/
- err = fuse_writeback_range(inode_out, pos_out, pos_out + len - 1);
+ /* flush extending writes for upcoming write operations */
+ err = fuse_writeback_range(inode_out, pos_out, LLONG_MAX);
if (err)
goto out;
--
2.43.0
Powered by blists - more mailing lists