]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Don't break long strings onto multiple lines.
[thirdparty/mdadm.git] / super0.c
index b2019dfaff2a152da26ed96c9d816cb73954e0f7..deb59994e9707a5aa2d74073c98a7f674a767757 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -650,18 +650,19 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        pr_err("No active reshape to revert on %s\n",
                               devname);
                else if (sb->delta_disks == 0)
-                       pr_err("%s: Can on revert reshape which changes number of devices\n",
+                       pr_err("%s: Can only revert reshape which changes number of devices\n",
                               devname);
                else {
                        int tmp;
                        int parity = sb->level == 6 ? 2 : 1;
                        rv = 0;
 
-                       if (sb->reshape_position % (
+                       if (sb->level >= 4 && sb->level <= 6 &&
+                           sb->reshape_position % (
                                    sb->new_chunk/512 *
                                    (sb->raid_disks - sb->delta_disks - parity))) {
                                pr_err("Reshape position is not suitably aligned.\n");
-                               pr_err("Try normal assembly as stop again\n");
+                               pr_err("Try normal assembly and stop again\n");
                                return -2;
                        }
                        sb->raid_disks -= sb->delta_disks;
@@ -712,7 +713,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
 
        if (posix_memalign((void**)&sb, 4096,
                           MD_SB_BYTES + ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) {
-               pr_err("%s could not allocate superblock\n", __func__);
+               pr_err("could not allocate superblock\n");
                return 0;
        }
        memset(sb, 0, MD_SB_BYTES + sizeof(bitmap_super_t));
@@ -804,9 +805,8 @@ static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
        dk->major = dinfo->major;
        dk->minor = dinfo->minor;
        dk->raid_disk = dinfo->raid_disk;
-       dk->state = dinfo->state;
-       /* In case our source disk was writemostly, don't copy that bit */
-       dk->state &= ~(1<<MD_DISK_WRITEMOSTLY);
+       dk->state = dinfo->state & ((1<<MD_DISK_ACTIVE) |
+                                   (1<<MD_DISK_SYNC));
 
        sb->this_disk = sb->disks[dinfo->number];
        sb->sb_csum = calc_sb0_csum(sb);
@@ -886,7 +886,7 @@ static int write_init_super0(struct supertype *st)
 
        for (di = st->info ; di && ! rv ; di = di->next) {
 
-               if (di->disk.state == 1)
+               if (di->disk.state & (1 << MD_DISK_FAULTY))
                        continue;
                if (di->fd == -1)
                        continue;
@@ -929,7 +929,7 @@ static int compare_super0(struct supertype *st, struct supertype *tst)
                if (posix_memalign((void**)&first, 4096,
                             MD_SB_BYTES +
                             ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) {
-                       pr_err("%s could not allocate superblock\n", __func__);
+                       pr_err("could not allocate superblock\n");
                        return 1;
                }
                memcpy(first, second, MD_SB_BYTES + sizeof(struct bitmap_super_s));
@@ -997,7 +997,7 @@ static int load_super0(struct supertype *st, int fd, char *devname)
        if (posix_memalign((void**)&super, 4096,
                           MD_SB_BYTES +
                           ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) {
-               pr_err("%s could not allocate superblock\n", __func__);
+               pr_err("could not allocate superblock\n");
                return 1;
        }
 
@@ -1269,11 +1269,10 @@ static int validate_geometry0(struct supertype *st, int level,
        }
        if (size >= tbmax * 2ULL*1024*1024*1024) {
                if (verbose)
-                       pr_err("0.90 metadata supports at most "
-                              "%d terabytes per device\n", tbmax);
+                       pr_err("0.90 metadata supports at most %d terabytes per device\n", tbmax);
                return 0;
        }
-       if (chunk && *chunk == UnSet)
+       if (*chunk == UnSet)
                *chunk = DEFAULT_CHUNK;
 
        if (!subdev)