Skip to content

Commit 9936638

Browse files
author
Jaegeuk Kim
committed
Revert "f2fs: add timeout in f2fs_enable_checkpoint()"
This reverts commit 4bc3477. Let's apply a better approach to flush the only dirty pages committed by user to avoid the delay caused by unncessary incoming ones. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent a5d8b9d commit 9936638

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

fs/f2fs/f2fs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ enum {
311311
#define DEF_CP_INTERVAL 60 /* 60 secs */
312312
#define DEF_IDLE_INTERVAL 5 /* 5 secs */
313313
#define DEF_DISABLE_INTERVAL 5 /* 5 secs */
314-
#define DEF_ENABLE_INTERVAL 16 /* 16 secs */
315314
#define DEF_DISABLE_QUICK_INTERVAL 1 /* 1 secs */
316315
#define DEF_UMOUNT_DISCARD_TIMEOUT 5 /* 5 secs */
317316

@@ -1486,7 +1485,6 @@ enum {
14861485
DISCARD_TIME,
14871486
GC_TIME,
14881487
DISABLE_TIME,
1489-
ENABLE_TIME,
14901488
UMOUNT_DISCARD_TIMEOUT,
14911489
MAX_TIME,
14921490
};

fs/f2fs/super.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,7 +2686,7 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
26862686

26872687
static int f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
26882688
{
2689-
unsigned int nr_pages = get_pages(sbi, F2FS_DIRTY_DATA) / 16;
2689+
int retry = DEFAULT_RETRY_IO_COUNT;
26902690
long long start, writeback, end;
26912691
int ret;
26922692
struct f2fs_lock_context lc;
@@ -2696,22 +2696,16 @@ static int f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
26962696
get_pages(sbi, F2FS_DIRTY_NODES),
26972697
get_pages(sbi, F2FS_DIRTY_DATA));
26982698

2699-
f2fs_update_time(sbi, ENABLE_TIME);
2700-
27012699
start = ktime_get();
27022700

27032701
/* we should flush all the data to keep data consistency */
2704-
while (get_pages(sbi, F2FS_DIRTY_DATA)) {
2705-
writeback_inodes_sb_nr(sbi->sb, nr_pages, WB_REASON_SYNC);
2702+
do {
2703+
sync_inodes_sb(sbi->sb);
27062704
f2fs_io_schedule_timeout(DEFAULT_SCHEDULE_TIMEOUT);
2705+
} while (get_pages(sbi, F2FS_DIRTY_DATA) && retry--);
27072706

2708-
if (f2fs_time_over(sbi, ENABLE_TIME))
2709-
break;
2710-
}
27112707
writeback = ktime_get();
27122708

2713-
sync_inodes_sb(sbi->sb);
2714-
27152709
if (unlikely(get_pages(sbi, F2FS_DIRTY_DATA)))
27162710
f2fs_warn(sbi, "checkpoint=enable has some unwritten data: %lld",
27172711
get_pages(sbi, F2FS_DIRTY_DATA));
@@ -4333,7 +4327,6 @@ static void init_sb_info(struct f2fs_sb_info *sbi)
43334327
sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL;
43344328
sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL;
43354329
sbi->interval_time[DISABLE_TIME] = DEF_DISABLE_INTERVAL;
4336-
sbi->interval_time[ENABLE_TIME] = DEF_ENABLE_INTERVAL;
43374330
sbi->interval_time[UMOUNT_DISCARD_TIMEOUT] =
43384331
DEF_UMOUNT_DISCARD_TIMEOUT;
43394332
clear_sbi_flag(sbi, SBI_NEED_FSCK);

0 commit comments

Comments
 (0)