diff options
author | David Howells <dhowells@redhat.com> | 2021-10-21 21:58:29 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2022-01-07 13:43:13 +0000 |
commit | 3929eca769b5a231010b4978acc61c0735da198f (patch) | |
tree | 9f3c81aa6f3e67ad688587db70b17a1e3e4a215b /fs/cachefiles/io.c | |
parent | ecd1a5f62eed35d812de8fe20703e21b551c6560 (diff) |
fscache, cachefiles: Display stats of no-space events
Add stat counters of no-space events that caused caching not to happen and
display in /proc/fs/fscache/stats.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/r/163819653216.215744.17210522251617386509.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/163906958369.143852.7257100711818401748.stgit@warthog.procyon.org.uk/ # v2
Link: https://lore.kernel.org/r/163967166917.1823006.14842444049198947892.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/164021566184.640689.4417328329632709265.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'fs/cachefiles/io.c')
-rw-r--r-- | fs/cachefiles/io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c index 6f4dce0cfc36..60b1eac2ce78 100644 --- a/fs/cachefiles/io.c +++ b/fs/cachefiles/io.c @@ -468,7 +468,8 @@ static int __cachefiles_prepare_write(struct netfs_cache_resources *cres, * space, we need to see if it's fully allocated. If it's not, we may * want to cull it. */ - if (cachefiles_has_space(cache, 0, *_len / PAGE_SIZE) == 0) + if (cachefiles_has_space(cache, 0, *_len / PAGE_SIZE, + cachefiles_has_space_check) == 0) return 0; /* Enough space to simply overwrite the whole block */ pos = cachefiles_inject_read_error(); @@ -483,6 +484,7 @@ static int __cachefiles_prepare_write(struct netfs_cache_resources *cres, return 0; /* Fully allocated */ /* Partially allocated, but insufficient space: cull. */ + fscache_count_no_write_space(); ret = cachefiles_inject_remove_error(); if (ret == 0) ret = vfs_fallocate(file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, @@ -498,7 +500,8 @@ static int __cachefiles_prepare_write(struct netfs_cache_resources *cres, return ret; check_space: - return cachefiles_has_space(cache, 0, *_len / PAGE_SIZE); + return cachefiles_has_space(cache, 0, *_len / PAGE_SIZE, + cachefiles_has_space_for_write); } static int cachefiles_prepare_write(struct netfs_cache_resources *cres, |