diff options
author | David Howells <dhowells@redhat.com> | 2021-10-21 08:50:10 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2022-01-07 13:42:35 +0000 |
commit | 07a90e97400c15967c8754fa271ba24d9df71ab5 (patch) | |
tree | d404b7656e01a298cff29b5206135c563989be17 /fs/cachefiles/internal.h | |
parent | 169379eaef933ca98c279257cacb313a02f9984d (diff) | |
download | lwn-07a90e97400c15967c8754fa271ba24d9df71ab5.tar.gz lwn-07a90e97400c15967c8754fa271ba24d9df71ab5.zip |
cachefiles: Implement culling daemon commands
Implement the ability for the userspace daemon to try and cull a file or
directory in the cache. Two daemon commands are implemented:
(1) The "inuse" command. This queries if a file is in use or whether it
can be deleted. It checks the S_KERNEL_FILE flag on the inode
referred to by the specified filename.
(2) The "cull" command. This asks for a file or directory to be removed,
where removal means either unlinking it or moving it to the graveyard
directory for userspace to dismantle.
Changes
=======
ver #2:
- Fix logging of wrong error[1].
- Need to unmark an inode we've moved to the graveyard before unlocking.
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/20211203094950.GA2480@kili/ [1]
Link: https://lore.kernel.org/r/163819643179.215744.13641580295708315695.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/163906945705.143852.8177595531814485350.stgit@warthog.procyon.org.uk/ # v2
Link: https://lore.kernel.org/r/163967155792.1823006.1088936326902550910.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/164021555037.640689.9472627499842585255.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'fs/cachefiles/internal.h')
-rw-r--r-- | fs/cachefiles/internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 7c67a70a3dff..654dbd51b965 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h @@ -189,12 +189,23 @@ extern struct kmem_cache *cachefiles_object_jar; */ extern void cachefiles_unmark_inode_in_use(struct cachefiles_object *object, struct file *file); +extern int cachefiles_bury_object(struct cachefiles_cache *cache, + struct cachefiles_object *object, + struct dentry *dir, + struct dentry *rep, + enum fscache_why_object_killed why); extern struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, struct dentry *dir, const char *name, bool *_is_new); extern void cachefiles_put_directory(struct dentry *dir); +extern int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, + char *filename); + +extern int cachefiles_check_in_use(struct cachefiles_cache *cache, + struct dentry *dir, char *filename); + /* * security.c */ |