Re: [PATCH 10/13] filesystems: add set_nlink()

From: Miklos Szeredi
Date: Fri Oct 14 2011 - 11:05:44 EST


Steven Whitehouse <swhiteho@xxxxxxxxxx> writes:

> Hi,
>
> On Wed, 2011-10-12 at 16:49 +0200, Miklos Szeredi wrote:
>> From: Miklos Szeredi <mszeredi@xxxxxxx>
>>
>> Replace remaining direct i_nlink updates with a new set_nlink()
>> updater function.
>>
>> Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
>> ---
> [snip]
>
>
>
>> diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
>> index da21eca..102cf5e 100644
>> --- a/fs/gfs2/glops.c
>> +++ b/fs/gfs2/glops.c
>> @@ -277,7 +277,7 @@ static void gfs2_set_nlink(struct inode *inode, u32 nlink)
>> if (nlink == 0)
>> clear_nlink(inode);
>> else
>> - inode->i_nlink = nlink;
>> + set_nlink(inode, nlink);
>> }
>> }
>
> So long as it is ok to call set_nlink() with nlink == 0, then the if
> statement here can be removed and just replaced with set_nlink()

Current patchset will WARN if set_nlink() is called with nlink == 0. I
think it's cleaner to keep the two cases separate.

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/