[RFC PATCH 2/5] cachefiles: extract ondemand info field from cachefiles_object

JeffleXu jefflexu at linux.alibaba.com
Sat Oct 8 20:06:31 AEDT 2022



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


More information about the Linux-erofs mailing list