Re: [PATCH] ocfs2: embed actual values into ocfs2_sysfile_lock_key names

From: Tetsuo Handa
Date: Mon Jun 23 2025 - 21:18:54 EST


On 2025/06/24 9:38, Heming Zhao wrote:
> Hello,
>
> Just from your code logic, the switch is unnecessary, and converting
> the input parameter into an "unsigned int" type is sufficient.
>
> e.g.: (not test)
>
> unsigned int type = args->fi_sysfile_type;
>
> if (args->fi_sysfile_type != 0)
> lockdep_set_class(&inode->i_rwsem,
> &ocfs2_sysfile_lock_key[type]);

Excuse me, but you missed the point.
Your approach results in showing "type" instead of "args->fi_sysfile_type".

&ocfs2_sysfile_lock_key[type] --> jbd2_handle --> &oi->ip_xattr_sem

The point of this change is to show the actual value instead of variable name.

>> Before:
>>
>> &ocfs2_sysfile_lock_key[args->fi_sysfile_type] --> jbd2_handle --> &oi->ip_xattr_sem
>>
>> After:
>>
>> &ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE] --> jbd2_handle --> &oi->ip_xattr_sem
>>