]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
Assemble: print error message if mdadm fails assembling with --uuid option
[thirdparty/mdadm.git] / super-intel.c
index a103a3fc0cdd6a32898e85f5c44de8a27c6b1552..3a73d2b35bee18ff5e9f0041d977c586f5f81ff4 100644 (file)
                                                   * mutliple PPL area
                                                   */
 
+/*
+ * This macro let's us ensure that no-one accidentally
+ * changes the size of a struct
+ */
+#define ASSERT_SIZE(_struct, size) \
+static inline void __assert_size_##_struct(void)       \
+{                                                      \
+       switch (0) {                                    \
+       case 0: break;                                  \
+       case (sizeof(struct _struct) == size): break;   \
+       }                                               \
+}
+
 /* Disk configuration info. */
 #define IMSM_MAX_DEVICES 255
 struct imsm_disk {
@@ -112,6 +125,7 @@ struct imsm_disk {
 #define        IMSM_DISK_FILLERS       3
        __u32 filler[IMSM_DISK_FILLERS]; /* 0xF5 - 0x107 MPB_DISK_FILLERS for future expansion */
 };
+ASSERT_SIZE(imsm_disk, 48)
 
 /* map selector for map managment
  */
@@ -146,7 +160,8 @@ struct imsm_map {
        __u32 disk_ord_tbl[1];  /* disk_ord_tbl[num_members],
                                 * top byte contains some flags
                                 */
-} __attribute__ ((packed));
+};
+ASSERT_SIZE(imsm_map, 52)
 
 struct imsm_vol {
        __u32 curr_migr_unit;
@@ -169,7 +184,8 @@ struct imsm_vol {
        __u32 filler[4];
        struct imsm_map map[1];
        /* here comes another one if migr_state */
-} __attribute__ ((packed));
+};
+ASSERT_SIZE(imsm_vol, 84)
 
 struct imsm_dev {
        __u8  volume[MAX_RAID_SERIAL_LEN];
@@ -220,7 +236,8 @@ struct imsm_dev {
 #define IMSM_DEV_FILLERS 3
        __u32 filler[IMSM_DEV_FILLERS];
        struct imsm_vol vol;
-} __attribute__ ((packed));
+};
+ASSERT_SIZE(imsm_dev, 164)
 
 struct imsm_super {
        __u8 sig[MAX_SIGNATURE_LENGTH]; /* 0x00 - 0x1F */
@@ -243,12 +260,14 @@ struct imsm_super {
                                         * (starts at 1)
                                         */
        __u16 filler1;                  /* 0x4E - 0x4F */
-#define IMSM_FILLERS 34
-       __u32 filler[IMSM_FILLERS];     /* 0x50 - 0xD7 RAID_MPB_FILLERS */
+       __u64 creation_time;            /* 0x50 - 0x57 Array creation time */
+#define IMSM_FILLERS 32
+       __u32 filler[IMSM_FILLERS];     /* 0x58 - 0xD7 RAID_MPB_FILLERS */
        struct imsm_disk disk[1];       /* 0xD8 diskTbl[numDisks] */
        /* here comes imsm_dev[num_raid_devs] */
        /* here comes BBM logs */
-} __attribute__ ((packed));
+};
+ASSERT_SIZE(imsm_super, 264)
 
 #define BBM_LOG_MAX_ENTRIES 254
 #define BBM_LOG_MAX_LBA_ENTRY_VAL 256          /* Represents 256 LBAs */
@@ -269,7 +288,8 @@ struct bbm_log {
        __u32 signature; /* 0xABADB10C */
        __u32 entry_count;
        struct bbm_log_entry marked_block_entries[BBM_LOG_MAX_ENTRIES];
-} __attribute__ ((__packed__));
+};
+ASSERT_SIZE(bbm_log, 2040)
 
 static char *map_state_str[] = { "normal", "uninitialized", "degraded", "failed" };
 
@@ -323,7 +343,8 @@ struct migr_record {
                                       * destination - high order 32 bits */
        __u32 num_migr_units_hi;      /* Total num migration units-of-op
                                       * high order 32 bits */
-} __attribute__ ((__packed__));
+};
+ASSERT_SIZE(migr_record, 64)
 
 struct md_list {
        /* usage marker:
@@ -1558,6 +1579,7 @@ static void print_imsm_dev(struct intel_super *super,
 
        printf("\n");
        printf("[%.16s]:\n", dev->volume);
+       printf("       Subarray : %d\n", super->current_vol);
        printf("           UUID : %s\n", uuid);
        printf("     RAID Level : %d", get_imsm_raid_level(map));
        if (map2)
@@ -1662,6 +1684,8 @@ static void print_imsm_dev(struct intel_super *super,
                printf("Multiple PPLs on journaling drive\n");
        else
                printf("<unknown:%d>\n", dev->rwh_policy);
+
+       printf("      Volume ID : %u\n", dev->my_vol_raid_dev_num);
 }
 
 static void print_imsm_disk(struct imsm_disk *disk,
@@ -1994,6 +2018,7 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
        __u32 sum;
        __u32 reserved = imsm_reserved_sectors(super, super->disks);
        struct dl *dl;
+       time_t creation_time;
 
        strncpy(str, (char *)mpb->sig, MPB_SIG_LEN);
        str[MPB_SIG_LEN-1] = '\0';
@@ -2002,6 +2027,9 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
        printf("    Orig Family : %08x\n", __le32_to_cpu(mpb->orig_family_num));
        printf("         Family : %08x\n", __le32_to_cpu(mpb->family_num));
        printf("     Generation : %08x\n", __le32_to_cpu(mpb->generation_num));
+       creation_time = __le64_to_cpu(mpb->creation_time);
+       printf("  Creation Time : %.24s\n",
+               creation_time ? ctime(&creation_time) : "Unknown");
        printf("     Attributes : ");
        if (imsm_check_attributes(mpb->attributes))
                printf("All supported\n");
@@ -2106,83 +2134,46 @@ static void export_examine_super_imsm(struct supertype *st)
        printf("MD_LEVEL=container\n");
        printf("MD_UUID=%s\n", nbuf+5);
        printf("MD_DEVICES=%u\n", mpb->num_disks);
+       printf("MD_CREATION_TIME=%llu\n", __le64_to_cpu(mpb->creation_time));
 }
 
-static int copy_metadata_imsm(struct supertype *st, int from, int to)
-{
-       /* The second last sector of the device contains
-        * the "struct imsm_super" metadata.
-        * This contains mpb_size which is the size in bytes of the
-        * extended metadata.  This is located immediately before
-        * the imsm_super.
-        * We want to read all that, plus the last sector which
-        * may contain a migration record, and write it all
-        * to the target.
-        */
-       void *buf;
-       unsigned long long dsize, offset;
-       int sectors;
-       struct imsm_super *sb;
-       struct intel_super *super = st->sb;
-       unsigned int sector_size = super->sector_size;
-       unsigned int written = 0;
-
-       if (posix_memalign(&buf, MAX_SECTOR_SIZE, MAX_SECTOR_SIZE) != 0)
-               return 1;
-
-       if (!get_dev_size(from, NULL, &dsize))
-               goto err;
-
-       if (lseek64(from, dsize-(2*sector_size), 0) < 0)
-               goto err;
-       if ((unsigned int)read(from, buf, sector_size) != sector_size)
-               goto err;
-       sb = buf;
-       if (strncmp((char*)sb->sig, MPB_SIGNATURE, MPB_SIG_LEN) != 0)
-               goto err;
-
-       sectors = mpb_sectors(sb, sector_size) + 2;
-       offset = dsize - sectors * sector_size;
-       if (lseek64(from, offset, 0) < 0 ||
-           lseek64(to, offset, 0) < 0)
-               goto err;
-       while (written < sectors * sector_size) {
-               int n = sectors*sector_size - written;
-               if (n > 4096)
-                       n = 4096;
-               if (read(from, buf, n) != n)
-                       goto err;
-               if (write(to, buf, n) != n)
-                       goto err;
-               written += n;
-       }
-       free(buf);
-       return 0;
-err:
-       free(buf);
-       return 1;
-}
-
-static void detail_super_imsm(struct supertype *st, char *homehost)
+static void detail_super_imsm(struct supertype *st, char *homehost,
+                             char *subarray)
 {
        struct mdinfo info;
        char nbuf[64];
+       struct intel_super *super = st->sb;
+       int temp_vol = super->current_vol;
+
+       if (subarray)
+               super->current_vol = strtoul(subarray, NULL, 10);
 
        getinfo_super_imsm(st, &info, NULL);
        fname_from_uuid(st, &info, nbuf, ':');
        printf("\n              UUID : %s\n", nbuf + 5);
+
+       super->current_vol = temp_vol;
 }
 
-static void brief_detail_super_imsm(struct supertype *st)
+static void brief_detail_super_imsm(struct supertype *st, char *subarray)
 {
        struct mdinfo info;
        char nbuf[64];
+       struct intel_super *super = st->sb;
+       int temp_vol = super->current_vol;
+
+       if (subarray)
+               super->current_vol = strtoul(subarray, NULL, 10);
+
        getinfo_super_imsm(st, &info, NULL);
        fname_from_uuid(st, &info, nbuf, ':');
        printf(" UUID=%s", nbuf + 5);
+
+       super->current_vol = temp_vol;
 }
 
-static int imsm_read_serial(int fd, char *devname, __u8 *serial);
+static int imsm_read_serial(int fd, char *devname, __u8 *serial,
+                           size_t serial_buf_len);
 static void fd2devname(int fd, char *name);
 
 static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_base, int verbose)
@@ -2328,8 +2319,9 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
                else {
                        fd2devname(fd, buf);
                        printf("          Port%d : %s", port, buf);
-                       if (imsm_read_serial(fd, NULL, (__u8 *) buf) == 0)
-                               printf(" (%.*s)\n", MAX_RAID_SERIAL_LEN, buf);
+                       if (imsm_read_serial(fd, NULL, (__u8 *)buf,
+                                            sizeof(buf)) == 0)
+                               printf(" (%s)\n", buf);
                        else
                                printf(" ()\n");
                        close(fd);
@@ -2352,52 +2344,45 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
        return err;
 }
 
-static int print_vmd_attached_devs(struct sys_dev *hba)
+static int print_nvme_info(struct sys_dev *hba)
 {
+       char buf[1024];
        struct dirent *ent;
        DIR *dir;
-       char path[292];
-       char link[256];
-       char *c, *rp;
-
-       if (hba->type != SYS_DEV_VMD)
-               return 1;
+       char *rp;
+       int fd;
 
-       /* scroll through /sys/dev/block looking for devices attached to
-        * this hba
-        */
-       dir = opendir("/sys/bus/pci/drivers/nvme");
+       dir = opendir("/sys/block/");
        if (!dir)
                return 1;
 
        for (ent = readdir(dir); ent; ent = readdir(dir)) {
-               int n;
-
-               /* is 'ent' a device? check that the 'subsystem' link exists and
-                * that its target matches 'bus'
-                */
-               sprintf(path, "/sys/bus/pci/drivers/nvme/%s/subsystem",
-                       ent->d_name);
-               n = readlink(path, link, sizeof(link));
-               if (n < 0 || n >= (int)sizeof(link))
-                       continue;
-               link[n] = '\0';
-               c = strrchr(link, '/');
-               if (!c)
-                       continue;
-               if (strncmp("pci", c+1, strlen("pci")) != 0)
-                       continue;
-
-               sprintf(path, "/sys/bus/pci/drivers/nvme/%s", ent->d_name);
-
-               rp = realpath(path, NULL);
-               if (!rp)
-                       continue;
+               if (strstr(ent->d_name, "nvme")) {
+                       sprintf(buf, "/sys/block/%s", ent->d_name);
+                       rp = realpath(buf, NULL);
+                       if (!rp)
+                               continue;
+                       if (path_attached_to_hba(rp, hba->path)) {
+                               fd = open_dev(ent->d_name);
+                               if (fd < 0) {
+                                       free(rp);
+                                       continue;
+                               }
 
-               if (path_attached_to_hba(rp, hba->path)) {
-                       printf(" NVMe under VMD : %s\n", rp);
+                               fd2devname(fd, buf);
+                               if (hba->type == SYS_DEV_VMD)
+                                       printf(" NVMe under VMD : %s", buf);
+                               else if (hba->type == SYS_DEV_NVME)
+                                       printf("    NVMe Device : %s", buf);
+                               if (!imsm_read_serial(fd, NULL, (__u8 *)buf,
+                                                     sizeof(buf)))
+                                       printf(" (%s)\n", buf);
+                               else
+                                       printf("()\n");
+                               close(fd);
+                       }
+                       free(rp);
                }
-               free(rp);
        }
 
        closedir(dir);
@@ -2612,7 +2597,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
                                        char buf[PATH_MAX];
                                        printf(" I/O Controller : %s (%s)\n",
                                                vmd_domain_to_controller(hba, buf), get_sys_dev_type(hba->type));
-                                       if (print_vmd_attached_devs(hba)) {
+                                       if (print_nvme_info(hba)) {
                                                if (verbose > 0)
                                                        pr_err("failed to get devices attached to VMD domain.\n");
                                                result |= 2;
@@ -2627,7 +2612,7 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
                if (entry->type == SYS_DEV_NVME) {
                        for (hba = list; hba; hba = hba->next) {
                                if (hba->type == SYS_DEV_NVME)
-                                       printf("    NVMe Device : %s\n", hba->path);
+                                       print_nvme_info(hba);
                        }
                        printf("\n");
                        continue;
@@ -3992,11 +3977,11 @@ static int nvme_get_serial(int fd, void *buf, size_t buf_len)
 extern int scsi_get_serial(int fd, void *buf, size_t buf_len);
 
 static int imsm_read_serial(int fd, char *devname,
-                           __u8 serial[MAX_RAID_SERIAL_LEN])
+                           __u8 *serial, size_t serial_buf_len)
 {
        char buf[50];
        int rv;
-       int len;
+       size_t len;
        char *dest;
        char *src;
        unsigned int i;
@@ -4039,13 +4024,13 @@ static int imsm_read_serial(int fd, char *devname,
        len = dest - buf;
        dest = buf;
 
-       /* truncate leading characters */
-       if (len > MAX_RAID_SERIAL_LEN) {
-               dest += len - MAX_RAID_SERIAL_LEN;
-               len = MAX_RAID_SERIAL_LEN;
+       if (len > serial_buf_len) {
+               /* truncate leading characters */
+               dest += len - serial_buf_len;
+               len = serial_buf_len;
        }
 
-       memset(serial, 0, MAX_RAID_SERIAL_LEN);
+       memset(serial, 0, serial_buf_len);
        memcpy(serial, dest, len);
 
        return 0;
@@ -4100,7 +4085,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd)
        char name[40];
        __u8 serial[MAX_RAID_SERIAL_LEN];
 
-       rv = imsm_read_serial(fd, devname, serial);
+       rv = imsm_read_serial(fd, devname, serial, MAX_RAID_SERIAL_LEN);
 
        if (rv != 0)
                return 2;
@@ -5786,6 +5771,7 @@ static int add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk,
                sum += __gen_imsm_checksum(mpb);
                mpb->family_num = __cpu_to_le32(sum);
                mpb->orig_family_num = mpb->family_num;
+               mpb->creation_time = __cpu_to_le64((__u64)time(NULL));
        }
        super->current_disk = dl;
        return 0;
@@ -5808,7 +5794,7 @@ int mark_spare(struct dl *disk)
                return ret_val;
 
        ret_val = 0;
-       if (!imsm_read_serial(disk->fd, NULL, serial)) {
+       if (!imsm_read_serial(disk->fd, NULL, serial, MAX_RAID_SERIAL_LEN)) {
                /* Restore disk serial number, because takeover marks disk
                 * as failed and adds to serial ':0' before it becomes
                 * a spare disk.
@@ -5823,6 +5809,9 @@ int mark_spare(struct dl *disk)
        return ret_val;
 }
 
+
+static int write_super_imsm_spare(struct intel_super *super, struct dl *d);
+
 static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
                             int fd, char *devname,
                             unsigned long long data_offset)
@@ -5859,7 +5848,7 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
        dd->fd = fd;
        dd->e = NULL;
        dd->action = DISK_ADD;
-       rv = imsm_read_serial(fd, devname, dd->serial);
+       rv = imsm_read_serial(fd, devname, dd->serial, MAX_RAID_SERIAL_LEN);
        if (rv) {
                pr_err("failed to retrieve scsi serial, aborting\n");
                if (dd->devname)
@@ -5952,9 +5941,13 @@ static int add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk,
                dd->next = super->disk_mgmt_list;
                super->disk_mgmt_list = dd;
        } else {
+               /* this is called outside of mdmon
+                * write initial spare metadata
+                * mdmon will overwrite it.
+                */
                dd->next = super->disks;
                super->disks = dd;
-               super->updates_pending++;
+               write_super_imsm_spare(super, dd);
        }
 
        return 0;
@@ -5993,15 +5986,15 @@ static union {
        struct imsm_super anchor;
 } spare_record __attribute__ ((aligned(MAX_SECTOR_SIZE)));
 
-/* spare records have their own family number and do not have any defined raid
- * devices
- */
-static int write_super_imsm_spares(struct intel_super *super, int doclose)
+
+static int write_super_imsm_spare(struct intel_super *super, struct dl *d)
 {
        struct imsm_super *mpb = super->anchor;
        struct imsm_super *spare = &spare_record.anchor;
        __u32 sum;
-       struct dl *d;
+
+       if (d->index != -1)
+               return 1;
 
        spare->mpb_size = __cpu_to_le32(sizeof(struct imsm_super));
        spare->generation_num = __cpu_to_le32(1UL);
@@ -6014,28 +6007,41 @@ static int write_super_imsm_spares(struct intel_super *super, int doclose)
        snprintf((char *) spare->sig, MAX_SIGNATURE_LENGTH,
                 MPB_SIGNATURE MPB_VERSION_RAID0);
 
-       for (d = super->disks; d; d = d->next) {
-               if (d->index != -1)
-                       continue;
+       spare->disk[0] = d->disk;
+       if (__le32_to_cpu(d->disk.total_blocks_hi) > 0)
+               spare->attributes |= MPB_ATTRIB_2TB_DISK;
+
+       if (super->sector_size == 4096)
+               convert_to_4k_imsm_disk(&spare->disk[0]);
+
+       sum = __gen_imsm_checksum(spare);
+       spare->family_num = __cpu_to_le32(sum);
+       spare->orig_family_num = 0;
+       sum = __gen_imsm_checksum(spare);
+       spare->check_sum = __cpu_to_le32(sum);
 
-               spare->disk[0] = d->disk;
-               if (__le32_to_cpu(d->disk.total_blocks_hi) > 0)
-                       spare->attributes |= MPB_ATTRIB_2TB_DISK;
+       if (store_imsm_mpb(d->fd, spare)) {
+               pr_err("failed for device %d:%d %s\n",
+                       d->major, d->minor, strerror(errno));
+               return 1;
+       }
 
-               if (super->sector_size == 4096)
-                       convert_to_4k_imsm_disk(&spare->disk[0]);
+       return 0;
+}
+/* spare records have their own family number and do not have any defined raid
+ * devices
+ */
+static int write_super_imsm_spares(struct intel_super *super, int doclose)
+{
+       struct dl *d;
 
-               sum = __gen_imsm_checksum(spare);
-               spare->family_num = __cpu_to_le32(sum);
-               spare->orig_family_num = 0;
-               sum = __gen_imsm_checksum(spare);
-               spare->check_sum = __cpu_to_le32(sum);
+       for (d = super->disks; d; d = d->next) {
+               if (d->index != -1)
+                       continue;
 
-               if (store_imsm_mpb(d->fd, spare)) {
-                       pr_err("failed for device %d:%d %s\n",
-                               d->major, d->minor, strerror(errno));
+               if (write_super_imsm_spare(super, d))
                        return 1;
-               }
+
                if (doclose) {
                        close(d->fd);
                        d->fd = -1;
@@ -7298,11 +7304,8 @@ static int validate_geometry_imsm_volume(struct supertype *st, int level,
 
        maxsize = merge_extents(super, i);
 
-       if (!check_env("IMSM_NO_PLATFORM") &&
-           mpb->num_raid_devs > 0 && size && size != maxsize) {
-               pr_err("attempting to create a second volume with size less then remaining space. Aborting...\n");
-               return 0;
-       }
+       if (mpb->num_raid_devs > 0 && size && size != maxsize)
+               pr_err("attempting to create a second volume with size less then remaining space.\n");
 
        if (maxsize < size || maxsize == 0) {
                if (verbose) {
@@ -7393,11 +7396,8 @@ static int imsm_get_free_size(struct supertype *st, int raiddisks,
                }
                maxsize = size;
        }
-       if (!check_env("IMSM_NO_PLATFORM") &&
-           mpb->num_raid_devs > 0 && size && size != maxsize) {
-               pr_err("attempting to create a second volume with size less then remaining space. Aborting...\n");
-               return 0;
-       }
+       if (mpb->num_raid_devs > 0 && size && size != maxsize)
+               pr_err("attempting to create a second volume with size less then remaining space.\n");
        cnt = 0;
        for (dl = super->disks; dl; dl = dl->next)
                if (dl->e)
@@ -7455,7 +7455,10 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                                                        verbose);
        }
 
-       if (size && (size < 1024)) {
+       /*
+        * Size is given in sectors.
+        */
+       if (size && (size < 2048)) {
                pr_err("Given size must be greater than 1M.\n");
                /* Depends on algorithm in Create.c :
                 * if container was given (dev == NULL) return -1,
@@ -7575,18 +7578,17 @@ static void default_geometry_imsm(struct supertype *st, int *level, int *layout,
 
 static void handle_missing(struct intel_super *super, struct imsm_dev *dev);
 
-static int kill_subarray_imsm(struct supertype *st)
+static int kill_subarray_imsm(struct supertype *st, char *subarray_id)
 {
-       /* remove the subarray currently referenced by ->current_vol */
+       /* remove the subarray currently referenced by subarray_id */
        __u8 i;
        struct intel_dev **dp;
        struct intel_super *super = st->sb;
-       __u8 current_vol = super->current_vol;
+       __u8 current_vol = strtoul(subarray_id, NULL, 10);
        struct imsm_super *mpb = super->anchor;
 
-       if (super->current_vol < 0)
+       if (mpb->num_raid_devs == 0)
                return 2;
-       super->current_vol = -1; /* invalidate subarray cursor */
 
        /* block deletions that would change the uuid of active subarrays
         *
@@ -7826,6 +7828,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
        int sb_errors = 0;
        struct dl *d;
        int spare_disks = 0;
+       int current_vol = super->current_vol;
 
        /* do not assemble arrays when not all attributes are supported */
        if (imsm_check_attributes(mpb->attributes) == 0) {
@@ -7920,7 +7923,8 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
                                skip = 1;
                        if (!skip && (ord & IMSM_ORD_REBUILD))
                                recovery_start = 0;
-
+                       if (!(ord & IMSM_ORD_REBUILD))
+                               this->array.working_disks++;
                        /*
                         * if we skip some disks the array will be assmebled degraded;
                         * reset resync start to avoid a dirty-degraded
@@ -7962,8 +7966,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
                                else
                                        this->array.spare_disks++;
                        }
-                       if (info_d->recovery_start == MaxSector)
-                               this->array.working_disks++;
 
                        info_d->events = __le32_to_cpu(mpb->generation_num);
                        info_d->data_offset = pba_of_lba0(map);
@@ -7993,6 +7995,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
                rest = this;
        }
 
+       super->current_vol = current_vol;
        return rest;
 }
 
@@ -12245,7 +12248,6 @@ struct superswitch super_imsm = {
        .reshape_super  = imsm_reshape_super,
        .manage_reshape = imsm_manage_reshape,
        .recover_backup = recover_backup_imsm,
-       .copy_metadata = copy_metadata_imsm,
        .examine_badblocks = examine_badblocks_imsm,
        .match_home     = match_home_imsm,
        .uuid_from_super= uuid_from_super_imsm,