Re: [PATCH 2/5] f2fs: force compressed data into warm area

From: Chao Yu
Date: Tue Mar 10 2020 - 23:45:45 EST


On 2020/3/11 0:32, Jaegeuk Kim wrote:
> On 03/10, Chao Yu wrote:
>> Generally, data shows better continuity in warm data area as its
>> default allocation direction is right, in order to enhance
>> sequential read/write performance of compress inode, let's force
>> compress data into warm area.

It looks cold data's allocation direction is right as well, I missed
to notice that previously due to I tested in small-sized image, and
f2fs_tuning_parameters() enables ALLOC_MODE_REUSE, then cold data
allocation always searchs free segment from segno #0, it breaks
continuity of physical blocks.

>
> Not quite sure tho, compressed blocks are logically cold, no?

Correct.

Please ignore this patch. :P

Thanks,

>
>>
>> Signed-off-by: Chao Yu <yuchao0@xxxxxxxxxx>
>> ---
>> fs/f2fs/segment.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>> index 601d67e72c50..ab1bc750712a 100644
>> --- a/fs/f2fs/segment.c
>> +++ b/fs/f2fs/segment.c
>> @@ -3037,9 +3037,10 @@ static int __get_segment_type_6(struct f2fs_io_info *fio)
>> if (fio->type == DATA) {
>> struct inode *inode = fio->page->mapping->host;
>>
>> - if (is_cold_data(fio->page) || file_is_cold(inode) ||
>> - f2fs_compressed_file(inode))
>> + if (is_cold_data(fio->page) || file_is_cold(inode))
>> return CURSEG_COLD_DATA;
>> + if (f2fs_compressed_file(inode))
>> + return CURSEG_WARM_DATA;
>> if (file_is_hot(inode) ||
>> is_inode_flag_set(inode, FI_HOT_DATA) ||
>> f2fs_is_atomic_file(inode) ||
>> --
>> 2.18.0.rc1
> .
>