[PATCH 05/26] mm: Remove the PG_fscache alias for PG_private_2

2024-03-28 Thread David Howells
Remove the PG_fscache alias for PG_private_2 and use the latter directly. Use of this flag for marking pages undergoing writing to the cache should be considered deprecated and the folios should be marked dirty instead and the write done in ->writepages(). Note that PG_private_2 itself should be

[PATCH 06/26] netfs: Remove deprecated use of PG_private_2 as a second writeback flag

2024-03-28 Thread David Howells
Remove the deprecated use of PG_private_2 in netfslib. Signed-off-by: David Howells cc: Jeff Layton cc: Matthew Wilcox (Oracle) cc: linux-cach...@redhat.com cc: linux-fsde...@vger.kernel.org cc: linux...@kvack.org --- fs/ceph/addr.c | 19 +- fs/netfs/buffered_read.c | 8 +--

[PATCH 10/26] cifs: Use alternative invalidation to using launder_folio

2024-03-28 Thread David Howells
Use writepages-based flushing invalidation instead of invalidate_inode_pages2() and ->launder_folio(). This will allow ->launder_folio() to be removed eventually. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc:

[PATCH 09/26] mm: Provide a means of invalidation without using launder_folio

2024-03-28 Thread David Howells
Implement a replacement for launder_folio. The key feature of invalidate_inode_pages2() is that it locks each folio individually, unmaps it to prevent mmap'd accesses interfering and calls the ->launder_folio() address_space op to flush it. This has problems: firstly, each folio is written

[PATCH 07/26] netfs: Make netfs_io_request::subreq_counter an atomic_t

2024-03-28 Thread David Howells
Make the netfs_io_request::subreq_counter, used to generate values for netfs_io_subrequest::debug_index, into an atomic_t so that it can be called from the retry thread at the same time as the app thread issuing writes. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc:

[PATCH 08/26] netfs: Use subreq_counter to allocate subreq debug_index values

2024-03-28 Thread David Howells
Use the subreq_counter in netfs_io_request to allocate subrequest debug_index values in read ops as well as write ops. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc: linux-fsde...@vger.kernel.org --- fs/netfs/io.c | 7 ++- fs/netfs/objects.c | 1 +

[PATCH 11/26] 9p: Use alternative invalidation to using launder_folio

2024-03-28 Thread David Howells
Use writepages-based flushing invalidation instead of invalidate_inode_pages2() and ->launder_folio(). This will allow ->launder_folio() to be removed eventually. Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc:

[PATCH 04/26] netfs: Replace PG_fscache by setting folio->private and marking dirty

2024-03-28 Thread David Howells
When dirty data is being written to the cache, setting/waiting on/clearing the fscache flag is always done in tandem with setting/waiting on/clearing the writeback flag. The netfslib buffered write routines wait on and set both flags and the write request cleanup clears both flags, so the fscache

[PATCH 01/26] cifs: Fix duplicate fscache cookie warnings

2024-03-28 Thread David Howells
fscache emits a lot of duplicate cookie warnings with cifs because the index key for the fscache cookies does not include everything that the cifs_find_inode() function does. The latter is used with iget5_locked() to distinguish between inodes in the local inode cache. Fix this by adding the

[PATCH 00/26] netfs, afs, 9p, cifs: Rework netfs to use ->writepages() to copy to cache

2024-03-28 Thread David Howells
Hi Christian, Willy, The primary purpose of these patches is to rework the netfslib writeback implementation such that pages read from the cache are written to the cache through ->writepages(), thereby allowing the fscache page flag to be retired. The reworking also: (1) builds on top of the

[PATCH 02/26] 9p: Clean up some kdoc and unused var warnings.

2024-03-28 Thread David Howells
Remove the kdoc for the removed 'req' member of the 9p_conn struct. Remove a pair of set-but-not-used v9ses variables. Signed-off-by: David Howells cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc: v...@lists.linux.dev ---

[PATCH 03/26] netfs: Update i_blocks when write committed to pagecache

2024-03-28 Thread David Howells
Update i_blocks when i_size is updated when we finish making a write to the pagecache to reflect the amount of space we think will be consumed. Signed-off-by: David Howells cc: Steve French cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: linux-c...@vger.kernel.org cc:

[PATCH 14/26] netfs: Use mempools for allocating requests and subrequests

2024-03-28 Thread David Howells
Use mempools for allocating requests and subrequests in an effort to make sure that allocation always succeeds so that when performing writeback we can always make progress. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc: linux-fsde...@vger.kernel.org cc:

[PATCH 13/26] netfs: Remove ->launder_folio() support

2024-03-28 Thread David Howells
Remove support for ->launder_folio() from netfslib and expect filesystems to use filemap_invalidate_inode() instead. netfs_launder_folio() can then be got rid of. Signed-off-by: David Howells cc: Jeff Layton cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian

[PATCH 16/26] netfs: Switch to using unsigned long long rather than loff_t

2024-03-28 Thread David Howells
Switch to using unsigned long long rather than loff_t in netfslib to avoid problems with the sign flipping in the maths when we're dealing with the byte at position 0x7fff. Signed-off-by: David Howells cc: Jeff Layton cc: Ilya Dryomov cc: Xiubo Li cc: ne...@lists.linux.dev cc:

[PATCH 17/26] netfs: Fix writethrough-mode error handling

2024-03-28 Thread David Howells
Fix the error return in netfs_perform_write() acting in writethrough-mode to return any cached error in the case that netfs_end_writethrough() returns 0. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc: linux-fsde...@vger.kernel.org --- fs/netfs/buffered_write.c | 10

[PATCH 12/26] afs: Use alternative invalidation to using launder_folio

2024-03-28 Thread David Howells
Use writepages-based flushing invalidation instead of invalidate_inode_pages2() and ->launder_folio(). This will allow ->launder_folio() to be removed eventually. Signed-off-by: David Howells cc: Marc Dionne cc: Jeff Layton cc: linux-...@lists.infradead.org cc: ne...@lists.linux.dev cc:

[PATCH 18/26] netfs: Add some write-side stats and clean up some stat names

2024-03-28 Thread David Howells
Add some write-side stats to count buffered writes, buffered writethrough, and writepages calls. Whilst we're at it, clean up the naming on some of the existing stats counters and organise the output into two sets. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc:

[PATCH 15/26] mm: Export writeback_iter()

2024-03-28 Thread David Howells
Export writeback_iter() so that it can be used by netfslib as a module. Signed-off-by: David Howells cc: Matthew Wilcox (Oracle) cc: Christoph Hellwig cc: linux...@kvack.org --- mm/page-writeback.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/page-writeback.c b/mm/page-writeback.c

[PATCH 19/26] netfs: New writeback implementation

2024-03-28 Thread David Howells
The current netfslib writeback implementation creates writeback requests of contiguous folio data and then separately tiles subrequests over the space twice, once for the server and once for the cache. This creates a few issues: (1) Every time there's a discontiguity or a change between writing

[PATCH 22/26] netfs, cachefiles: Implement helpers for new write code

2024-03-28 Thread David Howells
Implement the helpers for the new write code in cachefiles. There's now an optional ->prepare_write() that allows the filesystem to set the parameters for the next write, such as maximum size and maximum segment count, and an ->issue_write() that is called to initiate an (asynchronous) write

[PATCH 23/26] netfs: Cut over to using new writeback code

2024-03-28 Thread David Howells
Cut over to using the new writeback code. The old code is #ifdef'd out or otherwise removed from compilation to avoid conflicts and will be removed in a future patch. Signed-off-by: David Howells cc: Jeff Layton cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc:

[PATCH 24/26] netfs: Remove the old writeback code

2024-03-28 Thread David Howells
Remove the old writeback code. Signed-off-by: David Howells cc: Jeff Layton cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc: Marc Dionne cc: v...@lists.linux.dev cc: linux-...@lists.infradead.org cc: ne...@lists.linux.dev cc:

[PATCH 20/26] netfs, afs: Implement helpers for new write code

2024-03-28 Thread David Howells
Implement the helpers for the new write code in afs. There's now an optional ->prepare_write() that allows the filesystem to set the parameters for the next write, such as maximum size and maximum segment count, and an ->issue_write() that is called to initiate an (asynchronous) write operation.

[PATCH 25/26] netfs: Miscellaneous tidy ups

2024-03-28 Thread David Howells
Do a couple of miscellaneous tidy ups: (1) Add a qualifier into a file banner comment. (2) Put the writeback folio traces back into alphabetical order. (3) Remove some unused folio traces. Signed-off-by: David Howells cc: Jeff Layton cc: ne...@lists.linux.dev cc:

[PATCH 26/26] netfs, afs: Use writeback retry to deal with alternate keys

2024-03-28 Thread David Howells
Use a hook in the new writeback code's retry algorithm to rotate the keys once all the outstanding subreqs have failed rather than doing it separately on each subreq. Signed-off-by: David Howells cc: Marc Dionne cc: Jeff Layton cc: linux-...@lists.infradead.org cc: ne...@lists.linux.dev cc:

[PATCH 21/26] netfs, 9p: Implement helpers for new write code

2024-03-28 Thread David Howells
Implement the helpers for the new write code in 9p. There's now an optional ->prepare_write() that allows the filesystem to set the parameters for the next write, such as maximum size and maximum segment count, and an ->issue_write() that is called to initiate an (asynchronous) write operation.