md: change hot_remove_disk to take an rdev rather than a number.
Soon an array will be able to have multiple devices with the same raid_disk number (an original and a replacement). So removing a device based on the number won't work. So pass the actual device handle instead. Reviewed-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Родитель
476a7abb9b
Коммит
b8321b68d1
|
@ -2689,7 +2689,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
|
|||
if (rdev->mddev->pers->hot_remove_disk == NULL)
|
||||
return -EINVAL;
|
||||
err = rdev->mddev->pers->
|
||||
hot_remove_disk(rdev->mddev, rdev->raid_disk);
|
||||
hot_remove_disk(rdev->mddev, rdev);
|
||||
if (err)
|
||||
return err;
|
||||
sysfs_unlink_rdev(rdev->mddev, rdev);
|
||||
|
@ -7340,7 +7340,7 @@ static int remove_and_add_spares(struct mddev *mddev)
|
|||
! test_bit(In_sync, &rdev->flags)) &&
|
||||
atomic_read(&rdev->nr_pending)==0) {
|
||||
if (mddev->pers->hot_remove_disk(
|
||||
mddev, rdev->raid_disk)==0) {
|
||||
mddev, rdev) == 0) {
|
||||
sysfs_unlink_rdev(mddev, rdev);
|
||||
rdev->raid_disk = -1;
|
||||
}
|
||||
|
@ -7477,7 +7477,7 @@ void md_check_recovery(struct mddev *mddev)
|
|||
test_bit(Faulty, &rdev->flags) &&
|
||||
atomic_read(&rdev->nr_pending)==0) {
|
||||
if (mddev->pers->hot_remove_disk(
|
||||
mddev, rdev->raid_disk)==0) {
|
||||
mddev, rdev) == 0) {
|
||||
sysfs_unlink_rdev(mddev, rdev);
|
||||
rdev->raid_disk = -1;
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ struct md_personality
|
|||
*/
|
||||
void (*error_handler)(struct mddev *mddev, struct md_rdev *rdev);
|
||||
int (*hot_add_disk) (struct mddev *mddev, struct md_rdev *rdev);
|
||||
int (*hot_remove_disk) (struct mddev *mddev, int number);
|
||||
int (*hot_remove_disk) (struct mddev *mddev, struct md_rdev *rdev);
|
||||
int (*spare_active) (struct mddev *mddev);
|
||||
sector_t (*sync_request)(struct mddev *mddev, sector_t sector_nr, int *skipped, int go_faster);
|
||||
int (*resize) (struct mddev *mddev, sector_t sectors);
|
||||
|
|
|
@ -292,17 +292,16 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int multipath_remove_disk(struct mddev *mddev, int number)
|
||||
static int multipath_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
{
|
||||
struct mpconf *conf = mddev->private;
|
||||
int err = 0;
|
||||
struct md_rdev *rdev;
|
||||
int number = rdev->raid_disk;
|
||||
struct multipath_info *p = conf->multipaths + number;
|
||||
|
||||
print_multipath_conf(conf);
|
||||
|
||||
rdev = p->rdev;
|
||||
if (rdev) {
|
||||
if (rdev == p->rdev) {
|
||||
if (test_bit(In_sync, &rdev->flags) ||
|
||||
atomic_read(&rdev->nr_pending)) {
|
||||
printk(KERN_ERR "hot-remove-disk, slot %d is identified"
|
||||
|
|
|
@ -1327,16 +1327,15 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int raid1_remove_disk(struct mddev *mddev, int number)
|
||||
static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
{
|
||||
struct r1conf *conf = mddev->private;
|
||||
int err = 0;
|
||||
struct md_rdev *rdev;
|
||||
int number = rdev->raid_disk;
|
||||
struct mirror_info *p = conf->mirrors+ number;
|
||||
|
||||
print_conf(conf);
|
||||
rdev = p->rdev;
|
||||
if (rdev) {
|
||||
if (rdev == p->rdev) {
|
||||
if (test_bit(In_sync, &rdev->flags) ||
|
||||
atomic_read(&rdev->nr_pending)) {
|
||||
err = -EBUSY;
|
||||
|
|
|
@ -1385,16 +1385,15 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int raid10_remove_disk(struct mddev *mddev, int number)
|
||||
static int raid10_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
{
|
||||
struct r10conf *conf = mddev->private;
|
||||
int err = 0;
|
||||
struct md_rdev *rdev;
|
||||
int number = rdev->raid_disk;
|
||||
struct mirror_info *p = conf->mirrors+ number;
|
||||
|
||||
print_conf(conf);
|
||||
rdev = p->rdev;
|
||||
if (rdev) {
|
||||
if (rdev == p->rdev) {
|
||||
if (test_bit(In_sync, &rdev->flags) ||
|
||||
atomic_read(&rdev->nr_pending)) {
|
||||
err = -EBUSY;
|
||||
|
|
|
@ -5038,16 +5038,15 @@ static int raid5_spare_active(struct mddev *mddev)
|
|||
return count;
|
||||
}
|
||||
|
||||
static int raid5_remove_disk(struct mddev *mddev, int number)
|
||||
static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
||||
{
|
||||
struct r5conf *conf = mddev->private;
|
||||
int err = 0;
|
||||
struct md_rdev *rdev;
|
||||
int number = rdev->raid_disk;
|
||||
struct disk_info *p = conf->disks + number;
|
||||
|
||||
print_raid5_conf(conf);
|
||||
rdev = p->rdev;
|
||||
if (rdev) {
|
||||
if (rdev == p->rdev) {
|
||||
if (number >= conf->raid_disks &&
|
||||
conf->reshape_progress == MaxSector)
|
||||
clear_bit(In_sync, &rdev->flags);
|
||||
|
@ -5369,7 +5368,8 @@ static void raid5_finish_reshape(struct mddev *mddev)
|
|||
d < conf->raid_disks - mddev->delta_disks;
|
||||
d++) {
|
||||
struct md_rdev *rdev = conf->disks[d].rdev;
|
||||
if (rdev && raid5_remove_disk(mddev, d) == 0) {
|
||||
if (rdev &&
|
||||
raid5_remove_disk(mddev, rdev) == 0) {
|
||||
sysfs_unlink_rdev(mddev, rdev);
|
||||
rdev->raid_disk = -1;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче