f2fs: run discard jobs when put_super
When we umount f2fs, we need to avoid long delay due to discard commands, which is actually taking tens of seconds, if storage is very slow on UNMAP. So, this patch introduces timeout-based work on it. By default, let me give 5 seconds for discard. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -1048,7 +1048,7 @@ static void f2fs_put_super(struct super_block *sb)
|
||||
}
|
||||
|
||||
/* be sure to wait for any on-going discard commands */
|
||||
dropped = f2fs_wait_discard_bios(sbi);
|
||||
dropped = f2fs_issue_discard_timeout(sbi);
|
||||
|
||||
if ((f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi)) &&
|
||||
!sbi->discard_blks && !dropped) {
|
||||
@@ -2706,6 +2706,8 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
|
||||
sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL;
|
||||
sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL;
|
||||
sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_INTERVAL;
|
||||
sbi->interval_time[UMOUNT_DISCARD_TIMEOUT] =
|
||||
DEF_UMOUNT_DISCARD_TIMEOUT;
|
||||
clear_sbi_flag(sbi, SBI_NEED_FSCK);
|
||||
|
||||
for (i = 0; i < NR_COUNT_TYPE; i++)
|
||||
|
Reference in New Issue
Block a user