[PATCH 03/17] netfs: Fix early issue of write op on partial write to folio tail

David Howells dhowells at redhat.com
Fri Jun 21 03:31:21 AEST 2024


During the writeback procedure, at the end of netfs_write_folio(), pending
write operations are flushed if the amount of write-streaming data stored
in a page is less than the size of the folio because if we haven't modified
a folio to the end, it cannot be contiguous with the following folio...
except if the dirty region of the folio is right at the end of the folio
space.

Fix the test to take the offset into the folio into account as well, such
that if the dirty region runs right up to the end of the folio, we leave
the flushing for later.

Fixes: 288ace2f57c9 ("netfs: New writeback implementation")
Signed-off-by: David Howells <dhowells at redhat.com>
cc: Jeff Layton <jlayton at kernel.org>
cc: Eric Van Hensbergen <ericvh at kernel.org>
cc: Latchesar Ionkov <lucho at ionkov.net>
cc: Dominique Martinet <asmadeus at codewreck.org>
cc: Christian Schoenebeck <linux_oss at crudebyte.com>
cc: Marc Dionne <marc.dionne at auristor.com>
cc: Steve French <sfrench at samba.org>
cc: Paulo Alcantara <pc at manguebit.com> (DFS, global name space)
cc: v9fs at lists.linux.dev
cc: linux-afs at lists.infradead.org
cc: linux-cifs at vger.kernel.org
cc: netfs at lists.linux.dev
cc: linux-fsdevel at vger.kernel.org
---
 fs/netfs/write_issue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c
index 3aa86e268f40..ec6cf8707fb0 100644
--- a/fs/netfs/write_issue.c
+++ b/fs/netfs/write_issue.c
@@ -483,7 +483,7 @@ static int netfs_write_folio(struct netfs_io_request *wreq,
 	if (!debug)
 		kdebug("R=%x: No submit", wreq->debug_id);
 
-	if (flen < fsize)
+	if (foff + flen < fsize)
 		for (int s = 0; s < NR_IO_STREAMS; s++)
 			netfs_issue_write(wreq, &wreq->io_streams[s]);
 



More information about the Linux-erofs mailing list