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.

[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?

[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?

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