f2fs: assign the write hint per stream by default
Subsystems (2)
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: assign the write hint per stream by default
This reverts commit 930e2607638d ("f2fs: remove obsolete whint_mode"), as we decide to pass write hints to the disk.
--- Documentation/filesystems/f2fs.rst | 29 +++++++++++++++ fs/f2fs/data.c | 2 + fs/f2fs/f2fs.h | 2 + fs/f2fs/segment.c | 59 ++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+)
Documentation/filesystems/f2fs.rst +29 -0
@@ -774,6 +774,35 @@ In order to identify whether the data in the victim segment are valid or not, F2FS manages a bitmap. Each bit represents the validity of a block, and the bitmap is composed of a bit stream covering whole blocks in main area. +Write-hint Policy +----------------- + +F2FS sets the whint all the time with the below policy. + +===================== ======================== =================== +User F2FS Block +===================== ======================== =================== +N/A META WRITE_LIFE_NONE|REQ_META +N/A HOT_NODE WRITE_LIFE_NONE +N/A WARM_NODE WRITE_LIFE_MEDIUM +N/A COLD_NODE WRITE_LIFE_LONG +ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME +extension list " " + +-- buffered io +N/A COLD_DATA WRITE_LIFE_EXTREME +N/A HOT_DATA WRITE_LIFE_SHORT +N/A WARM_DATA WRITE_LIFE_NOT_SET + +-- direct io +WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME +WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_SHORT +WRITE_LIFE_NOT_SET WARM_DATA WRITE_LIFE_NOT_SET +WRITE_LIFE_NONE " WRITE_LIFE_NONE +WRITE_LIFE_MEDIUM " WRITE_LIFE_MEDIUM +WRITE_LIFE_LONG " WRITE_LIFE_LONG +===================== ======================== =================== + Fallocate(2) Policy -------------------
fs/f2fs/data.c +2 -0
@@ -465,6 +465,8 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) }else { bio->bi_end_io = f2fs_write_end_io; bio->bi_private = sbi; + bio->bi_write_hint =f2fs_io_type_to_rw_hint (sbi, + fio->type, fio->temp); }iostat_alloc_and_bind_ctx (sbi, bio,NULL );
fs/f2fs/f2fs.h +2 -0
@@ -3745,6 +3745,8 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);int __init f2fs_create_segment_manager_caches (void );void f2fs_destroy_segment_manager_caches (void );int f2fs_rw_hint_to_seg_type (enum rw_hint hint); +enum rw_hint f2fs_io_type_to_rw_hint (struct f2fs_sb_info *sbi, +enum page_type type,enum temp_type temp);unsigned int f2fs_usable_segs_in_sec (struct f2fs_sb_info *sbi,unsigned int segno); unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
fs/f2fs/segment.c +59 -0
65 lines not on this page · raw message
Signature · 1 line
2.44.0.683.g7961c838ac-goog
Chao Yu
maintainerQuoted 16 lines · Jaegeuk Kim
This reverts commit
930e2607638d("f2fs: remove obsoletewhint_mode"), as we decide to pass write hints to the disk.Signed-off-by Jaegeuk Kim <[email protected]>--- Documentation/filesystems/f2fs.rst | 29 +++++++++++++++ fs/f2fs/data.c | 2 + fs/f2fs/f2fs.h | 2 + fs/f2fs/segment.c | 59 ++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+)Documentation/filesystems/f2fs.rst +0
-0
Documentation/filesystems/f2fs.rst In order to identify whether the data in the victim segment are valid or not, · line 780
Quoted 7 lines
Documentation/filesystems/f2fs.rst +4
-0@@ -774,6 +774,35 @@ In order to identify whether the data in the victim segment are valid or not, F2FS manages a bitmap. Each bit represents the validity of a block, and the bitmap is composed of a bit stream covering whole blocks in main area. +Write-hint Policy +----------------- + +F2FS sets the whint all the time with the below policy.
No user-based mode?
Thanks,
Quoted 124 lines
Documentation/filesystems/f2fs.rst +25
-0+ +===================== ======================== =================== +User F2FS Block +===================== ======================== =================== +N/A META WRITE_LIFE_NONE|REQ_META +N/A HOT_NODE WRITE_LIFE_NONE +N/A WARM_NODE WRITE_LIFE_MEDIUM +N/A COLD_NODE WRITE_LIFE_LONG +ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME +extension list " " + +-- buffered io +N/A COLD_DATA WRITE_LIFE_EXTREME +N/A HOT_DATA WRITE_LIFE_SHORT +N/A WARM_DATA WRITE_LIFE_NOT_SET + +-- direct io +WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME +WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_SHORT +WRITE_LIFE_NOT_SET WARM_DATA WRITE_LIFE_NOT_SET +WRITE_LIFE_NONE " WRITE_LIFE_NONE +WRITE_LIFE_MEDIUM " WRITE_LIFE_MEDIUM +WRITE_LIFE_LONG " WRITE_LIFE_LONG +===================== ======================== =================== + Fallocate(2) Policy -------------------fs/f2fs/data.c +2
-0@@ -465,6 +465,8 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) }else { bio->bi_end_io = f2fs_write_end_io; bio->bi_private = sbi; + bio->bi_write_hint =f2fs_io_type_to_rw_hint (sbi, + fio->type, fio->temp); }iostat_alloc_and_bind_ctx (sbi, bio,NULL );fs/f2fs/f2fs.h +2
-0@@ -3745,6 +3745,8 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);int __init f2fs_create_segment_manager_caches (void );void f2fs_destroy_segment_manager_caches (void );int f2fs_rw_hint_to_seg_type (enum rw_hint hint); +enum rw_hint f2fs_io_type_to_rw_hint (struct f2fs_sb_info *sbi, +enum page_type type,enum temp_type temp);unsigned int f2fs_usable_segs_in_sec (struct f2fs_sb_info *sbi,unsigned int segno); unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,fs/f2fs/segment.c +59
-0@@ -3364,6 +3364,65 @@ int f2fs_rw_hint_to_seg_type(enum rw_hint hint) } } +/* +* This returns write hints for each segment type. This hints will be +* passed down to block layer as below by default. +* +* User F2FS Block +* ---- ---- ----- +* META WRITE_LIFE_NONE|REQ_META +* HOT_NODE WRITE_LIFE_NONE +* WARM_NODE WRITE_LIFE_MEDIUM +* COLD_NODE WRITE_LIFE_LONG +* ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME +* extension list " " +* +* -- buffered io +* COLD_DATA WRITE_LIFE_EXTREME +* HOT_DATA WRITE_LIFE_SHORT +* WARM_DATA WRITE_LIFE_NOT_SET +* +* -- direct io +* WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME +* WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_SHORT +* WRITE_LIFE_NOT_SET WARM_DATA WRITE_LIFE_NOT_SET +* WRITE_LIFE_NONE " WRITE_LIFE_NONE +* WRITE_LIFE_MEDIUM " WRITE_LIFE_MEDIUM +* WRITE_LIFE_LONG " WRITE_LIFE_LONG +*/ +enum rw_hint f2fs_io_type_to_rw_hint (struct f2fs_sb_info *sbi, +enum page_type type,enum temp_type temp) +{ +switch (type) { +case DATA : +switch (temp) { +case WARM : +return WRITE_LIFE_NOT_SET ; +case HOT : +return WRITE_LIFE_SHORT ; +case COLD : +return WRITE_LIFE_EXTREME ; +default : +return WRITE_LIFE_NONE ; + } +case NODE : +switch (temp) { +case WARM : +return WRITE_LIFE_MEDIUM ; +case HOT : +return WRITE_LIFE_NONE ; +case COLD : +return WRITE_LIFE_LONG ; +default : +return WRITE_LIFE_NONE ; + } +case META : +return WRITE_LIFE_NONE ; +default : +return WRITE_LIFE_NONE ; + } +} +static int __get_segment_type_2 (struct f2fs_io_info *fio) {if (fio->type ==DATA )
Jaegeuk Kim
maintainerQuoted 12 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
This reverts commit
930e2607638d("f2fs: remove obsoletewhint_mode"), as we decide to pass write hints to the disk.Signed-off-by Jaegeuk Kim <[email protected]>--- Documentation/filesystems/f2fs.rst | 29 +++++++++++++++ fs/f2fs/data.c | 2 + fs/f2fs/f2fs.h | 2 + fs/f2fs/segment.c | 59 ++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+)
Quoted 13 lines
Documentation/filesystems/f2fs.rst In order to identify whether the data in the victim segment are valid or not, · line 779
Quoted 11 lines
Documentation/filesystems/f2fs.rst +4
-0@@ -774,6 +774,35 @@ In order to identify whether the data in the victim segment are valid or not, F2FS manages a bitmap. Each bit represents the validity of a block, and the bitmap is composed of a bit stream covering whole blocks in main area. +Write-hint Policy +----------------- + +F2FS sets the whint all the time with the below policy.No user-based mode?
Not anymore, as there's no user.
Quoted 124 lines
Thanks,
Quoted 121 lines
Documentation/filesystems/f2fs.rst +25
-0+ +===================== ======================== =================== +User F2FS Block +===================== ======================== =================== +N/A META WRITE_LIFE_NONE|REQ_META +N/A HOT_NODE WRITE_LIFE_NONE +N/A WARM_NODE WRITE_LIFE_MEDIUM +N/A COLD_NODE WRITE_LIFE_LONG +ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME +extension list " " + +-- buffered io +N/A COLD_DATA WRITE_LIFE_EXTREME +N/A HOT_DATA WRITE_LIFE_SHORT +N/A WARM_DATA WRITE_LIFE_NOT_SET + +-- direct io +WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME +WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_SHORT +WRITE_LIFE_NOT_SET WARM_DATA WRITE_LIFE_NOT_SET +WRITE_LIFE_NONE " WRITE_LIFE_NONE +WRITE_LIFE_MEDIUM " WRITE_LIFE_MEDIUM +WRITE_LIFE_LONG " WRITE_LIFE_LONG +===================== ======================== =================== + Fallocate(2) Policy -------------------fs/f2fs/data.c +2
-0@@ -465,6 +465,8 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) }else { bio->bi_end_io = f2fs_write_end_io; bio->bi_private = sbi; + bio->bi_write_hint =f2fs_io_type_to_rw_hint (sbi, + fio->type, fio->temp); }iostat_alloc_and_bind_ctx (sbi, bio,NULL );fs/f2fs/f2fs.h +2
-0@@ -3745,6 +3745,8 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);int __init f2fs_create_segment_manager_caches (void );void f2fs_destroy_segment_manager_caches (void );int f2fs_rw_hint_to_seg_type (enum rw_hint hint); +enum rw_hint f2fs_io_type_to_rw_hint (struct f2fs_sb_info *sbi, +enum page_type type,enum temp_type temp);unsigned int f2fs_usable_segs_in_sec (struct f2fs_sb_info *sbi,unsigned int segno); unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,fs/f2fs/segment.c +59
-0@@ -3364,6 +3364,65 @@ int f2fs_rw_hint_to_seg_type(enum rw_hint hint) } } +/* +* This returns write hints for each segment type. This hints will be +* passed down to block layer as below by default. +* +* User F2FS Block +* ---- ---- ----- +* META WRITE_LIFE_NONE|REQ_META +* HOT_NODE WRITE_LIFE_NONE +* WARM_NODE WRITE_LIFE_MEDIUM +* COLD_NODE WRITE_LIFE_LONG +* ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME +* extension list " " +* +* -- buffered io +* COLD_DATA WRITE_LIFE_EXTREME +* HOT_DATA WRITE_LIFE_SHORT +* WARM_DATA WRITE_LIFE_NOT_SET +* +* -- direct io +* WRITE_LIFE_EXTREME COLD_DATA WRITE_LIFE_EXTREME +* WRITE_LIFE_SHORT HOT_DATA WRITE_LIFE_SHORT +* WRITE_LIFE_NOT_SET WARM_DATA WRITE_LIFE_NOT_SET +* WRITE_LIFE_NONE " WRITE_LIFE_NONE +* WRITE_LIFE_MEDIUM " WRITE_LIFE_MEDIUM +* WRITE_LIFE_LONG " WRITE_LIFE_LONG +*/ +enum rw_hint f2fs_io_type_to_rw_hint (struct f2fs_sb_info *sbi, +enum page_type type,enum temp_type temp) +{ +switch (type) { +case DATA : +switch (temp) { +case WARM : +return WRITE_LIFE_NOT_SET ; +case HOT : +return WRITE_LIFE_SHORT ; +case COLD : +return WRITE_LIFE_EXTREME ; +default : +return WRITE_LIFE_NONE ; + } +case NODE : +switch (temp) { +case WARM : +return WRITE_LIFE_MEDIUM ; +case HOT : +return WRITE_LIFE_NONE ; +case COLD : +return WRITE_LIFE_LONG ; +default : +return WRITE_LIFE_NONE ; + } +case META : +return WRITE_LIFE_NONE ; +default : +return WRITE_LIFE_NONE ; + } +} +static int __get_segment_type_2 (struct f2fs_io_info *fio) {if (fio->type ==DATA )