[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3452631.1724080629@warthog.procyon.org.uk>
Date: Mon, 19 Aug 2024 16:17:09 +0100
From: David Howells <dhowells@...hat.com>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
Cc: dhowells@...hat.com, brauner@...nel.org, akpm@...ux-foundation.org,
chandan.babu@...cle.com, linux-fsdevel@...r.kernel.org,
djwong@...nel.org, hare@...e.de, gost.dev@...sung.com,
linux-xfs@...r.kernel.org, hch@....de, david@...morbit.com,
Zi Yan <ziy@...dia.com>, yang@...amperecomputing.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
willy@...radead.org, john.g.garry@...cle.com,
cl@...amperecomputing.com, p.raghav@...sung.com, mcgrof@...nel.org,
ryan.roberts@....com
Subject: Re: [PATCH v12 00/10] enable bs > ps in XFS
Okay, the code in netfs_invalidate_folio() isn't correct in the way it reduces
streaming writes. Attached is a patch that shows some of the changes I need
to make - but this is not yet working.
David
---
diff --git a/fs/netfs/misc.c b/fs/netfs/misc.c
index eaa0a992d178..e237c771eeb5 100644
--- a/fs/netfs/misc.c
+++ b/fs/netfs/misc.c
@@ -214,18 +215,34 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
/* We have a partially uptodate page from a streaming write. */
unsigned int fstart = finfo->dirty_offset;
unsigned int fend = fstart + finfo->dirty_len;
- unsigned int end = offset + length;
+ unsigned int iend = offset + length;
if (offset >= fend)
return;
- if (end <= fstart)
+ if (iend <= fstart)
+ return;
+
+ /* The invalidation region overlaps the data. If the region
+ * covers the start of the data, we either move along the start
+ * or just erase the data entirely.
+ */
+ if (offset <= fstart) {
+ if (iend >= fend)
+ goto erase_completely;
+ /* Move the start of the data. */
+ finfo->dirty_len = fend - iend;
+ finfo->dirty_offset = offset;
return;
- if (offset <= fstart && end >= fend)
- goto erase_completely;
- if (offset <= fstart && end > fstart)
- goto reduce_len;
- if (offset > fstart && end >= fend)
- goto move_start;
+ }
+
+ /* Reduce the length of the data if the invalidation region
+ * covers the tail part.
+ */
+ if (iend >= fend) {
+ finfo->dirty_len = offset - fstart;
+ return;
+ }
+
/* A partial write was split. The caller has already zeroed
* it, so just absorb the hole.
*/
@@ -238,12 +261,6 @@ void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
folio_clear_uptodate(folio);
kfree(finfo);
return;
-reduce_len:
- finfo->dirty_len = offset + length - finfo->dirty_offset;
- return;
-move_start:
- finfo->dirty_len -= offset - finfo->dirty_offset;
- finfo->dirty_offset = offset;
}
EXPORT_SYMBOL(netfs_invalidate_folio);
Powered by blists - more mailing lists