]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
Introduce MaxSector
[thirdparty/mdadm.git] / super1.c
index a21e7e3baf8eeeeaf8b9f6a71ed6a833937e846e..85bb598ad811d1a248354ca84e56cb682e19b406 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -659,9 +659,9 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
                switch(__le32_to_cpu(sb->level)) {
                case 5: case 4: case 6:
                        /* need to force clean */
-                       if (sb->resync_offset != ~0ULL)
+                       if (sb->resync_offset != MaxSector)
                                rv = 1;
-                       sb->resync_offset = ~0ULL;
+                       sb->resync_offset = MaxSector;
                }
        }
        if (strcmp(update, "assemble")==0) {
@@ -855,7 +855,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
        sb->utime = sb->ctime;
        sb->events = __cpu_to_le64(1);
        if (info->state & (1<<MD_SB_CLEAN))
-               sb->resync_offset = ~0ULL;
+               sb->resync_offset = MaxSector;
        else
                sb->resync_offset = 0;
        sb->max_dev = __cpu_to_le32((1024- sizeof(struct mdp_superblock_1))/
@@ -1016,8 +1016,8 @@ static int write_init_super1(struct supertype *st)
                if (di->fd < 0)
                        continue;
 
-               Kill(di->devname, 0, 1, 1);
-               Kill(di->devname, 0, 1, 1);
+               while (Kill(di->devname, NULL, 0, 1, 1) == 0)
+                       ;
 
                sb->dev_number = __cpu_to_le32(di->disk.number);
                if (di->disk.state & (1<<MD_DISK_WRITEMOSTLY))
@@ -1501,9 +1501,14 @@ add_internal_bitmap1(struct supertype *st,
                min_chunk *= 2;
                bits = (bits+1)/2;
        }
-       if (chunk == UnSet)
+       if (chunk == UnSet) {
+               /* For practical purpose, 64Meg is a good
+                * default chunk size for internal bitmaps.
+                */
                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 */
        if (chunk == 0) /* rounding problem */
                return 0;
@@ -1604,8 +1609,11 @@ static int validate_geometry1(struct supertype *st, int level,
        unsigned long long ldsize;
        int fd;
 
-       if (level == LEVEL_CONTAINER)
+       if (level == LEVEL_CONTAINER) {
+               if (verbose)
+                       fprintf(stderr, Name ": 1.x metadata does not support containers\n");
                return 0;
+       }
        if (!subdev)
                return 1;