aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-10-31 01:47:03 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-11-04 20:34:15 -0500
commitd5053a34a9cc797b9d5d77574354b5555848c43c (patch)
tree86e6e101b812f6d2500b46bf1cd567aa9c8b33c6 /fs
parentbe138b7b0d4cbfb8a927d9bc333ceffee9908c23 (diff)
f2fs: introduce -o fastboot for reducing booting time only
If a system wants to reduce the booting time as a top priority, now we can use a mount option, -o fastboot. With this option, f2fs conducts a little bit slow write_checkpoint, but it can avoid the node page reads during the next mount time. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/f2fs.h1
-rw-r--r--fs/f2fs/file.c2
-rw-r--r--fs/f2fs/gc.c6
-rw-r--r--fs/f2fs/super.c13
4 files changed, 16 insertions, 6 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 5a9705842f10..d45f3f4d7f93 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -49,6 +49,7 @@
49#define F2FS_MOUNT_INLINE_DENTRY 0x00000200 49#define F2FS_MOUNT_INLINE_DENTRY 0x00000200
50#define F2FS_MOUNT_FLUSH_MERGE 0x00000400 50#define F2FS_MOUNT_FLUSH_MERGE 0x00000400
51#define F2FS_MOUNT_NOBARRIER 0x00000800 51#define F2FS_MOUNT_NOBARRIER 0x00000800
52#define F2FS_MOUNT_FASTBOOT 0x00001000
52 53
53#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 54#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option)
54#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 55#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 832bd91922b8..46311e7b388a 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -130,6 +130,8 @@ static inline bool need_do_checkpoint(struct inode *inode)
130 need_cp = true; 130 need_cp = true;
131 else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi))) 131 else if (F2FS_I(inode)->xattr_ver == cur_cp_version(F2FS_CKPT(sbi)))
132 need_cp = true; 132 need_cp = true;
133 else if (test_opt(sbi, FASTBOOT))
134 need_cp = true;
133 135
134 return need_cp; 136 return need_cp;
135} 137}
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 7151d7de7d95..b197a2f2993a 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -695,9 +695,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi)
695 int gc_type = BG_GC; 695 int gc_type = BG_GC;
696 int nfree = 0; 696 int nfree = 0;
697 int ret = -1; 697 int ret = -1;
698 struct cp_control cpc = { 698 struct cp_control cpc;
699 .reason = CP_SYNC, 699
700 }; 700 cpc.reason = test_opt(sbi, FASTBOOT) ? CP_UMOUNT : CP_SYNC;
701 701
702 INIT_LIST_HEAD(&ilist); 702 INIT_LIST_HEAD(&ilist);
703gc_more: 703gc_more:
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 6c5fc7605109..512ffd8e1624 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -54,6 +54,7 @@ enum {
54 Opt_inline_dentry, 54 Opt_inline_dentry,
55 Opt_flush_merge, 55 Opt_flush_merge,
56 Opt_nobarrier, 56 Opt_nobarrier,
57 Opt_fastboot,
57 Opt_err, 58 Opt_err,
58}; 59};
59 60
@@ -73,6 +74,7 @@ static match_table_t f2fs_tokens = {
73 {Opt_inline_dentry, "inline_dentry"}, 74 {Opt_inline_dentry, "inline_dentry"},
74 {Opt_flush_merge, "flush_merge"}, 75 {Opt_flush_merge, "flush_merge"},
75 {Opt_nobarrier, "nobarrier"}, 76 {Opt_nobarrier, "nobarrier"},
77 {Opt_fastboot, "fastboot"},
76 {Opt_err, NULL}, 78 {Opt_err, NULL},
77}; 79};
78 80
@@ -351,6 +353,9 @@ static int parse_options(struct super_block *sb, char *options)
351 case Opt_nobarrier: 353 case Opt_nobarrier:
352 set_opt(sbi, NOBARRIER); 354 set_opt(sbi, NOBARRIER);
353 break; 355 break;
356 case Opt_fastboot:
357 set_opt(sbi, FASTBOOT);
358 break;
354 default: 359 default:
355 f2fs_msg(sb, KERN_ERR, 360 f2fs_msg(sb, KERN_ERR,
356 "Unrecognized mount option \"%s\" or missing value", 361 "Unrecognized mount option \"%s\" or missing value",
@@ -479,9 +484,9 @@ int f2fs_sync_fs(struct super_block *sb, int sync)
479 trace_f2fs_sync_fs(sb, sync); 484 trace_f2fs_sync_fs(sb, sync);
480 485
481 if (sync) { 486 if (sync) {
482 struct cp_control cpc = { 487 struct cp_control cpc;
483 .reason = CP_SYNC, 488
484 }; 489 cpc.reason = test_opt(sbi, FASTBOOT) ? CP_UMOUNT : CP_SYNC;
485 mutex_lock(&sbi->gc_mutex); 490 mutex_lock(&sbi->gc_mutex);
486 write_checkpoint(sbi, &cpc); 491 write_checkpoint(sbi, &cpc);
487 mutex_unlock(&sbi->gc_mutex); 492 mutex_unlock(&sbi->gc_mutex);
@@ -574,6 +579,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
574 seq_puts(seq, ",flush_merge"); 579 seq_puts(seq, ",flush_merge");
575 if (test_opt(sbi, NOBARRIER)) 580 if (test_opt(sbi, NOBARRIER))
576 seq_puts(seq, ",nobarrier"); 581 seq_puts(seq, ",nobarrier");
582 if (test_opt(sbi, FASTBOOT))
583 seq_puts(seq, ",fastboot");
577 seq_printf(seq, ",active_logs=%u", sbi->active_logs); 584 seq_printf(seq, ",active_logs=%u", sbi->active_logs);
578 585
579 return 0; 586 return 0;