[GIT PULL] afs: Preparation for fscache overhaul

From: David Howells
Date: Mon Apr 26 2021 - 20:14:15 EST

Hi Linus,

Here's a set of patches for the AFS filesystem for 5.13 to begin the
process of overhauling the use of the fscache API by AFS and the
introduction of support for features such as Transparent Huge Pages (THPs).

(1) Add some support for THPs, including using core VM helper functions to
find details of pages.

(2) Use the ITER_XARRAY I/O iterator to mediate access to the pagecache as
this handles THPs and doesn't require allocation of large bvec arrays.

(3) Delegate address_space read/pre-write I/O methods for AFS to the netfs
helper library. A method is provided to the library that allows it to
issue a read against the server.

This includes a change in use for PG_fscache (it now indicates a DIO
write in progress from the marked page), so a number of waits need to
be deployed for it.

(4) Split the core AFS writeback function to make it easier to modify in
future patches to handle writing to the cache. [This might feasibly
make more sense moved out into my fscache-iter branch].

I've tested these with "xfstests -g quick" against an AFS volume (xfstests
needs patching to make it work). With this, AFS without a cache passes all
expected xfstests; with a cache, there's an extra failure, but that's also
there before these patches. Fixing that probably requires a greater
overhaul (as can be found on my fscache-iter branch, but that's for a later

Thanks should go to Marc Dionne and Jeff Altman of AuriStor for exercising
the patches in their test farm also.


These patches are dependent on the netfs-lib branch and have been posted in
association with them. The changes relevant to these patches are:

ver #6:
Split the afs patches out into their own branch.

ver #5:
Fixed some review comments from Matthew Wilcox:

- Better names for wrangling functions for PG_private_2 and
PG_fscache wrangling functions[3]. Came up with
{set,end,wait_for}_page_private_2() and aliased these for fscache.

Moved the taking of/dropping a page ref for the PG_private_2 flag
into the set and end functions.

ver #4:
Rebased to v5.12-rc2 and added a bunch of references into individual

ver #3:
Adjusted the functions that unlock and wait for PG_fscache according
to Linus's suggestion[1].

Hold a ref on a page when PG_fscache is set as per Linus's

Link: https://lore.kernel.org/r/CAHk-=wh+2gbF7XEjYc=HV9w_2uVzVf7vs60BPz0gFA=+pUm3ww@xxxxxxxxxxxxxx/ [1]
Link: https://lore.kernel.org/r/CAHk-=wjgA-74ddehziVk=XAEMTKswPu1Yw4uaro1R3ibs27ztw@xxxxxxxxxxxxxx/ [2]
Link: https://lore.kernel.org/r/20210321105309.GG3420@xxxxxxxxxxxxxxxxxxxx/ [3]


These patches have been published for review before, firstly as part of a
larger set:

Link: https://lore.kernel.org/r/158861203563.340223.7585359869938129395.stgit@xxxxxxxxxxxxxxxxxxxxxx/

Link: https://lore.kernel.org/r/159465766378.1376105.11619976251039287525.stgit@xxxxxxxxxxxxxxxxxxxxxx/
Link: https://lore.kernel.org/r/159465784033.1376674.18106463693989811037.stgit@xxxxxxxxxxxxxxxxxxxxxx/
Link: https://lore.kernel.org/r/159465821598.1377938.2046362270225008168.stgit@xxxxxxxxxxxxxxxxxxxxxx/

Link: https://lore.kernel.org/r/160588455242.3465195.3214733858273019178.stgit@xxxxxxxxxxxxxxxxxxxxxx/

Then as a cut-down set:

Link: https://lore.kernel.org/r/161118128472.1232039.11746799833066425131.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v1
Link: https://lore.kernel.org/r/161161025063.2537118.2009249444682241405.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v2
Link: https://lore.kernel.org/r/161340385320.1303470.2392622971006879777.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v3
Link: https://lore.kernel.org/r/161539526152.286939.8589700175877370401.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v4
Link: https://lore.kernel.org/r/161653784755.2770958.11820491619308713741.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v5
Link: https://lore.kernel.org/r/161789062190.6155.12711584466338493050.stgit@xxxxxxxxxxxxxxxxxxxxxx/ # v6
Link: https://lore.kernel.org/r/161918446704.3145707.14418606303992174310.stgit@xxxxxxxxxxxxxxxxxxxxxx # v7

The following changes since commit 26aaeffcafe6cbb7c3978fa6ed7555122f8c9f8c:

fscache, cachefiles: Add alternate API to use kiocb for read/write to cache (2021-04-23 10:14:32 +0100)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/afs-netfs-lib-20210426

for you to fetch changes up to 3003bbd0697b659944237f3459489cb596ba196c:

afs: Use the netfs_write_begin() helper (2021-04-23 10:17:28 +0100)

AFS: Use the new netfs lib

David Howells (14):
afs: Disable use of the fscache I/O routines
afs: Pass page into dirty region helpers to provide THP size
afs: Print the operation debug_id when logging an unexpected data version
afs: Move key to afs_read struct
afs: Don't truncate iter during data fetch
afs: Log remote unmarshalling errors
afs: Set up the iov_iter before calling afs_extract_data()
afs: Use ITER_XARRAY for writing
afs: Wait on PG_fscache before modifying/releasing a page
afs: Extract writeback extension into its own function
afs: Prepare for use of THPs
afs: Use the fs operation ops to handle FetchData completion
afs: Use new netfs lib read helper API
afs: Use the netfs_write_begin() helper

fs/afs/Kconfig | 1 +
fs/afs/dir.c | 225 +++++++++++-----
fs/afs/file.c | 483 +++++++++------------------------
fs/afs/fs_operation.c | 4 +-
fs/afs/fsclient.c | 108 +++-----
fs/afs/inode.c | 7 +-
fs/afs/internal.h | 59 ++--
fs/afs/rxrpc.c | 150 ++++-------
fs/afs/write.c | 657 +++++++++++++++++++++++----------------------
fs/afs/yfsclient.c | 82 ++----
include/net/af_rxrpc.h | 2 +-
include/trace/events/afs.h | 74 +++--
net/rxrpc/recvmsg.c | 9 +-
13 files changed, 805 insertions(+), 1056 deletions(-)