[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9952336-4648-16be-532a-37fd52d67b27@bytedance.com>
Date: Wed, 29 Mar 2023 11:33:32 +0800
From: Jia Zhu <zhujia.zj@...edance.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-cachefs@...hat.com, linux-erofs@...ts.ozlabs.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Xin Yin <yinxin.x@...edance.com>,
Jingbo Xu <jefflexu@...ux.alibaba.com>
Subject: Re: Re: [PATCH V4 1/5] cachefiles: introduce object ondemand state
Hi David,
Thanks for reviewing.
在 2023/3/28 21:52, David Howells 写道:
> Jia Zhu <zhujia.zj@...edance.com> wrote:
>
>> +enum cachefiles_object_state {
>> + CACHEFILES_ONDEMAND_OBJSTATE_close, /* Anonymous fd closed by daemon or initial state */
>> + CACHEFILES_ONDEMAND_OBJSTATE_open, /* Anonymous fd associated with object is available */
>
> That looks weird. Maybe make them all-lowercase?
I'll revise it in next version.
>
>> @@ -296,6 +302,21 @@ extern void cachefiles_ondemand_clean_object(struct cachefiles_object *object);
>> extern int cachefiles_ondemand_read(struct cachefiles_object *object,
>> loff_t pos, size_t len);
>>
>> +#define CACHEFILES_OBJECT_STATE_FUNCS(_state) \
>> +static inline bool \
>> +cachefiles_ondemand_object_is_##_state(const struct cachefiles_object *object) \
>> +{ \
>> + return object->state == CACHEFILES_ONDEMAND_OBJSTATE_##_state; \
>> +} \
>> + \
>> +static inline void \
>> +cachefiles_ondemand_set_object_##_state(struct cachefiles_object *object) \
>> +{ \
>> + object->state = CACHEFILES_ONDEMAND_OBJSTATE_##_state; \
>> +}
>> +
>> +CACHEFILES_OBJECT_STATE_FUNCS(open);
>> +CACHEFILES_OBJECT_STATE_FUNCS(close);
>
> Or just get rid of the macroisation? If there are only two states, it doesn't
> save you that much and it means that "make TAGS" won't generate refs for those
> functions and grep won't find them.
Actually there is one more state <reopening> will be introduced in
patch3 and 30+ loc for repeated functions will be added if we drop the
macro.
Shall I keep using the macro or replace it?
> David
Powered by blists - more mailing lists