• David Howells's avatar
    afs: Convert afs to use the new fscache API · 523d27cd
    David Howells authored
    Change the afs filesystem to support the new afs driver.
    
    The following changes have been made:
    
     (1) The fscache_netfs struct is no more, and there's no need to register
         the filesystem as a whole.  There's also no longer a cell cookie.
    
     (2) The volume cookie is now an fscache_volume cookie, allocated with
         fscache_acquire_volume().  This function takes three parameters: a
         string representing the "volume" in the index, a string naming the
         cache to use (or NULL) and a u64 that conveys coherency metadata for
         the volume.
    
         For afs, I've made it render the volume name string as:
    
            "afs,<cell>,<volume_id>"
    
         and the coherency data is currently 0.
    
     (3) The fscache_cookie_def is no more and needed information is passed
         directly to fscache_acquire_cookie().  The cache no longer calls back
         into the filesystem, but rather metadata changes are indicated at
         other times.
    
         fscache_acquire_cookie() is passed the same keying and coherency
         information as before, except that these are now stored in big endian
         form instead of cpu endian.  This makes the cache more copyable.
    
     (4) fscache_use_cookie() and fscache_unuse_cookie() are called when a file
         is opened or closed to prevent a cache file from being culled and to
         keep resources to hand that are needed to do I/O.
    
         fscache_use_cookie() is given an indication if the cache is likely to
         be modified locally (e.g. the file is open for writing).
    
         fscache_unuse_cookie() is given a coherency update if we had the file
         open for writing and will update that.
    
     (5) fscache_invalidate() is now given uptodate auxiliary data and a file
         size.  It can also take a flag to indicate if this was due to a DIO
         write.  This is wrapped into afs_fscache_invalidate() now for
         convenience.
    
     (6) fscache_resize() now gets called from the finalisation of
         afs_setattr(), and afs_setattr() does use/unuse of the cookie around
         the call to support this.
    
     (7) fscache_note_page_release() is called from afs_release_page().
    
     (8) Use a killable wait in nfs_vm_page_mkwrite() when waiting for
         PG_fscache to be cleared.
    
    Render the parts of the cookie key for an afs inode cookie as big endian.
    
    Changes
    =======
    ver #2:
     - Use gfpflags_allow_blocking() rather than using flag directly.
     - fscache_acquire_volume() now returns errors.
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Acked-by: default avatarJeff Layton <jlayton@kernel.org>
    Tested-by: kafs-testing@auristor.com
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    cc: linux-cachefs@redhat.com
    Link: https://lore.kernel.org/r/163819661382.215744.1485608824741611837.stgit@warthog.procyon.org.uk/ # v1
    Link: https://lore.kernel.org/r/163906970002.143852.17678518584089878259.stgit@warthog.procyon.org.uk/ # v2
    Link: https://lore.kernel.org/r/163967174665.1823006.1301789965454084220.stgit@warthog.procyon.org.uk/ # v3
    Link: https://lore.kernel.org/r/164021568841.640689.6684240152253400380.stgit@warthog.procyon.org.uk/ # v4
    523d27cd
main.c 6.01 KB