raid5: enable log for raid array with cache disk
authorShaohua Li <shli@fb.com>
Thu, 13 Aug 2015 21:32:04 +0000 (14:32 -0700)
committerNeilBrown <neilb@suse.com>
Sun, 1 Nov 2015 02:48:26 +0000 (13:48 +1100)
Now log is safe to enable for raid array with cache disk

Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
drivers/md/raid5.c
include/uapi/linux/raid/md_p.h

index 122702d957a62d7cfb008984c61fb2f0395889c4..b0bf81d084fd88108d53c845a6372aef5b6da696 100644 (file)
@@ -6329,8 +6329,11 @@ static void raid5_free_percpu(struct r5conf *conf)
 
 static void free_conf(struct r5conf *conf)
 {
+       if (conf->log)
+               r5l_exit_log(conf->log);
        if (conf->shrinker.seeks)
                unregister_shrinker(&conf->shrinker);
+
        free_thread_groups(conf);
        shrink_stripes(conf);
        raid5_free_percpu(conf);
@@ -6996,6 +6999,14 @@ static int run(struct mddev *mddev)
                                                mddev->queue);
        }
 
+       if (journal_dev) {
+               char b[BDEVNAME_SIZE];
+
+               printk(KERN_INFO"md/raid:%s: using device %s as journal\n",
+                      mdname(mddev), bdevname(journal_dev->bdev, b));
+               r5l_init_log(conf, journal_dev);
+       }
+
        return 0;
 abort:
        md_unregister_thread(&mddev->thread);
index 96e4196f9c79b4952557179040f625c666d7529c..c3e654c6d51852bc64c1b534b3338dd4f291efce 100644 (file)
@@ -322,6 +322,7 @@ struct mdp_superblock_1 {
                                        |MD_FEATURE_NEW_OFFSET          \
                                        |MD_FEATURE_RECOVERY_BITMAP     \
                                        |MD_FEATURE_CLUSTERED           \
+                                       |MD_FEATURE_JOURNAL             \
                                        )
 
 struct r5l_payload_header {