]> Git Repo - linux.git/commit
netfs: Optimise away reads above the point at which there can be no data
authorDavid Howells <[email protected]>
Fri, 24 Nov 2023 13:39:02 +0000 (13:39 +0000)
committerDavid Howells <[email protected]>
Thu, 28 Dec 2023 09:45:27 +0000 (09:45 +0000)
commit100ccd18bb41ea7abb4fbb419202c06079559501
tree7782c047ddb96ef5122e22fddea8ea3444f32842
parent41d8e7673a7726cba57cb8112d81c89cfb6c3e35
netfs: Optimise away reads above the point at which there can be no data

Track the file position above which the server is not expected to have any
data (the "zero point") and preemptively assume that we can satisfy
requests by filling them with zeroes locally rather than attempting to
download them if they're over that line - even if we've written data back
to the server.  Assume that any data that was written back above that
position is held in the local cache.  Note that we have to split requests
that straddle the line.

Make use of this to optimise away some reads from the server.  We need to
set the zero point in the following circumstances:

 (1) When we see an extant remote inode and have no cache for it, we set
     the zero_point to i_size.

 (2) On local inode creation, we set zero_point to 0.

 (3) On local truncation down, we reduce zero_point to the new i_size if
     the new i_size is lower.

 (4) On local truncation up, we don't change zero_point.

 (5) On local modification, we don't change zero_point.

 (6) On remote invalidation, we set zero_point to the new i_size.

 (7) If stored data is discarded from the pagecache or culled from fscache,
     we must set zero_point above that if the data also got written to the
     server.

 (8) If dirty data is written back to the server, but not fscache, we must
     set zero_point above that.

 (9) If a direct I/O write is made, set zero_point above that.

Assuming the above, any read from the server at or above the zero_point
position will return all zeroes.

The zero_point value can be stored in the cache, provided the above rules
are applied to it by any code that culls part of the local cache.

Signed-off-by: David Howells <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
fs/9p/vfs_inode.c
fs/afs/dynroot.c
fs/afs/inode.c
fs/ceph/inode.c
fs/netfs/buffered_write.c
fs/netfs/direct_write.c
fs/netfs/io.c
fs/netfs/misc.c
fs/nfs/fscache.h
fs/smb/client/cifsfs.c
include/linux/netfs.h
This page took 0.061515 seconds and 4 git commands to generate.