]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Manage: Add support for --re-add faulty
[thirdparty/mdadm.git] / super0.c
index 55e71e8c582fe9d8b91ced8c9ed7cff5a20edc61..ecb6b38202c26c9db6fbbd0307aba352bc95782a 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -445,7 +445,7 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                       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 compatability.\n",
+                       pr_err("adjusting superblock of %s for 2.2/sparc compatibility.\n",
                               devname);
        } else if (strcmp(update, "super-minor") ==0) {
                sb->md_minor = info->array.md_minor;
@@ -601,11 +601,16 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
 
 static int init_super0(struct supertype *st, mdu_array_info_t *info,
                       unsigned long long size, char *ignored_name, char *homehost,
-                      int *uuid)
+                      int *uuid, unsigned long long data_offset)
 {
        mdp_super_t *sb;
        int spares;
 
+       if (data_offset != INVALID_SECTORS) {
+               fprintf(stderr, Name ": data-offset not support for 0.90\n");
+               return 0;
+       }
+
        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__);
@@ -633,9 +638,9 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
        sb->gvalid_words = 0; /* ignored */
        sb->ctime = time(0);
        sb->level = info->level;
-       if (size != (unsigned long long)info->size)
+       sb->size = size;
+       if (size != (unsigned long long)sb->size)
                return 0;
-       sb->size = info->size;
        sb->nr_disks = info->nr_disks;
        sb->raid_disks = info->raid_disks;
        sb->md_minor = info->md_minor;
@@ -657,7 +662,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
                if (rfd >= 0)
                        close(rfd);
        }
-       if (homehost) {
+       if (homehost && !uuid) {
                char buf[20];
                char *hash = sha1_buffer(homehost,
                                         strlen(homehost),
@@ -690,7 +695,7 @@ struct devinfo {
 #ifndef MDASSEMBLE
 /* Add a device to the superblock being created */
 static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
-                         int fd, char *devname)
+                        int fd, char *devname, unsigned long long data_offset)
 {
        mdp_super_t *sb = st->sb;
        mdp_disk_t *dk = &sb->disks[dinfo->number];
@@ -768,7 +773,7 @@ static int write_init_super0(struct supertype *st)
                        continue;
                if (di->fd == -1)
                        continue;
-               while (Kill(di->devname, NULL, 0, 1, 1) == 0)
+               while (Kill(di->devname, NULL, 0, -1, 1) == 0)
                        ;
 
                sb->disks[di->disk.number].state &= ~(1<<MD_DISK_FAULTY);
@@ -975,8 +980,11 @@ static struct supertype *match_metadata_desc0(char *arg)
        return NULL;
 }
 
-static __u64 avail_size0(struct supertype *st, __u64 devsize)
+static __u64 avail_size0(struct supertype *st, __u64 devsize,
+                        unsigned long long data_offset)
 {
+       if (data_offset != 0 && data_offset != INVALID_SECTORS)
+               return 0ULL;
        if (devsize < MD_RESERVED_SECTORS)
                return 0ULL;
        return MD_NEW_SIZE_SECTORS(devsize);
@@ -1121,6 +1129,7 @@ static void free_super0(struct supertype *st)
 static int validate_geometry0(struct supertype *st, int level,
                              int layout, int raiddisks,
                              int *chunk, unsigned long long size,
+                             unsigned long long data_offset,
                              char *subdev, unsigned long long *freesize,
                              int verbose)
 {