[Ocfs2-devel] [PATCH 1/3] Ocfs2: Using macro to set/clear *FILLED* flags in info handler.
Tristan Ye
tristan.ye at oracle.com
Mon Jan 31 23:48:41 PST 2011
Mark Fasheh wrote:
> On Sun, Jan 30, 2011 at 02:25:59PM +0800, Tristan Ye wrote:
>> It's a best-effort attempt to simplize duplicated codes here.
>
> Nice cleanup. I have only one issue with it:
>
>
>> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
>> ---
>> fs/ocfs2/ioctl.c | 38 ++++++++++++++++++++++++++++++--------
>> 1 files changed, 30 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
>> index 7a48681..731cf46 100644
>> --- a/fs/ocfs2/ioctl.c
>> +++ b/fs/ocfs2/ioctl.c
>> @@ -46,6 +46,22 @@ static inline void __o2info_set_request_error(struct ocfs2_info_request *kreq,
>> #define o2info_set_request_error(a, b) \
>> __o2info_set_request_error((struct ocfs2_info_request *)&(a), b)
>>
>> +static inline void __o2info_set_request_filled(struct ocfs2_info_request *req)
>> +{
>> + req->ir_flags |= OCFS2_INFO_FL_FILLED;
>> +}
>> +
>> +#define o2info_set_request_filled(a) \
>> + __o2info_set_request_filled((struct ocfs2_info_request *)&(a))
>
> The macro here (and below) casts it's argument, thus defeating any
> typechecking we would have gotten from the function call. Can you
> pleaseremove the macro, rename the functions (take out the __) and use them
> directly? I know we might then want to deref the i*_req field in the
> handlers below but I don't think that's a big deal for what we gain.
Hi Mark,
The reason why I used a macro is to make the life of caller as easy
as taking the
specific info object(like ocfs2_info_blocksize, or
ocfs2_info_clustersize etc) directly,
just for the sake of making the codes look more neat.
That's not a big deal to use a direct inline func, while need caller
bother to cast
the info type;-)
Tristan.
> --Mark
>
>
> --
> Mark Fasheh
More information about the Ocfs2-devel
mailing list