]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
fscache: Implement cookie invalidation
authorDavid Howells <dhowells@redhat.com>
Wed, 20 Oct 2021 14:53:34 +0000 (15:53 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 14:28:52 +0000 (14:28 +0000)
commit9d67f13b86437b037abe34c600c9d4e07df21740
treee269b90053dfee4f44036c086fb763dbbee3f98c
parentd6732f80a1bc7138aa24fd21379c97fd1dae74e6
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.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-cachefs@redhat.com
fs/fscache/cookie.c
fs/fscache/internal.h
fs/fscache/stats.c
include/linux/fscache-cache.h
include/linux/fscache.h
include/linux/netfs.h
include/trace/events/fscache.h