diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-04-27 14:21:33 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-05-07 10:21:57 +0900 |
commit | 2163d19815b3dfdb243cee2de2478ae7efce1942 (patch) | |
tree | 43272bf3bc723edc42205898e2c6955d8d87f343 /fs/f2fs/super.c | |
parent | a688b9d9e5cbec76edab74e724297b5488c07829 (diff) | |
download | blackbird-op-linux-2163d19815b3dfdb243cee2de2478ae7efce1942.tar.gz blackbird-op-linux-2163d19815b3dfdb243cee2de2478ae7efce1942.zip |
f2fs: introduce help function {create,destroy}_flush_cmd_control
Introduce help function {create,destroy}_flush_cmd_control to clean up
the create/destory flush merge operation.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a7ed92e2948a..b2b18637cb9e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -641,33 +641,12 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) * or if flush_merge is not passed in mount option. */ if ((*flags & MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { - struct flush_cmd_control *fcc = - sbi->sm_info->cmd_control_info; - - if (fcc && fcc->f2fs_issue_flush) - kthread_stop(fcc->f2fs_issue_flush); - kfree(fcc); - sbi->sm_info->cmd_control_info = NULL; + destroy_flush_cmd_control(sbi); } else if (test_opt(sbi, FLUSH_MERGE) && !sbi->sm_info->cmd_control_info) { - dev_t dev = sbi->sb->s_bdev->bd_dev; - struct flush_cmd_control *fcc = - kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL); - - if (!fcc) { - err = -ENOMEM; - goto restore_gc; - } - spin_lock_init(&fcc->issue_lock); - init_waitqueue_head(&fcc->flush_wait_queue); - fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, - "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); - if (IS_ERR(fcc->f2fs_issue_flush)) { - err = PTR_ERR(fcc->f2fs_issue_flush); - kfree(fcc); + err = create_flush_cmd_control(sbi); + if (err) goto restore_gc; - } - sbi->sm_info->cmd_control_info = fcc; } skip: /* Update the POSIXACL Flag */ |