On 2016/12/21 2:03, Jaegeuk Kim wrote:
> On 12/20, Yunlei He wrote:
>> If the range we write cover the whole valid data in the last page,
>> we do not need to read it.
>>
>> Signed-off-by: Yunlei He <[email protected]>
>> ---
>> fs/f2fs/data.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index 9ac2625..303873f 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -1715,6 +1715,9 @@ static int f2fs_write_begin(struct file *file, struct
>> address_space *mapping,
>> if (len == PAGE_SIZE || PageUptodate(page))
>> return 0;
>>
>> + if (!(pos & (PAGE_SIZE - 1)) && (pos + len) >= i_size_read(inode))
>
> I added here:
> zero_user_segment(page, 0, PAGE_SIZE);
Only need to zeroout in range of [len, page_size] in the page.
Thanks,
>
> Otherwise, xfstests/f2fs/001 gives a failure.
>
> Thanks,
>
>> + return 0;
>> +
>> if (blkaddr == NEW_ADDR) {
>> zero_user_segment(page, 0, PAGE_SIZE);
>> SetPageUptodate(page);
>> @@ -1768,7 +1771,7 @@ static int f2fs_write_end(struct file *file,
>> * let generic_perform_write() try to copy data again through copied=0.
>> */
>> if (!PageUptodate(page)) {
>> - if (unlikely(copied != PAGE_SIZE))
>> + if (unlikely(copied != len))
>> copied = 0;
>> else
>> SetPageUptodate(page);
>> --
>> 2.10.1
>>
>>
>> ------------------------------------------------------------------------------
>> Developer Access Program for Intel Xeon Phi Processors
>> Access to Intel Xeon Phi processor-based developer platforms.
>> With one year of Intel Parallel Studio XE.
>> Training and support from Colfax.
>> Order your platform today.http://sdm.link/intel
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
> .
>
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel