aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/super.c
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2014-04-27 02:21:33 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-05-06 21:21:57 -0400
commit2163d19815b3dfdb243cee2de2478ae7efce1942 (patch)
tree43272bf3bc723edc42205898e2c6955d8d87f343 /fs/f2fs/super.c
parenta688b9d9e5cbec76edab74e724297b5488c07829 (diff)
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.c27
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)
641 * or if flush_merge is not passed in mount option. 641 * or if flush_merge is not passed in mount option.
642 */ 642 */
643 if ((*flags & MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) { 643 if ((*flags & MS_RDONLY) || !test_opt(sbi, FLUSH_MERGE)) {
644 struct flush_cmd_control *fcc = 644 destroy_flush_cmd_control(sbi);
645 sbi->sm_info->cmd_control_info;
646
647 if (fcc && fcc->f2fs_issue_flush)
648 kthread_stop(fcc->f2fs_issue_flush);
649 kfree(fcc);
650 sbi->sm_info->cmd_control_info = NULL;
651 } else if (test_opt(sbi, FLUSH_MERGE) && 645 } else if (test_opt(sbi, FLUSH_MERGE) &&
652 !sbi->sm_info->cmd_control_info) { 646 !sbi->sm_info->cmd_control_info) {
653 dev_t dev = sbi->sb->s_bdev->bd_dev; 647 err = create_flush_cmd_control(sbi);
654 struct flush_cmd_control *fcc = 648 if (err)
655 kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL);
656
657 if (!fcc) {
658 err = -ENOMEM;
659 goto restore_gc;
660 }
661 spin_lock_init(&fcc->issue_lock);
662 init_waitqueue_head(&fcc->flush_wait_queue);
663 fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
664 "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
665 if (IS_ERR(fcc->f2fs_issue_flush)) {
666 err = PTR_ERR(fcc->f2fs_issue_flush);
667 kfree(fcc);
668 goto restore_gc; 649 goto restore_gc;
669 }
670 sbi->sm_info->cmd_control_info = fcc;
671 } 650 }
672skip: 651skip:
673 /* Update the POSIXACL Flag */ 652 /* Update the POSIXACL Flag */