Re: [RFC PATCH 2/5] cachefiles: extract ondemand info field from cachefiles_object
From: JeffleXu
Date: Sat Oct 08 2022 - 05:06:43 EST
On 8/18/22 9:52 PM, Jia Zhu wrote:
> /*
> * Backing file state.
> */
> @@ -67,8 +73,7 @@ struct cachefiles_object {
> unsigned long flags;
> #define CACHEFILES_OBJECT_USING_TMPFILE 0 /* Have an unlinked tmpfile */
> #ifdef CONFIG_CACHEFILES_ONDEMAND
> - int ondemand_id;
> - enum cachefiles_object_state state;
> + void *private;
> #endif
> };
Personally I would prefer
struct cachefiles_object {
...
#ifdef CONFIG_CACHEFILES_ONDEMAND
struct cachefiles_ondemand_info *private;
#endif
}
and
> @@ -88,6 +93,7 @@ void cachefiles_put_object(struct cachefiles_object
*object,
> ASSERTCMP(object->file, ==, NULL);
>
> kfree(object->d_name);
> + #ifdef CONFIG_CACHEFILES_ONDEMAND
> + kfree(object->private);
> + #endif
>
> cache = object->volume->cache->cache;
> fscache_put_cookie(object->cookie,
so that we can get rid of CACHEFILES_ONDEMAND_OBJINFO() stuff, to make
the code more readable.
--
Thanks,
Jingbo