aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/interface.c
diff options
context:
space:
mode:
authorJia Zhu <[email protected]>2023-11-20 04:14:19 +0000
committerChristian Brauner <[email protected]>2023-11-25 15:03:57 +0000
commit3c5ecfe16e7699011c12c2d44e55437415331fa3 (patch)
tree06bc7ea0480057695b8b0d2fd6b3a94307fcb7f9 /fs/cachefiles/interface.c
parentcachefiles: introduce object ondemand state (diff)
downloadkernel-3c5ecfe16e7699011c12c2d44e55437415331fa3.tar.gz
kernel-3c5ecfe16e7699011c12c2d44e55437415331fa3.zip
cachefiles: extract ondemand info field from cachefiles_object
We'll introduce a @work_struct field for @object in subsequent patches, it will enlarge the size of @object. As the result of that, this commit extracts ondemand info field from @object. Signed-off-by: Jia Zhu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jingbo Xu <[email protected]> Reviewed-by: David Howells <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/cachefiles/interface.c')
-rw-r--r--fs/cachefiles/interface.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index 40052bdb3365..35ba2117a6f6 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -31,6 +31,11 @@ struct cachefiles_object *cachefiles_alloc_object(struct fscache_cookie *cookie)
if (!object)
return NULL;
+ if (cachefiles_ondemand_init_obj_info(object, volume)) {
+ kmem_cache_free(cachefiles_object_jar, object);
+ return NULL;
+ }
+
refcount_set(&object->ref, 1);
spin_lock_init(&object->lock);
@@ -88,7 +93,7 @@ void cachefiles_put_object(struct cachefiles_object *object,
ASSERTCMP(object->file, ==, NULL);
kfree(object->d_name);
-
+ cachefiles_ondemand_deinit_obj_info(object);
cache = object->volume->cache->cache;
fscache_put_cookie(object->cookie, fscache_cookie_put_object);
object->cookie = NULL;