[f2fs-dev] [PATCH 5/7] f2fs: add the flush_merge handle in the remount flow
Add the *remount* handle of flush_merge option, so that the users can enable flush_merge in the runtime, such as the underlying device handles the cache_flush command relatively slowly. Signed-off-by: Gu Zheng guz.f...@cn.fujitsu.com --- fs/f2fs/f2fs.h|1 + fs/f2fs/segment.c |2 +- fs/f2fs/super.c | 45 +++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 90109fa..1130f9c 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1174,6 +1174,7 @@ void destroy_node_manager_caches(void); */ void f2fs_balance_fs(struct f2fs_sb_info *); void f2fs_balance_fs_bg(struct f2fs_sb_info *); +int issue_flush_thread(void *); int f2fs_issue_flush(struct f2fs_sb_info *); void invalidate_blocks(struct f2fs_sb_info *, block_t); void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 6672570..5c30255 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -197,7 +197,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) f2fs_sync_fs(sbi-sb, true); } -static int issue_flush_thread(void *data) +int issue_flush_thread(void *data) { struct f2fs_sb_info *sbi = data; struct f2fs_sm_info *sm_i = SM_I(sbi); diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 5e20d2a..bea642a 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -594,6 +594,8 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) struct f2fs_sb_info *sbi = F2FS_SB(sb); struct f2fs_mount_info org_mount_opt; int err, active_logs; + bool need_restart_gc = false; + bool need_stop_gc = false; sync_filesystem(sb); @@ -611,7 +613,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) /* * Previous and new state of filesystem is RO, -* so no point in checking GC conditions. +* so skip checking GC and FLUSH_MERGE conditions. */ if ((sb-s_flags MS_RDONLY) (*flags MS_RDONLY)) goto skip; @@ -625,18 +627,57 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) if (sbi-gc_thread) { stop_gc_thread(sbi); f2fs_sync_fs(sb, 1); + need_restart_gc = true; } } else if (test_opt(sbi, BG_GC) !sbi-gc_thread) { err = start_gc_thread(sbi); if (err) goto restore_opts; + need_stop_gc = true; + } + + /* +* We stop issue flush thread if FS is mounted as RO +* or if flush_merge is not passed in mount option. +*/ + if ((*flags MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { + struct f2fs_sm_info *sm_info = sbi-sm_info; + + if (sm_info-f2fs_issue_flush) + kthread_stop(sm_info-f2fs_issue_flush); + sm_info-issue_list = sm_info-dispatch_list = NULL; + sm_info-f2fs_issue_flush = NULL; + } else if (test_opt(sbi, FLUSH_MERGE)) { + struct f2fs_sm_info *sm_info = sbi-sm_info; + + if (!sm_info-f2fs_issue_flush) { + dev_t dev = sbi-sb-s_bdev-bd_dev; + + spin_lock_init(sm_info-issue_lock); + init_waitqueue_head(sm_info-flush_wait_queue); + sm_info-f2fs_issue_flush = + kthread_run(issue_flush_thread, sbi, + f2fs_flush-%u:%u, MAJOR(dev), MINOR(dev)); + if (IS_ERR(sm_info-f2fs_issue_flush)) { + err = PTR_ERR(sm_info-f2fs_issue_flush); + sm_info-f2fs_issue_flush = NULL; + goto restore_gc; + } + } } skip: /* Update the POSIXACL Flag */ sb-s_flags = (sb-s_flags ~MS_POSIXACL) | (test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0); return 0; - +restore_gc: + if (need_restart_gc) { + if (start_gc_thread(sbi)) + f2fs_msg(sbi-sb, KERN_WARNING, + background gc thread is stop); + } else if (need_stop_gc) { + stop_gc_thread(sbi); + } restore_opts: sbi-mount_opt = org_mount_opt; sbi-active_logs = active_logs; -- 1.7.7 -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net
[f2fs-dev] [PATCH 6/7] f2fs: introduce struct flush_cmd_control to wrap the, flush_merge fields
Split the flush_merge fields from sm_i, and use the new struct flush_cmd_control to wrap it, so that we can igonre these fileds if flush_merge is disable, and it alse can the structs more neat. Signed-off-by: Gu Zheng guz.f...@cn.fujitsu.com --- fs/f2fs/f2fs.h| 14 +++ fs/f2fs/segment.c | 68 fs/f2fs/super.c | 44 +++-- 3 files changed, 76 insertions(+), 50 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1130f9c..780d7e2 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -323,6 +323,14 @@ struct flush_cmd { int ret; }; +struct flush_cmd_control { + struct task_struct *f2fs_issue_flush; /* flush thread */ + wait_queue_head_t flush_wait_queue; /* waiting queue for wake-up */ + struct flush_cmd *issue_list; /* list for command issue */ + struct flush_cmd *dispatch_list;/* list for command dispatch */ + spinlock_t issue_lock; /* for issue list lock */ +}; + struct f2fs_sm_info { struct sit_info *sit_info; /* whole segment information */ struct free_segmap_info *free_info; /* free segment information */ @@ -353,11 +361,7 @@ struct f2fs_sm_info { unsigned int min_ipu_util; /* in-place-update threshold */ /* for flush command control */ - struct task_struct *f2fs_issue_flush; /* flush thread */ - wait_queue_head_t flush_wait_queue; /* waiting queue for wake-up */ - struct flush_cmd *issue_list; /* list for command issue */ - struct flush_cmd *dispatch_list;/* list for command dispatch */ - spinlock_t issue_lock; /* for issue list lock */ + struct flush_cmd_control *cmd_control_info; }; /* diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 5c30255..2f9ead7 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -200,20 +200,20 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) int issue_flush_thread(void *data) { struct f2fs_sb_info *sbi = data; - struct f2fs_sm_info *sm_i = SM_I(sbi); - wait_queue_head_t *q = sm_i-flush_wait_queue; + struct flush_cmd_control *fcc_i = SM_I(sbi)-cmd_control_info; + wait_queue_head_t *q = fcc_i-flush_wait_queue; repeat: if (kthread_should_stop()) return 0; - spin_lock(sm_i-issue_lock); - if (sm_i-issue_list) { - sm_i-dispatch_list = sm_i-issue_list; - sm_i-issue_list = NULL; + spin_lock(fcc_i-issue_lock); + if (fcc_i-issue_list) { + fcc_i-dispatch_list = fcc_i-issue_list; + fcc_i-issue_list = NULL; } - spin_unlock(sm_i-issue_lock); + spin_unlock(fcc_i-issue_lock); - if (sm_i-dispatch_list) { + if (fcc_i-dispatch_list) { struct bio *bio = bio_alloc(GFP_NOIO, 0); struct flush_cmd *cmd, *next; int ret; @@ -221,22 +221,23 @@ repeat: bio-bi_bdev = sbi-sb-s_bdev; ret = submit_bio_wait(WRITE_FLUSH, bio); - for (cmd = sm_i-dispatch_list; cmd; cmd = next) { + for (cmd = fcc_i-dispatch_list; cmd; cmd = next) { cmd-ret = ret; next = cmd-next; complete(cmd-wait); } bio_put(bio); - sm_i-dispatch_list = NULL; + fcc_i-dispatch_list = NULL; } - wait_event_interruptible(*q, kthread_should_stop() || sm_i-issue_list); + wait_event_interruptible(*q, + kthread_should_stop() || fcc_i-issue_list); goto repeat; } int f2fs_issue_flush(struct f2fs_sb_info *sbi) { - struct f2fs_sm_info *sm_i = SM_I(sbi); + struct flush_cmd_control *fcc_i = SM_I(sbi)-cmd_control_info; struct flush_cmd *cmd; int ret; @@ -246,15 +247,15 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi) cmd = f2fs_kmem_cache_alloc(flush_cmd_slab, GFP_ATOMIC | __GFP_ZERO); init_completion(cmd-wait); - spin_lock(sm_i-issue_lock); - if (sm_i-issue_list) - sm_i-issue_list-next = cmd; + spin_lock(fcc_i-issue_lock); + if (fcc_i-issue_list) + fcc_i-issue_list-next = cmd; else - sm_i-issue_list = cmd; - spin_unlock(sm_i-issue_lock); + fcc_i-issue_list = cmd; + spin_unlock(fcc_i-issue_lock); - if (!sm_i-dispatch_list) - wake_up(sm_i-flush_wait_queue); + if (!fcc_i-dispatch_list) + wake_up(fcc_i-flush_wait_queue); wait_for_completion(cmd-wait); ret = cmd-ret; @@ -1859,12 +1860,22 @@ int build_segment_manager(struct f2fs_sb_info *sbi) sm_info-max_discards = 0; if (test_opt(sbi, FLUSH_MERGE) !f2fs_readonly(sbi-sb)) { -
[f2fs-dev] [PATCH 0/7] f2fs: some fix and cleanup about flush_merge
Gu Zheng (7): f2fs: put the bio when issue_flush completed f2fs: remove the unuseful issue_tail list f2fs: use __GFP_ZERO to avoid appending set-NULL f2fs: enable flush_merge only in f2fs is not read-only f2fs: add the flush_merge handle in the remount flow f2fs: introduce struct flush_cmd_control to wrap the flush_merge fields f2fs: introduce help function {create,destroy}_flush_cmd_control fs/f2fs/f2fs.h| 17 ++--- fs/f2fs/segment.c | 102 +++- fs/f2fs/super.c | 32 ++-- 3 files changed, 107 insertions(+), 44 deletions(-) -- 1.7.7 -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] [PATCH 2/7] f2fs: remove the unuseful issue_tail list
With the issue_list and dispatch_list, we can handle flush_merge already, so remove the useless issue_tail list. Signed-off-by: Gu Zheng guz.f...@cn.fujitsu.com --- fs/f2fs/f2fs.h|1 - fs/f2fs/segment.c |5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2ecac83..90109fa 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -358,7 +358,6 @@ struct f2fs_sm_info { struct flush_cmd *issue_list; /* list for command issue */ struct flush_cmd *dispatch_list;/* list for command dispatch */ spinlock_t issue_lock; /* for issue list lock */ - struct flush_cmd *issue_tail; /* list tail of issue list */ }; /* diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 524b7ed..8a6fe2a 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -209,7 +209,7 @@ repeat: spin_lock(sm_i-issue_lock); if (sm_i-issue_list) { sm_i-dispatch_list = sm_i-issue_list; - sm_i-issue_list = sm_i-issue_tail = NULL; + sm_i-issue_list = NULL; } spin_unlock(sm_i-issue_lock); @@ -250,10 +250,9 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi) spin_lock(sm_i-issue_lock); if (sm_i-issue_list) - sm_i-issue_tail-next = cmd; + sm_i-issue_list-next = cmd; else sm_i-issue_list = cmd; - sm_i-issue_tail = cmd; spin_unlock(sm_i-issue_lock); if (!sm_i-dispatch_list) -- 1.7.7 -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] [SPAM] Re:Cleanroom Wipes,Sontara Wipes,Wypall Wipers
Dear Sir, How are you doing? Need Cleanroom Wipes,Sontara Wipes,Polycellulose Wipers?We are a professional factory of Disposable Wipers in China who has wipers which can replace Kimberly Clark's Wypall ,Dupont's Sontara.They are very popular in your market.If you would like to know more about our products,pls send us your need to i...@spunlace-nonwovens.com directly. For more information,pls browse our website www.wipexnonwoven.com Invitation: ISSA/INTERCLEAN AMSTERDAM Amsterdam RAI Convention Centre, Amsterdam, Netherlands Booth NO.:09.418 ,May 6-9, 2014 Welcome to visit our booth! Regards, Frank WIPEX NONWOVENS CO.,LTD -- Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel