linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: clarify extending writes handling
@ 2025-08-18 13:29 Chunsheng Luo
  2025-08-19 14:07 ` Miklos Szeredi
  0 siblings, 1 reply; 7+ messages in thread
From: Chunsheng Luo @ 2025-08-18 13:29 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, linux-kernel, Chunsheng Luo

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@ustc.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-21  6:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 13:29 [PATCH] fuse: clarify extending writes handling Chunsheng Luo
2025-08-19 14:07 ` Miklos Szeredi
2025-08-20  2:11   ` Chunsheng Luo
2025-08-20  5:20     ` Darrick J. Wong
2025-08-20  6:52       ` Miklos Szeredi
2025-08-20 16:27         ` Darrick J. Wong
2025-08-21  6:25           ` Chunsheng Luo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).