]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Fix some compiler warnings.
[thirdparty/mdadm.git] / super0.c
index 0b95dac214c73c34bf64d6bcf704a51395cd50f7..440981bab9971320373af515f9882701ea60f8a1 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -346,6 +346,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map)
        int i;
        int map_disks = info->array.raid_disks;
 
+       memset(info, 0, sizeof(*info));
        info->array.major_version = sb->major_version;
        info->array.minor_version = sb->minor_version;
        info->array.patch_version = sb->patch_version;
@@ -503,6 +504,20 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                        sb->disks[d].state = info->disk.state | wonly;
                        rv = 1;
                }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks >= 0 &&
+                   info->reshape_progress < sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
+               if (info->reshape_active &&
+                   sb->minor_version > 90 && (sb->reshape_position+1) != 0 &&
+                   info->delta_disks < 0 &&
+                   info->reshape_progress > sb->reshape_position) {
+                       sb->reshape_position = info->reshape_progress;
+                       rv = 1;
+               }
        } else if (strcmp(update, "linear-grow-new") == 0) {
                memset(&sb->disks[info->disk.number], 0, sizeof(sb->disks[0]));
                sb->disks[info->disk.number].number = info->disk.number;
@@ -527,7 +542,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                sb->state &= ~(1<<MD_SB_CLEAN);
                sb->recovery_cp = 0;
        } else if (strcmp(update, "homehost") == 0 &&
-           homehost) {
+                  homehost) {
                uuid_set = 0;
                update = "uuid";
                info->uuid[0] = sb->set_uuid0;
@@ -1090,7 +1105,7 @@ static void free_super0(struct supertype *st)
 #ifndef MDASSEMBLE
 static int validate_geometry0(struct supertype *st, int level,
                              int layout, int raiddisks,
-                             int chunk, unsigned long long size,
+                             int *chunk, unsigned long long size,
                              char *subdev, unsigned long long *freesize,
                              int verbose)
 {
@@ -1113,6 +1128,9 @@ static int validate_geometry0(struct supertype *st, int level,
                        fprintf(stderr, Name ": 0.90 metadata supports at most 2 terrabytes per device\n");
                return 0;
        }
+       if (chunk && *chunk == UnSet)
+               *chunk = DEFAULT_CHUNK;
+
        if (!subdev)
                return 1;