On 2020/6/15 9:42, Chao Yu wrote:
> Hi Wei Fang,
>
> On 2020/6/13 12:25, Wei Fang wrote:
>> Since offset < new_size, no need to do truncate_pagecache() again
>> with new_size.
>>
>> Signed-off-by: Wei Fang <[email protected]>
>> ---
>>  fs/f2fs/file.c | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 3268f8dd59bb..43544817238b 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -1368,13 +1368,12 @@ static int f2fs_collapse_range(struct inode *inode, 
>> loff_t offset, loff_t len)
>>              return ret;
>>  
>>      /* write out all moved pages, if possible */
>> -    down_write(&F2FS_I(inode)->i_mmap_sem);
>>      filemap_write_and_wait_range(inode->i_mapping, offset, LLONG_MAX);
>> +
>> +    down_write(&F2FS_I(inode)->i_mmap_sem);
> I guess this patch mainly avoids useless page cache truncation, could we get 
> rid of
> lock coverage update here? or we can do it in separated patch if necessary.
OK, I'll remove the lock coverage change in this patch.

Thanks,
Wei

> Thanks,
>
>>      truncate_pagecache(inode, offset);
>>  
>>      new_size = i_size_read(inode) - len;
>> -    truncate_pagecache(inode, new_size);
>> -
>>      ret = f2fs_truncate_blocks(inode, new_size, true);
>>      up_write(&F2FS_I(inode)->i_mmap_sem);
>>      if (!ret)
>>
> .
>




_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to