Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbbLOFgF (ORCPT ); Tue, 15 Dec 2015 00:36:05 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:55784 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751248AbbLOFgD (ORCPT ); Tue, 15 Dec 2015 00:36:03 -0500 X-AuditID: cbfee61a-f79266d000003652-13-566fa6c12f1b From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 7/8] f2fs: introduce new option for controlling data flush Date: Tue, 15 Dec 2015 13:35:21 +0800 Message-id: <00fa01d136fa$7c028980$74079c80$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdE29ksVqGQSDimRScOXb1tT5q8Pqw== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jQd1Dy/LDDG5+YbN4sn4Ws8WlRe4W l3fNYXNg9ti0qpPNY/eCz0wenzfJBTBHcdmkpOZklqUW6dslcGUcutfBWnBJsmLRvs9sDYxH RLoYOTkkBEwkTjy7zQhhi0lcuLeerYuRi0NIYBajxNXLm1kgnFeMEvsPbmcFqWITUJFY3vGf CcQWAbIPLbrMDmIzC3hINHZ8B6sRFvCSuHTiHNhUFgFViStLloLFeQUsJX7OWM8IYQtK/Jh8 jwWiV0ti/c7jTBC2vMTmNW+ZIS5SkNhx9jUjxC49iQOHFrNB1IhLbDxyi2UCI9CZCKNmIRk1 C8moWUhaFjCyrGKUSC1ILihOSs81zEst1ytOzC0uzUvXS87P3cQIDuNnUjsYD+5yP8QowMGo xMO7gDk/TIg1say4MvcQowQHs5II74JeoBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe2kuRYUIC 6YklqdmpqQWpRTBZJg5OqQbGWp9/WU1LLldc6Ztqe0vLzc94oqnEsS/VC5Za/v37coGLSR3j pVXGmy4YHghSkwt/z/x0SqDrkjVFx5M4xAL7Cq9Z/z13YoP0/vXla6ytNumvZbTt2XRKfeOF 5KNTu6/NEji1Oiv5ql1NE+eNuaH7m+75CIZycKayT3/8xanhi6T2WZndJ2fvVmIpzkg01GIu Kk4EAMNIs1NfAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3435 Lines: 97 Add a new option 'data_flush' to enable/disable data flush functionality in checkpoint. Signed-off-by: Chao Yu --- Documentation/filesystems/f2fs.txt | 2 ++ fs/f2fs/checkpoint.c | 2 +- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt index 8088bd9..727373e 100644 --- a/Documentation/filesystems/f2fs.txt +++ b/Documentation/filesystems/f2fs.txt @@ -151,6 +151,8 @@ noextent_cache Disable an extent cache based on rb-tree explicitly, see the above extent_cache mount option. noinline_data Disable the inline data feature, inline data feature is enabled by default. +data_flush Enable data flushing during checkpoint in order to + persist data of regular and symlink. ================================================================================ DEBUGFS ENTRIES diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index a73909c..2fdf271 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -855,7 +855,7 @@ static int block_operations(struct f2fs_sb_info *sbi) retry_flush_datas: /* write all the dirty data pages */ - if (get_pages(sbi, F2FS_DIRTY_DATAS)) { + if (test_opt(sbi, DATA_FLUSH) && get_pages(sbi, F2FS_DIRTY_DATAS)) { sync_dirty_inodes(sbi, FILE_INODE); if (unlikely(f2fs_cp_error(sbi))) { err = -EIO; diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 4d44732..ee1f0a8 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -54,6 +54,7 @@ #define F2FS_MOUNT_FASTBOOT 0x00001000 #define F2FS_MOUNT_EXTENT_CACHE 0x00002000 #define F2FS_MOUNT_FORCE_FG_GC 0x00004000 +#define F2FS_MOUNT_DATA_FLUSH 0x00008000 #define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) #define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 051bce6..694e092 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -67,6 +67,7 @@ enum { Opt_extent_cache, Opt_noextent_cache, Opt_noinline_data, + Opt_data_flush, Opt_nodiscard, Opt_err, }; @@ -92,6 +93,7 @@ static match_table_t f2fs_tokens = { {Opt_extent_cache, "extent_cache"}, {Opt_noextent_cache, "noextent_cache"}, {Opt_noinline_data, "noinline_data"}, + {Opt_data_flush, "data_flush"}, {Opt_nodiscard, "nodiscard"}, {Opt_err, NULL}, }; @@ -411,6 +413,9 @@ static int parse_options(struct super_block *sb, char *options) case Opt_noinline_data: clear_opt(sbi, INLINE_DATA); break; + case Opt_data_flush: + clear_opt(sbi, DATA_FLUSH); + break; default: f2fs_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" or missing value", @@ -694,6 +699,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) seq_puts(seq, ",extent_cache"); else seq_puts(seq, ",noextent_cache"); + if (test_opt(sbi, DATA_FLUSH)) + seq_puts(seq, ",data_flush"); seq_printf(seq, ",active_logs=%u", sbi->active_logs); return 0; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/