在 2022/10/8 17:06, JeffleXu 写道:
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.
Hi JingBo. Thanks for your review. I'll revise it in next version.