Hi Chao Yu,

> 
>--------- Original Message ---------
>Sender : Chao Yu <c...@kernel.org>
>Date : 2024-08-15 12:33 (GMT+9)
>Title : Re: [PATCH] f2fs-tools: add write hint support
> 
>On 2024/8/9 15:32, Daejun Park wrote:
>> This patch enables support for write hints by segment type.
>
>What about adding an option to enable this functionality? otherwise,
>for a device which doesn't support whint feature, it will cause
>overhead whenever calling fcntl() syscall.

I will add option for this functionality.

>
>[snip]
>
>> @@ -1005,7 +1005,7 @@ int get_device_info(int i)
>>  #endif
>> 
>>           if (!c.sparse_mode) {
>> -                if (dev->zoned_model == F2FS_ZONED_HM && c.func == FSCK)
>> +                if (dev->zoned_model == F2FS_ZONED_HM)
>
>Why do we need to change the condtion?

This is to ensure that writes performed by functions other than fsck
are also applied directly to the device.
This patch modifies rw_hint on device fd to pass the write hint to device,
so the write must be synchronous.

>[snip]
>
>> -int dev_write(void *buf, __u64 offset, size_t len)
>> +static int __dev_write(void *buf, __u64 offset, size_t len, enum rw_hint 
>> whint)
>>  {
>> +        bool set_whint = whint != WRITE_LIFE_NONE;
>> +        u64 hint = whint;
>>           int fd;
>> 
>> +        fd = __get_device_fd(&offset);
>> +        if (fd < 0)
>> +                return fd;
>> +
>> +        if (lseek(fd, (off_t)offset, SEEK_SET) < 0)
>> +                return -1;
>> +
>> +        if (set_whint)
>> +                fcntl(fd, F_SET_RW_HINT, &hint);
>
>What about keeping last hint in fd, and update it once new hint is
>not same to old one?

OK, I will change it.

Thanks,
Daejun

>
>Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to