diff options
author | David Howells <dhowells@redhat.com> | 2021-10-20 17:53:34 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2022-01-07 12:22:19 +0300 |
commit | d24af13e2e2358a602740c7817ea90da43d3e740 (patch) | |
tree | 344a8b83aff3845d17f46eaa8fae751351b9a233 /fs/fscache/io.c | |
parent | 12bb21a29c19aae50cfad4e2bb5c943108f34a7d (diff) | |
download | linux-d24af13e2e2358a602740c7817ea90da43d3e740.tar.xz |
fscache: Implement cookie invalidation
Add a function to invalidate the cache behind a cookie:
void fscache_invalidate(struct fscache_cookie *cookie,
const void *aux_data,
loff_t size,
unsigned int flags)
This causes any cached data for the specified cookie to be discarded. If
the cookie is marked as being in use, a new cache object will be created if
possible and future I/O will use that instead. In-flight I/O should be
abandoned (writes) or reconsidered (reads). Each time it is called
cookie->inval_counter is incremented and this can be used to detect
invalidation at the end of an I/O operation.
The coherency data attached to the cookie can be updated and the cookie
size should be reset. One flag is available, FSCACHE_INVAL_DIO_WRITE,
which should be used to indicate invalidation due to a DIO write on a
file. This will temporarily disable caching for this cookie.
Changes
=======
ver #2:
- Should only change to inval state if can get access to cache.
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/163819602231.215744.11206598147269491575.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/163906909707.143852.18056070560477964891.stgit@warthog.procyon.org.uk/ # v2
Link: https://lore.kernel.org/r/163967107447.1823006.5945029409592119962.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/164021512640.640689.11418616313147754172.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'fs/fscache/io.c')
0 files changed, 0 insertions, 0 deletions