[PATCH] fuse: clarify extending writes handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux