]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MD: add new bit to indicate raid array with journal
authorSong Liu <songliubraving@fb.com>
Fri, 9 Oct 2015 04:54:09 +0000 (21:54 -0700)
committerNeilBrown <neilb@suse.com>
Sun, 1 Nov 2015 02:48:29 +0000 (13:48 +1100)
If a raid array has journal feature bit set, add a new bit to indicate
this. If the array is started without journal disk existing, we know
there is something wrong.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
drivers/md/md.c
drivers/md/md.h

index e4e2731f7660a8de668445266cd4c8e6e7eeb302..bca859a6e3fdeee28788490cb62ddfee030d4f31 100644 (file)
@@ -1667,6 +1667,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
                        set_bit(WriteMostly, &rdev->flags);
                if (le32_to_cpu(sb->feature_map) & MD_FEATURE_REPLACEMENT)
                        set_bit(Replacement, &rdev->flags);
+               if (le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL)
+                       set_bit(MD_HAS_JOURNAL, &mddev->flags);
        } else /* MULTIPATH are always insync */
                set_bit(In_sync, &rdev->flags);
 
@@ -1807,16 +1809,18 @@ retry:
        for (i=0; i<max_dev;i++)
                sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
 
+       if (test_bit(MD_HAS_JOURNAL, &mddev->flags))
+               sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
+
        rdev_for_each(rdev2, mddev) {
                i = rdev2->desc_nr;
                if (test_bit(Faulty, &rdev2->flags))
                        sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_FAULTY);
                else if (test_bit(In_sync, &rdev2->flags))
                        sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
-               else if (test_bit(Journal, &rdev2->flags)) {
+               else if (test_bit(Journal, &rdev2->flags))
                        sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_JOURNAL);
-                       sb->feature_map |= cpu_to_le32(MD_FEATURE_JOURNAL);
-               } else if (rdev2->raid_disk >= 0)
+               else if (rdev2->raid_disk >= 0)
                        sb->dev_roles[i] = cpu_to_le16(rdev2->raid_disk);
                else
                        sb->dev_roles[i] = cpu_to_le16(MD_DISK_ROLE_SPARE);
index e14e667a20e97bb196397c7b4cd1d734f1fcb35c..2bea51edfab707645a6d6b8a5b6c79bb0c6dde64 100644 (file)
@@ -233,6 +233,7 @@ struct mddev {
                                 * md_ioctl checked on it.
                                 */
 #define MD_JOURNAL_CLEAN 5     /* A raid with journal is already clean */
+#define MD_HAS_JOURNAL 6       /* The raid array has journal feature set */
 
        int                             suspended;
        atomic_t                        active_io;