Re: [PATCH 09/27] ext4: move out inode_lock into ext4_fallocate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/12/4 20:05, Jan Kara wrote:
> On Tue 22-10-24 19:10:40, Zhang Yi wrote:
>> From: Zhang Yi <yi.zhang@xxxxxxxxxx>
>>
>> Currently, all five sub-functions of ext4_fallocate() acquire the
>> inode's i_rwsem at the beginning and release it before exiting. This
>> process can be simplified by factoring out the management of i_rwsem
>> into the ext4_fallocate() function.
>>
>> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
> 
> Ah, nice. Feel free to add:
> 
> Reviewed-by: Jan Kara <jack@xxxxxxx>
> 
> and please ignore my comments about renaming 'out' labels :).
> 
> 								Honza
> 

...

>> @@ -4774,9 +4765,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>>  
>>  	inode_lock(inode);
>>  	ret = ext4_convert_inline_data(inode);
>> -	inode_unlock(inode);
>>  	if (ret)
>> -		return ret;
>> +		goto out;
>>  
>>  	if (mode & FALLOC_FL_PUNCH_HOLE)
>>  		ret = ext4_punch_hole(file, offset, len);
>> @@ -4788,7 +4778,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>>  		ret = ext4_zero_range(file, offset, len, mode);
>>  	else
>>  		ret = ext4_do_fallocate(file, offset, len, mode);
>> -
>> +out:
>> +	inode_unlock(inode);
>>  	return ret;
>>  }
>>  

I guess you may want to suggest rename this out to out_inode_lock as well.

Thanks,
Yi.






[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux