f2fs: issue discard commands proactively in high fs utilization
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: issue discard commands proactively in high fs utilization
In the high utilization like over 80%, we don't expect huge # of large discard commands, but do many small pending discards which affects FTL GCs a lot. Let's issue them in that case.
--- fs/f2fs/f2fs.h | 3 +- fs/f2fs/segment.c | 71 ++++++++++++++++++++++++++--------------------- 2 files changed, 40 insertions(+), 34 deletions(-)
fs/f2fs/f2fs.h +1 -2
@@ -186,6 +186,7 @@ enum {#define DEF_MAX_DISCARD_LEN 512/* Max. 2MB per discard */ #define DEF_MIN_DISCARD_ISSUE_TIME 50/* 50 ms, if exists */ #define DEF_MAX_DISCARD_ISSUE_TIME 60000/* 60 s, if no candidates */ +#define DEF_DISCARD_URGENT_UTIL 80/* do more discard over 80% */ #define DEF_CP_INTERVAL 60/* 60 secs */ #define DEF_IDLE_INTERVAL 5/* 5 secs */
@@ -2777,8 +2778,6 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi);void destroy_flush_cmd_control (struct f2fs_sb_info *sbi,bool free);void invalidate_blocks (struct f2fs_sb_info *sbi,block_t addr);bool is_checkpointed_data (struct f2fs_sb_info *sbi,block_t blkaddr); -void init_discard_policy (struct discard_policy *dpolicy,int discard_type, -unsigned int granularity);void drop_discard_cmd (struct f2fs_sb_info *sbi);void stop_discard_thread (struct f2fs_sb_info *sbi);bool f2fs_wait_discard_bios (struct f2fs_sb_info *sbi);
fs/f2fs/segment.c +39 -32
114 lines not on this page · raw message
Signature · 1 line
2.17.0.441.gb46fe60e1d-goog
Quoted 5 lines · Jaegeuk Kim
In the high utilization like over 80%, we don't expect huge # of large discard commands, but do many small pending discards which affects FTL GCs a lot. Let's issue them in that case.
Signed-off-by Jaegeuk Kim <[email protected]>
Thanks,
fs/f2fs/segment.c static void __check_sit_bitmap(struct f2fs_sb_info *sbi, · line 915
Quoted 13 lines · Jaegeuk Kim
In the high utilization like over 80%, we don't expect huge # of large discard commands, but do many small pending discards which affects FTL GCs a lot. Let's issue them in that case.
Signed-off-by Jaegeuk Kim <[email protected]>---
fs/f2fs/segment.c +1
-0@@ -915,6 +915,38 @@ static void __check_sit_bitmap(struct f2fs_sb_info *sbi, + dpolicy->max_interval =DEF_MIN_DISCARD_ISSUE_TIME ;
Isn't this way too aggressive?
Discard thread will wake up on 50ms interval just because the user has used 80% of space.
60,000ms vs 50ms is too much of a stark difference.
I feel something like 10 seconds(10,000ms) could be a much more reasonable choice than this.
Thanks.
Quoted 17 lines · Ju Hyung Park
fs/f2fs/segment.c static void __check_sit_bitmap(struct f2fs_sb_info *sbi, · line 915
Quoted 13 lines · Jaegeuk Kim
In the high utilization like over 80%, we don't expect huge # of large discard commands, but do many small pending discards which affects FTL GCs a lot. Let's issue them in that case.
Signed-off-by Jaegeuk Kim <[email protected]>---
fs/f2fs/segment.c +1
-0@@ -915,6 +915,38 @@ static void __check_sit_bitmap(struct f2fs_sb_info *sbi, + dpolicy->max_interval =DEF_MIN_DISCARD_ISSUE_TIME ;Isn't this way too aggressive?
Quoted 6 lines
Discard thread will wake up on 50ms interval just because the user has used 80% of space.
60,000ms vs 50ms is too much of a stark difference.I feel something like 10
seconds(10,000ms)could be a much more reasonable choice than this.
Hmm.. I agree that current hard code method is not flexible enough, and I proposed below patch last year to adjust interval according to space usage, it looks Jaegeuk partially agreed with that, and pointed out we need to distinguish low/high-end storage to decide interval. And also you point out that btrfs introduces mount option "ssd" to let user give the device type, and we can distinguish with that. :P
But I pended below patch based on Jaegeuk's and your idea due to other work...
Thanks,
Quoted 10 lines
Thanks.
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.