]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Assemble: add support for RAID0 layouts.
[thirdparty/mdadm.git] / super0.c
index dc13efb639e79c38a35bf906e3b659125aac445c..6af140bbf72197223e54fd37b9d1fd1ac28167ad 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -348,7 +348,7 @@ err:
        return 1;
 }
 
-static void detail_super0(struct supertype *st, char *homehost)
+static void detail_super0(struct supertype *st, char *homehost, char *subarray)
 {
        mdp_super_t *sb = st->sb;
        printf("              UUID : ");
@@ -368,7 +368,7 @@ static void detail_super0(struct supertype *st, char *homehost)
        printf("\n            Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
 }
 
-static void brief_detail_super0(struct supertype *st)
+static void brief_detail_super0(struct supertype *st, char *subarray)
 {
        mdp_super_t *sb = st->sb;
        printf(" UUID=");
@@ -520,9 +520,10 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                 * up 4 bytes before continuing
                 */
                __u32 *sb32 = (__u32*)sb;
-               memcpy(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
-                      sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
-                      (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
+
+               memmove(sb32+MD_SB_GENERIC_CONSTANT_WORDS+7,
+                       sb32+MD_SB_GENERIC_CONSTANT_WORDS+7+1,
+                       (MD_SB_WORDS - (MD_SB_GENERIC_CONSTANT_WORDS+7+1))*4);
                if (verbose >= 0)
                        pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n",
                               devname);
@@ -589,8 +590,8 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                         * being marked 'sync'
                         */
                        add = (1<<MD_DISK_SYNC);
-               if (((sb->disks[d].state & ~mask) | add)
-                   != (unsigned)info->disk.state) {
+               if (((sb->disks[d].state & ~mask) | add) !=
+                   (unsigned)info->disk.state) {
                        sb->disks[d].state = info->disk.state | wonly |failfast;
                        rv = 1;
                }
@@ -1058,8 +1059,8 @@ static int load_super0(struct supertype *st, int fd, char *devname)
         * valid.  If it doesn't clear the bit.  An --assemble --force
         * should get that written out.
         */
-       if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),4096))
-           != ROUND_UP(sizeof(struct bitmap_super_s),4096))
+       if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),4096)) !=
+           ROUND_UP(sizeof(struct bitmap_super_s), 4096))
                goto no_bitmap;
 
        uuid_from_super0(st, uuid);
@@ -1290,6 +1291,12 @@ static int validate_geometry0(struct supertype *st, int level,
        if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
+       if (level == 0 && layout != UnSet) {
+               if (verbose)
+                       pr_err("0.90 metadata does not support layouts for RAID0\n");
+               return 0;
+       }
+
        if (!subdev)
                return 1;