]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Having single function to read mdmon pid file.
[thirdparty/mdadm.git] / super0.c
index 69fb460613753ddd4c9af2f7e33cce53f32bbe7b..5c6b7d71984e831ba0b9640e04b0f6093aa85022 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -372,6 +372,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info)
 
        uuid_from_super0(st, info->uuid);
 
+       info->recovery_start = MaxSector;
        if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
                info->reshape_active = 1;
                info->reshape_progress = sb->reshape_position;
@@ -478,7 +479,14 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
        if (strcmp(update, "assemble")==0) {
                int d = info->disk.number;
                int wonly = sb->disks[d].state & (1<<MD_DISK_WRITEMOSTLY);
-               if ((sb->disks[d].state & ~(1<<MD_DISK_WRITEMOSTLY))
+               int mask = (1<<MD_DISK_WRITEMOSTLY);
+               int add = 0;
+               if (sb->minor_version >= 91)
+                       /* During reshape we don't insist on everything
+                        * being marked 'sync'
+                        */
+                       add = (1<<MD_DISK_SYNC);
+               if (((sb->disks[d].state & ~mask) | add)
                    != info->disk.state) {
                        sb->disks[d].state = info->disk.state | wonly;
                        rv = 1;
@@ -718,8 +726,8 @@ static int write_init_super0(struct supertype *st)
                        continue;
                if (di->fd == -1)
                        continue;
-               Kill(di->devname, 0, 1, 1);
-               Kill(di->devname, 0, 1, 1);
+               while (Kill(di->devname, NULL, 0, 1, 1) == 0)
+                       ;
 
                sb->disks[di->disk.number].state &= ~(1<<MD_DISK_FAULTY);
 
@@ -914,9 +922,7 @@ static struct supertype *match_metadata_desc0(char *arg)
        while (arg[0] == '0' && arg[1] == '0')
                arg++;
        if (strcmp(arg, "0") == 0 ||
-           strcmp(arg, "0.90") == 0 ||
-           strcmp(arg, "default") == 0 ||
-           strcmp(arg, "") == 0 /* no metadata */
+           strcmp(arg, "0.90") == 0
                )
                return st;
 
@@ -965,9 +971,14 @@ static int add_internal_bitmap0(struct supertype *st, int *chunkp,
                min_chunk *= 2;
                bits = (bits+1)/2;
        }
-       if (chunk == UnSet)
+       if (chunk == UnSet) {
+               /* A chunk size less than a few Megabytes gives poor
+                * performance without increasing resync noticeably
+                */
                chunk = min_chunk;
-       else if (chunk < min_chunk)
+               if (chunk < 64*1024*1024)
+                       chunk = 64*1024*1024;
+       } else if (chunk < min_chunk)
                return 0; /* chunk size too small */
 
        sb->state |= (1<<MD_SB_BITMAP_PRESENT);
@@ -1069,12 +1080,22 @@ static int validate_geometry0(struct supertype *st, int level,
        unsigned long long ldsize;
        int fd;
 
-       if (level == LEVEL_CONTAINER)
+       if (level == LEVEL_CONTAINER) {
+               if (verbose)
+                       fprintf(stderr, Name ": 0.90 metadata does not support containers\n");
                return 0;
-       if (raiddisks > MD_SB_DISKS)
+       }
+       if (raiddisks > MD_SB_DISKS) {
+               if (verbose)
+                       fprintf(stderr, Name ": 0.90 metadata supports at most %d devices per array\n",
+                               MD_SB_DISKS);
                return 0;
-       if (size > (0x7fffffffULL<<9))
+       }
+       if (size > (0x7fffffffULL<<9)) {
+               if (verbose)
+                       fprintf(stderr, Name ": 0.90 metadata supports at most 2 terrabytes per device\n");
                return 0;
+       }
        if (!subdev)
                return 1;