summaryrefslogtreecommitdiff
path: root/fs/afs/proc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-04-06 14:17:25 +0100
committerDavid Howells <dhowells@redhat.com>2018-04-09 21:54:48 +0100
commitf3ddee8dc4e2cff37936afbeed2fdaa95b7fb7c6 (patch)
treee077005245794c5cacfc36eb6100cb3c819a8954 /fs/afs/proc.c
parent66c7e1d319a5b3a57de688a36200e463ec87e88e (diff)
afs: Fix directory handling
AFS directories are structured blobs that are downloaded just like files and then parsed by the lookup and readdir code and, as such, are currently handled in the pagecache like any other file, with the entire directory content being thrown away each time the directory changes. However, since the blob is a known structure and since the data version counter on a directory increases by exactly one for each change committed to that directory, we can actually edit the directory locally rather than fetching it from the server after each locally-induced change. What we can't do, though, is mix data from the server and data from the client since the server is technically at liberty to rearrange or compress a directory if it sees fit, provided it updates the data version number when it does so and breaks the callback (ie. sends a notification). Further, lookup with lookup-ahead, readdir and, when it arrives, local editing are likely want to scan the whole of a directory. So directory handling needs to be improved to maintain the coherency of the directory blob prior to permitting local directory editing. To this end: (1) If any directory page gets discarded, invalidate and reread the entire directory. (2) If readpage notes that if when it fetches a single page that the version number has changed, the entire directory is flagged for invalidation. (3) Read as much of the directory in one go as we can. Note that this removes local caching of directories in fscache for the moment as we can't pass the pages to fscache_read_or_alloc_pages() since page->lru is in use by the LRU. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/proc.c')
-rw-r--r--fs/afs/proc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 8bffb17f9728..6f5a000f44a7 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -910,10 +910,11 @@ static int afs_proc_stats_show(struct seq_file *m, void *v)
seq_puts(m, "kAFS statistics\n");
- seq_printf(m, "dir-mgmt: look=%u reval=%u inval=%u\n",
+ seq_printf(m, "dir-mgmt: look=%u reval=%u inval=%u relpg=%u\n",
atomic_read(&net->n_lookup),
atomic_read(&net->n_reval),
- atomic_read(&net->n_inval));
+ atomic_read(&net->n_inval),
+ atomic_read(&net->n_relpg));
seq_printf(m, "dir-data: rdpg=%u\n",
atomic_read(&net->n_read_dir));