The structure “struct md_personality” is the one which contains information about a RAID level. It is defined in md.h . You’ll find below some explanations about each member of the structure.
[code lang=”c”]
char *name; //Name of the level int level; //Number related to the level, negative level are for "special one", for example the linear level is -1 struct list_head l i s t ; //Linked list of all MD personnalities. struct module *owner; //Pointer to the Linux module managing this level /∗* Do a block I/O operation * @param mddev structure representing the array * @param bio Bock I/O representing the operation to do */ void (*make_request)(struct mddev *mddev, struct bio* bio); /** Build and assemble a RAID array * @param mddev structure representing the array */ int (*run)(struct mddev *mddev); /** Disassemble an array * @param mddev structure representing the array */ int (*stop)(struct mddev *mddev); /** Write some status informations to a file * @param seq virtual file * @param mddev structure representing the array */ void (*status)(struct seq_file *seq, struct mddev *mddev); /** Function called when an error occur in the MD subsystem. * The usual way to run it is to call md_error() inside a md module, which will set some flags and start the recovery thread, and call this error_handler * @param mddev structure representing the array * @param rdev The physical drive responsible for the failure if applicable void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev); /** Add a disk while the array is still running * @param mddev structure representing the array * @param rdev the physical disk to add */ int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev); /** Remove a disk while the array is still running * @param mddev structure representing the array * @param number index of the disk to remove */ int (*hot_remove_disk) (struct mddev *mddev, int number); /** Return the number of active spare drive. * @param mddev structure representing the array */ int (*spare_active) (struct mddev *mddev); /** Handle a re-synchronization request for some sector * @param mddev structure representing the array * @param sector_nr Sector to synchronize * @param skipped Will be set to 1 if the sync was skipped * @param go_faster If false, will sleep interruptible to throttle resync */ sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster); /** Resize an array * @param mddev structure representing the array * @param sectors new size */ int (*resize) (struct mddev *mddev, sector_t sectors); /** Return the size of the array. If sectors and raid_disks are not zero, size is computed using those numbers instead of the real ones. */ sector_t (*size) (struct mddev *mddev, sector_t sectors, int raid_disks); /** Check_reshape Reshape an array after adding or removing some disks */ int (*check_reshape) (struct mddev *mddev); // unused int (*start_reshape) (struct mddev *mddev); void (*finish_reshape) (struct mddev *mddev); /** quiesce moves between quiescence states * 0 - fully active * 1 - no new requests allowed * others - reserved */ void (*quiesce) (struct mddev *mddev, int state); /** takeover is used to transition an array from one * personality to another. The new personality must be able * to handle the data in the current layout. * e.g. 2drive raid1 -> 2drive raid5 * ndrive raid5 -> degraded n+1drive raid6 with special layout * If the takeover succeeds, a new 'private' structure is returned. * This needs to be installed and then ->run used to activate the * array. */ void *(*takeover) (struct mddev *mddev);
[/code]