linux-stable/fs/fscache
David Howells d24af13e2e 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
2022-01-07 09:22:19 +00:00
..
cache.c fscache: Add a function for a cache backend to note an I/O error 2022-01-07 09:22:19 +00:00
cookie.c fscache: Implement cookie invalidation 2022-01-07 09:22:19 +00:00
internal.h fscache: Implement cookie invalidation 2022-01-07 09:22:19 +00:00
Kconfig fscache: Introduce new driver 2022-01-07 09:22:19 +00:00
main.c fscache: Implement cookie-level access helpers 2022-01-07 09:22:19 +00:00
Makefile fscache: Implement cookie registration 2022-01-07 09:22:19 +00:00
proc.c fscache: Implement cookie registration 2022-01-07 09:22:19 +00:00
stats.c fscache: Implement cookie invalidation 2022-01-07 09:22:19 +00:00
volume.c fscache: Provide and use cache methods to lookup/create/free a volume 2022-01-07 09:22:19 +00:00