Skip to content

RFC Convert NFS to new FS-Cache iter API

Dave Wysochanski linux-nfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest14 patches 6 repliesIn review
  2. v1 RFC13 patches 3 repliesSuperseded

Changes in v2 from the cover letter

* Refactor and general cleanup of read code paths
* Fixes a few build errors when NFS_FSCACHE is not configured
* Fixes directIO data corruption (needed fscache_invalidate() on directIO write)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14NFS: Clean up nfs_readpage() and nfs_readpages()fs/nfs/read.c+23 -220 replies
2/14NFS: In nfs_readpage() only increment NFSIOS_READPAGES when read succeedsfs/nfs/read.c+1 -10 replies
3/14NFS: Refactor nfs_readpage() and nfs_readpage_async() to use nfs_readdescfs/nfs/read.c include/linux/nfs_fs.h+31 -340 replies
4/14NFS: Call readpage_async_filler() from nfs_readpage_async()fs/nfs/read.c+11 -170 replies
5/14NFS: Add nfs_pageio_complete_read() and remove nfs_readpage_async()fs/nfs/read.c include/linux/nfs_fs.h+61 -770 replies
6/14NFS: Allow internal use of read structs and functionsfs/nfs/internal.h fs/nfs/read.c+13 -90 replies
7/14NFS: Convert nfs_readpage() and readpages() to new fscache APIfs/nfs/fscache.c fs/nfs/fscache.h fs/nfs/pagelist.c +3 more+132 -1301 reply
8/14NFS: Convert fscache_acquire_cookie and fscache_relinquish_cookiefs/nfs/fscache-index.c fs/nfs/fscache.c fs/nfs/fscache.h+32 -1210 replies
9/14NFS: Only use and unuse an fscache cookie a single time based on NFS_INO_FSCACHEfs/nfs/fscache.c+14 -70 replies
10/14NFS: Convert fscache invalidation and update aux_data and i_sizefs/nfs/file.c fs/nfs/fscache.c fs/nfs/fscache.h +2 more+35 -730 replies
11/14NFS: Call nfs_fscache_invalidate() when write extends the size of the filefs/nfs/write.c+1 -00 replies
12/14NFS: Invalidate fscache for direct writesfs/nfs/direct.c fs/nfs/file.c fs/nfs/fscache.h +3 more+9 -70 replies
13/14NFS: Call fscache_resize_cookie() when inode size changes due to setattrfs/nfs/inode.c+1 -05 replies
14/14NFS: Allow NFS use of new fscache API in buildfs/nfs/Kconfig+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 0/14] Convert NFS to new FS-Cache iter API

These patches update the nfs client to use the new FS-Cache API and are at:
https://github.com/DaveWysochanskiRH/kernel/tree/fscache-iter-nfs
https://github.com/DaveWysochanskiRH/kernel/commit/467796a0c75d64401c8963e9266f27d87863ed3e

They are based on David Howells fscache-iter tree at 757ac8b16a0edd3befa15c9bdcb2ab3811be945d
https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=fscache-iter&id=757ac8b16a0edd3befa15c9bdcb2ab3811be945d

The first 5 patches refactor some of the NFS read code to facilitate re-use, while the last 9 patches do the conversion to the new FS-Cache API.

Changes since v1
* Refactor and general cleanup of read code paths
* Fixes a few build errors when NFS_FSCACHE is not configured
* Fixes directIO data corruption (needed fscache_invalidate() on directIO write)

Summary
* Takes a "least invasive to existing code" approach
* most fscache bits stay fs/nfs/fscache.[ch]
* only enable fscache for files open for READ (disable for WRITE)
* may not be the best approach (see future patcheset items below)
* Basically works and passes a series of tests (see below)
* No kernel oopses or hangs seen with tests run

Future patchset items
* Call fscache_read_helper_* directly rather than isolation into fs/nfs/fscache.c, similar to the AFS conversion
* Add write-through support
* Eliminate on/off switching of fscache based on whether a file is open for read or write
* TODO: Work out any limitations of NFS versions
* Rework dfprintks and/or add ftrace points
* fscache/cachefiles has 'debug' logging similar to rpcdebug
* convert IO path to ftrace, leave non-IO path as dfprintk?

Tests run
* A few individual NFS/fscache unit tests: PASS
* cthon04 (fsc/non-fsc, vers=3,4.0,4.1,4.2, sec=sys): PASS
* iozone tests (fsc, vers=3,4.0,4.1,4.2, sec=sys): PASS
* xfstests/generic (fsc,vers=4.2): 17/151 (Failed/Ran) 595/444 (Total/NotRan)
Failures: generic/029 generic/030 generic/240 generic/294 generic/306 generic/356 generic/357 generic/452 generic/472 generic/493 generic/494 generic/495 generic/496 generic/497 generic/554 generic/568 generic/569 Failed 17 of 595 tests
* kernel build: FAIL (linking module fails; truncate / invalidate related?)

Test not run
* error injections (for example, connection disruptions, server errors during IO, etc)
* pNFS
* many process mixed read/write on same file
* sec=krb5

Dave Wysochanski (14):
NFS: Clean up nfs_readpage() and nfs_readpages()
NFS: In nfs_readpage() only increment NFSIOS_READPAGES when read
succeeds
NFS: Refactor nfs_readpage() and nfs_readpage_async() to use
nfs_readdesc
NFS: Call readpage_async_filler() from nfs_readpage_async()
NFS: Add nfs_pageio_complete_read() and remove nfs_readpage_async()
NFS: Allow internal use of read structs and functions
NFS: Convert nfs_readpage() and readpages() to new fscache API
NFS: Convert fscache_acquire_cookie and fscache_relinquish_cookie
NFS: Only use and unuse an fscache cookie a single time based on
NFS_INO_FSCACHE
NFS: Convert fscache invalidation and update aux_data and i_size
NFS: Call nfs_fscache_invalidate() when write extends the size of the
file
NFS: Invalidate fscache for direct writes
NFS: Call fscache_resize_cookie() when inode size changes due to
setattr
NFS: Allow NFS use of new fscache API in build

 fs/nfs/Kconfig           |   2 +-
 fs/nfs/direct.c          |   2 +
 fs/nfs/file.c            |  20 +--
 fs/nfs/fscache-index.c   |  94 --------------
 fs/nfs/fscache.c         | 309 +++++++++++++++++++++++------------------------
 fs/nfs/fscache.h         |  99 ++++++---------
 fs/nfs/inode.c           |   4 +-
 fs/nfs/internal.h        |   9 ++
 fs/nfs/nfs4proc.c        |   2 +-
 fs/nfs/pagelist.c        |   1 +
 fs/nfs/read.c            | 217 +++++++++++++++------------------
 fs/nfs/write.c           |   3 +-
 include/linux/nfs_fs.h   |   2 -
 include/linux/nfs_page.h |   1 +
 include/linux/nfs_xdr.h  |   1 +
 15 files changed, 316 insertions(+), 450 deletions(-)
Signature · 1 line
1.8.3.1