Commit f39afb82 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Remove used_slot field from per-personality info

This is equivalent to ->rdev != NULL, so it isn't needed.
parent 3e98f2fb
......@@ -288,11 +288,10 @@ static void print_multipath_conf (multipath_conf_t *conf)
for (i = 0; i < MD_SB_DISKS; i++) {
tmp = conf->multipaths + i;
if (tmp->operational || tmp->used_slot)
printk(" disk%d, o:%d, us:%d dev:%s\n",
if (tmp->rdev)
printk(" disk%d, o:%d, dev:%s\n",
i,tmp->operational,
tmp->used_slot,
bdev_partition_name(tmp->rdev->bdev));
bdev_partition_name(tmp->rdev->bdev));
}
}
......@@ -305,10 +304,9 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
print_multipath_conf(conf);
spin_lock_irq(&conf->device_lock);
if (!p->used_slot) {
if (!p->rdev) {
p->rdev = rdev;
p->operational = 1;
p->used_slot = 1;
conf->working_disks++;
err = 0;
}
......@@ -329,7 +327,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
print_multipath_conf(conf);
spin_lock_irq(&conf->device_lock);
if (p->used_slot) {
if (p->rdev) {
if (p->operational ||
(p->rdev && atomic_read(&p->rdev->nr_pending))) {
printk(KERN_ERR "hot-remove-disk, slot %d is identified but is still operational!\n", number);
......@@ -337,7 +335,6 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
goto abort;
}
p->rdev = NULL;
p->used_slot = 0;
err = 0;
}
if (err)
......@@ -497,7 +494,6 @@ static int multipath_run (mddev_t *mddev)
*/
disk->rdev = rdev;
disk->operational = 1;
disk->used_slot = 1;
num_rdevs++;
}
......
......@@ -652,10 +652,10 @@ static void print_conf(conf_t *conf)
for (i = 0; i < MD_SB_DISKS; i++) {
tmp = conf->mirrors + i;
printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n",
i, tmp->spare, tmp->operational,
tmp->used_slot,
bdev_partition_name(tmp->rdev->bdev));
if (tmp->rdev)
printk(" disk %d, s:%d, o:%d, dev:%s\n",
i, tmp->spare, tmp->operational,
bdev_partition_name(tmp->rdev->bdev));
}
}
......@@ -690,7 +690,7 @@ static int raid1_spare_active(mddev_t *mddev)
for (i = 0; i < conf->raid_disks; i++) {
tmp = conf->mirrors + i;
if ((!tmp->operational && !tmp->spare) ||
!tmp->used_slot) {
!tmp->rdev) {
failed_disk = i;
break;
}
......@@ -740,8 +740,6 @@ static int raid1_spare_active(mddev_t *mddev)
* disk. (this means we switch back these values)
*/
if (!sdisk->rdev)
sdisk->used_slot = 0;
/*
* this really activates the spare.
*/
......@@ -813,12 +811,11 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
print_conf(conf);
spin_lock_irq(&conf->device_lock);
if (!p->used_slot) {
if (!p->rdev) {
p->rdev = rdev;
p->operational = 0;
p->write_only = 0;
p->spare = 1;
p->used_slot = 1;
p->head_position = 0;
err = 0;
}
......@@ -838,14 +835,13 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
print_conf(conf);
spin_lock_irq(&conf->device_lock);
if (p->used_slot) {
if (p->rdev) {
if (p->operational ||
(p->rdev && atomic_read(&p->rdev->nr_pending))) {
err = -EBUSY;
goto abort;
}
p->rdev = NULL;
p->used_slot = 0;
err = 0;
}
if (err)
......@@ -1265,7 +1261,6 @@ static int run(mddev_t *mddev)
disk->operational = 0;
disk->write_only = 0;
disk->spare = 0;
disk->used_slot = 1;
disk->head_position = 0;
continue;
}
......@@ -1282,7 +1277,6 @@ static int run(mddev_t *mddev)
disk->operational = 1;
disk->write_only = 0;
disk->spare = 0;
disk->used_slot = 1;
disk->head_position = 0;
conf->working_disks++;
} else {
......@@ -1294,7 +1288,6 @@ static int run(mddev_t *mddev)
disk->operational = 0;
disk->write_only = 0;
disk->spare = 1;
disk->used_slot = 1;
disk->head_position = 0;
}
}
......@@ -1316,16 +1309,13 @@ static int run(mddev_t *mddev)
disk = conf->mirrors + i;
if (!disk->used_slot) {
disk->rdev = NULL;
if (!disk->rdev) {
disk->operational = 0;
disk->write_only = 0;
disk->spare = 0;
disk->used_slot = 1;
disk->head_position = 0;
}
if (!disk->used_slot)
mddev->degraded++;
}
}
/*
......
......@@ -1423,7 +1423,6 @@ static int run (mddev_t *mddev)
disk->operational = 0;
disk->write_only = 0;
disk->spare = 0;
disk->used_slot = 1;
continue;
}
if (rdev->in_sync) {
......@@ -1435,7 +1434,6 @@ static int run (mddev_t *mddev)
disk->rdev = rdev;
disk->operational = 1;
disk->used_slot = 1;
conf->working_disks++;
} else {
......@@ -1448,20 +1446,16 @@ static int run (mddev_t *mddev)
disk->operational = 0;
disk->write_only = 0;
disk->spare = 1;
disk->used_slot = 1;
}
}
for (i = 0; i < conf->raid_disks; i++) {
disk = conf->disks + i;
if (!disk->used_slot) {
disk->rdev = NULL;
if (!disk->rdev) {
disk->operational = 0;
disk->write_only = 0;
disk->spare = 0;
disk->used_slot = 1;
}
}
......@@ -1476,14 +1470,6 @@ static int run (mddev_t *mddev)
conf->algorithm = mddev->layout;
conf->max_nr_stripes = NR_STRIPES;
#if 0
for (i = 0; i < conf->raid_disks; i++) {
if (!conf->disks[i].used_slot) {
MD_BUG();
goto abort;
}
}
#endif
if (!conf->chunk_size || conf->chunk_size % 4) {
printk(KERN_ERR "raid5: invalid chunk size %d for md%d\n", conf->chunk_size, mdidx(mddev));
goto abort;
......@@ -1634,9 +1620,9 @@ static void print_raid5_conf (raid5_conf_t *conf)
for (i = 0; i < conf->working_disks+conf->failed_disks; i++) {
#endif
tmp = conf->disks + i;
printk(" disk %d, s:%d, o:%d, us:%d dev:%s\n",
if (tmp->rdev)
printk(" disk %d, s:%d, o:%d, dev:%s\n",
i, tmp->spare,tmp->operational,
tmp->used_slot,
bdev_partition_name(tmp->rdev->bdev));
}
}
......@@ -1654,7 +1640,7 @@ static int raid5_spare_active(mddev_t *mddev)
for (i = 0; i < conf->raid_disks; i++) {
tmp = conf->disks + i;
if ((!tmp->operational && !tmp->spare) ||
!tmp->used_slot) {
!tmp->rdev) {
failed_disk = i;
break;
}
......@@ -1704,9 +1690,6 @@ static int raid5_spare_active(mddev_t *mddev)
* disk. (this means we switch back these values)
*/
if (!sdisk->rdev)
sdisk->used_slot = 0;
/*
* this really activates the spare.
*/
......@@ -1782,14 +1765,13 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
print_raid5_conf(conf);
spin_lock_irq(&conf->device_lock);
if (p->used_slot) {
if (p->rdev) {
if (p->operational ||
atomic_read(&p->rdev->nr_pending)) {
err = -EBUSY;
goto abort;
}
p->rdev = NULL;
p->used_slot = 0;
err = 0;
}
if (err)
......@@ -1812,13 +1794,12 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
* find the disk ...
*/
if (!p->used_slot) {
if (!p->rdev) {
/* it will be held open by rdev */
p->rdev = rdev;
p->operational = 0;
p->write_only = 0;
p->spare = 1;
p->used_slot = 1;
err = 0;
}
if (err)
......
......@@ -11,8 +11,6 @@ struct multipath_info {
* State bits:
*/
int operational;
int used_slot;
};
struct multipath_private_data {
......
......@@ -15,8 +15,6 @@ struct mirror_info {
int operational;
int write_only;
int spare;
int used_slot;
};
typedef struct r1bio_s r1bio_t;
......
......@@ -196,7 +196,6 @@ struct disk_info {
int operational;
int write_only;
int spare;
int used_slot;
};
struct raid5_private_data {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment