return blocks;
}
-/* 'struct reshape' records the intermediate states
- * a general reshape.
- * The starting geometry is converted to the 'before' geometry
- * by at most an atomic level change. They could be the same.
- * Similarly the 'after' geometry is converted to the final
- * geometry by at most a level change.
- * Note that 'before' and 'after' must have the same level.
- * 'blocks' is the minimum number of sectors for a reshape unit.
- * This will be a multiple of the stripe size in each of the
- * 'before' and 'after' geometries.
- * If 'blocks' is 0, no restriping is necessary.
- */
-struct reshape {
- int level;
- int parity; /* number of parity blocks/devices */
- struct {
- int layout;
- int data_disks;
- } before, after;
- unsigned long long backup_blocks;
- unsigned long long stripes; /* number of old stripes that comprise 'blocks'*/
- unsigned long long new_size; /* New size of array in sectors */
-};
-
char *analyse_change(struct mdinfo *info, struct reshape *re)
{
/* Based on the current array state in info->array and
int force,
char *backup_file,
int quiet);
-static int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
- struct supertype *st, unsigned long stripes,
- int *fds, unsigned long long *offsets,
- int dests, int *destfd, unsigned long long *destoffsets);
-
int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
long long size,
}
start_reshape(sra);
- if (st->ss->external) {
- /* metadata handler takes it from here */
- ping_manager(container);
- st->ss->manage_reshape(st, backup_file);
- frozen = 0;
- goto release;
- }
-
/* Now we just need to kick off the reshape and watch, while
* handling backups of the data...
odisks = reshape.before.data_disks + reshape.parity;
- done = child_monitor(fd, sra, &reshape, st, blocks,
- fdlist, offsets,
- d - odisks, fdlist+odisks, offsets+odisks);
+ if (st->ss->external) {
+ /* metadata handler takes it from here */
+ done = st->ss->manage_reshape(
+ fd, sra, &reshape, st, blocks,
+ fdlist, offsets,
+ d - odisks, fdlist+odisks,
+ offsets+odisks);
+ } else
+ done = child_monitor(
+ fd, sra, &reshape, st, blocks,
+ fdlist, offsets,
+ d - odisks, fdlist+odisks,
+ offsets+odisks);
if (backup_file && done)
unlink(backup_file);
}
}
-static int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
- struct supertype *st, unsigned long blocks,
- int *fds, unsigned long long *offsets,
- int dests, int *destfd, unsigned long long *destoffsets)
+int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
+ struct supertype *st, unsigned long blocks,
+ int *fds, unsigned long long *offsets,
+ int dests, int *destfd, unsigned long long *destoffsets)
{
/* Monitor a reshape where backup is being performed using
* 'native' mechanism - either to a backup file, or
struct active_array;
struct metadata_update;
+
+/* 'struct reshape' records the intermediate states
+ * a general reshape.
+ * The starting geometry is converted to the 'before' geometry
+ * by at most an atomic level change. They could be the same.
+ * Similarly the 'after' geometry is converted to the final
+ * geometry by at most a level change.
+ * Note that 'before' and 'after' must have the same level.
+ * 'blocks' is the minimum number of sectors for a reshape unit.
+ * This will be a multiple of the stripe size in each of the
+ * 'before' and 'after' geometries.
+ * If 'blocks' is 0, no restriping is necessary.
+ */
+struct reshape {
+ int level;
+ int parity; /* number of parity blocks/devices */
+ struct {
+ int layout;
+ int data_disks;
+ } before, after;
+ unsigned long long backup_blocks;
+ unsigned long long stripes; /* number of old stripes that comprise 'blocks'*/
+ unsigned long long new_size; /* New size of array in sectors */
+};
+
/* A superswitch provides entry point the a metadata handler.
*
* The super_switch primarily operates on some "metadata" that
int (*reshape_super)(struct supertype *st, long long size, int level,
int layout, int chunksize, int raid_disks,
char *backup, char *dev, int verbose); /* optional */
- int (*manage_reshape)(struct supertype *st, char *backup); /* optional */
+ int (*manage_reshape)( /* optional */
+ int afd, struct mdinfo *sra, struct reshape *reshape,
+ struct supertype *st, unsigned long blocks,
+ int *fds, unsigned long long *offsets,
+ int dests, int *destfd, unsigned long long *destoffsets);
/* for mdmon */
int (*open_new)(struct supertype *c, struct active_array *a,
extern __u32 random32(void);
extern int start_mdmon(int devnum);
+extern int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
+ struct supertype *st, unsigned long stripes,
+ int *fds, unsigned long long *offsets,
+ int dests, int *destfd, unsigned long long *destoffsets);
+
extern char *devnum2devname(int num);
extern void fmt_devname(char *name, int num);
extern int devname2devnum(char *name);
exit(0);
}
+
+/* Some stub functions so super-* can link with us */
+int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape,
+ struct supertype *st, unsigned long blocks,
+ int *fds, unsigned long long *offsets,
+ int dests, int *destfd, unsigned long long *destoffsets)
+{
+ return 0;
+}
return ret_val;
}
+static int imsm_manage_reshape(
+ int afd, struct mdinfo *sra, struct reshape *reshape,
+ struct supertype *st, unsigned long stripes,
+ int *fds, unsigned long long *offsets,
+ int dests, int *destfd, unsigned long long *destoffsets)
+{
+ /* Just use child_monitor for now */
+ return child_monitor(
+ afd, sra, reshape, st, stripes,
+ fds, offsets, dests, destfd, destoffsets);
+}
+
struct superswitch super_imsm = {
#ifndef MDASSEMBLE
.examine_super = examine_super_imsm,
.default_geometry = default_geometry_imsm,
.get_disk_controller_domain = imsm_get_disk_controller_domain,
.reshape_super = imsm_reshape_super,
+ .manage_reshape = imsm_manage_reshape,
.external = 1,
.name = "imsm",