diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-04-27 02:21:21 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-05-06 21:21:56 -0400 |
commit | a688b9d9e5cbec76edab74e724297b5488c07829 (patch) | |
tree | 3f9f4542c5c13648c7d96721c0cd65a0e9e8ead7 /fs/f2fs/super.c | |
parent | 6403eb1f646a49cc92f25c08f8716f8870a4a865 (diff) |
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.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 | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index bea642aec0fe..a7ed92e2948a 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c | |||
@@ -641,29 +641,33 @@ 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 f2fs_sm_info *sm_info = sbi->sm_info; | 644 | struct flush_cmd_control *fcc = |
645 | 645 | sbi->sm_info->cmd_control_info; | |
646 | if (sm_info->f2fs_issue_flush) | 646 | |
647 | kthread_stop(sm_info->f2fs_issue_flush); | 647 | if (fcc && fcc->f2fs_issue_flush) |
648 | sm_info->issue_list = sm_info->dispatch_list = NULL; | 648 | kthread_stop(fcc->f2fs_issue_flush); |
649 | sm_info->f2fs_issue_flush = NULL; | 649 | kfree(fcc); |
650 | } else if (test_opt(sbi, FLUSH_MERGE)) { | 650 | sbi->sm_info->cmd_control_info = NULL; |
651 | struct f2fs_sm_info *sm_info = sbi->sm_info; | 651 | } else if (test_opt(sbi, FLUSH_MERGE) && |
652 | 652 | !sbi->sm_info->cmd_control_info) { | |
653 | if (!sm_info->f2fs_issue_flush) { | 653 | dev_t dev = sbi->sb->s_bdev->bd_dev; |
654 | dev_t dev = sbi->sb->s_bdev->bd_dev; | 654 | struct flush_cmd_control *fcc = |
655 | 655 | kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL); | |
656 | spin_lock_init(&sm_info->issue_lock); | 656 | |
657 | init_waitqueue_head(&sm_info->flush_wait_queue); | 657 | if (!fcc) { |
658 | sm_info->f2fs_issue_flush = | 658 | err = -ENOMEM; |
659 | kthread_run(issue_flush_thread, sbi, | 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, | ||
660 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); | 664 | "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev)); |
661 | if (IS_ERR(sm_info->f2fs_issue_flush)) { | 665 | if (IS_ERR(fcc->f2fs_issue_flush)) { |
662 | err = PTR_ERR(sm_info->f2fs_issue_flush); | 666 | err = PTR_ERR(fcc->f2fs_issue_flush); |
663 | sm_info->f2fs_issue_flush = NULL; | 667 | kfree(fcc); |
664 | goto restore_gc; | 668 | goto restore_gc; |
665 | } | ||
666 | } | 669 | } |
670 | sbi->sm_info->cmd_control_info = fcc; | ||
667 | } | 671 | } |
668 | skip: | 672 | skip: |
669 | /* Update the POSIXACL Flag */ | 673 | /* Update the POSIXACL Flag */ |