diff options
author | David Howells <dhowells@redhat.com> | 2022-01-14 14:13:59 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2022-01-21 21:36:28 +0000 |
commit | 5638b067d370583c6c455f019129ce33340b4142 (patch) | |
tree | 1c92e035d914e2f2ae87414afe2986e4abed0230 /kernel/taskstats.c | |
parent | 80a00ab8344f0fe4d555a1f97960215b659436e9 (diff) |
cachefiles: Calculate the blockshift in terms of bytes, not pages
Cachefiles keeps track of how much space is available on the backing
filesystem and refuses new writes permission to start if there isn't enough
(we especially don't want ENOSPC happening). It also tracks the amount of
data pending in DIO writes (cache->b_writing) and reduces the amount of
free space available by this amount before deciding if it can set up a new
write.
However, the old fscache I/O API was very much page-granularity dependent
and, as such, cachefiles's cache->bshift was meant to be a multiplier to
get from PAGE_SIZE to block size (ie. a blocksize of 512 would give a shift
of 3 for a 4KiB page) - and this was incorrectly being used to turn the
number of bytes in a DIO write into a number of blocks, leading to a
massive over estimation of the amount of data in flight.
Fix this by changing cache->bshift to be a multiplier from bytes to
blocksize and deal with quantities of blocks, not quantities of pages.
Fix also the rounding in the calculation in cachefiles_write() which needs
a "- 1" inserting.
Fixes: 047487c947e8 ("cachefiles: Implement the I/O routines")
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/164251398954.3435901.7138806620218474123.stgit@warthog.procyon.org.uk/ # v1
Diffstat (limited to 'kernel/taskstats.c')
0 files changed, 0 insertions, 0 deletions