extern int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd);
extern int sysfs_disk_to_sg(int fd);
extern int sysfs_disk_to_scsi_id(int fd, __u32 *id);
+extern int sysfs_unique_holder(int devnum, long rdev);
extern int save_stripes(int *source, unsigned long long *offsets,
* The determination is made either by:
* load_super being given a 'component' string.
* validate_geometry determining what to create.
- * getinfo_super_n really needs to be removed..
+ * The info includes both array information and device information.
+ * The particular device should be:
+ * The last device added by add_to_super
+ * The device the metadata was loaded from by load_super
*/
void (*getinfo_super)(struct supertype *st, struct mdinfo *info);
- void (*getinfo_super_n)(struct supertype *st, struct mdinfo *info);
/* Check if the given metadata is flagged as belonging to "this"
* host. For arrays that don't determine a minor-number, this
void (*locate_bitmap)(struct supertype *st, int fd);
int (*write_bitmap)(struct supertype *st, int fd);
void (*free_super)(struct supertype *st);
+
+ /* validate_geometry is called with an st returned by
+ * match_metadata_desc.
+ * It should check that the geometry described in compatible with
+ * the metadata type. It will be called repeatedly as devices
+ * added to validate changing size and new devices. If there are
+ * inter-device dependencies, it should record sufficient details
+ * so these can be validated.
+ */
int (*validate_geometry)(struct supertype *st, int level, int layout,
int raiddisks,
int chunk, unsigned long long size,
void (*sync_metadata)(struct supertype *st);
void (*process_update)(struct supertype *st,
struct metadata_update *update);
+ void (*prepare_update)(struct supertype *st,
+ struct metadata_update *update);
/* activate_spare will check if the array is degraded and, if it
* is, try to find some spare space in the container.
extern struct superswitch super_imsm;
+struct metadata_update {
+ int len;
+ char *buf;
+ void *space; /* allocated space that monitor will use */
+ struct metadata_update *next;
+};
+
/* A supertype holds a particular collection of metadata.
* It identifies the metadata type by the superswitch, and the particular
* sub-version of that metadata type.
int minor_version;
int max_devs;
int container_dev; /* devnum of container */
+ char subarray[32]; /* name of array inside container */
void *sb;
void *info;
+ struct metadata_update *updates;
+ struct metadata_update **update_tail;
+
/* extra stuff used by mdmon */
struct active_array *arrays;
int sock; /* listen to external programs */
- int mgr_pipe[2]; /* communicate between threads */
- int mon_pipe[2]; /* communicate between threads */
int devnum;
char *devname; /* e.g. md0. This appears in metadata_verison:
* external:/md0/12
};
-extern struct supertype supertype_container_member;
extern struct supertype *super_by_fd(int fd);
extern struct supertype *guess_super(int fd);
extern struct supertype *dup_super(struct supertype *st);
extern void remove_partitions(int fd);
extern unsigned long long calc_array_size(int level, int raid_disks, int layout,
int chunksize, unsigned long long devsize);
+extern int flush_metadata_updates(struct supertype *st);
+extern void append_metadata_update(struct supertype *st, void *buf, int len);
extern char *human_size(long long bytes);