summaryrefslogtreecommitdiff
path: root/include/linux/fscache-cache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2021-10-20 17:26:17 +0300
committerDavid Howells <dhowells@redhat.com>2022-01-07 12:22:19 +0300
commitbfa22da3ed652aa15acd4246fa13a0de6dbe4a59 (patch)
tree8ff907c2502d7f1576b1db58156085b68d094b9b /include/linux/fscache-cache.h
parent2e0c76aee25f33c482abda6224bd87732359354d (diff)
downloadlinux-bfa22da3ed652aa15acd4246fa13a0de6dbe4a59.tar.xz
fscache: Provide and use cache methods to lookup/create/free a volume
Add cache methods to lookup, create and remove a volume. Looking up or creating the volume requires the cache pinning for access; freeing the volume requires the volume pinning for access. The ->acquire_volume() method is used to ask the cache backend to lookup and, if necessary, create a volume; the ->free_volume() method is used to free the resources for a volume. 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/163819597821.215744.5225318658134989949.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906898645.143852.8537799955945956818.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967099771.1823006.1455197910571061835.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021507345.640689.4073511598838843040.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'include/linux/fscache-cache.h')
-rw-r--r--include/linux/fscache-cache.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index f78add6e7823..a10b66ca3544 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -51,6 +51,12 @@ struct fscache_cache {
struct fscache_cache_ops {
/* name of cache provider */
const char *name;
+
+ /* Acquire a volume */
+ void (*acquire_volume)(struct fscache_volume *volume);
+
+ /* Free the cache's data attached to a volume */
+ void (*free_volume)(struct fscache_volume *volume);
};
extern struct workqueue_struct *fscache_wq;
@@ -65,6 +71,7 @@ extern int fscache_add_cache(struct fscache_cache *cache,
const struct fscache_cache_ops *ops,
void *cache_priv);
extern void fscache_withdraw_cache(struct fscache_cache *cache);
+extern void fscache_withdraw_volume(struct fscache_volume *volume);
extern void fscache_end_volume_access(struct fscache_volume *volume,
struct fscache_cookie *cookie,