aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-05-09 05:35:39 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:57 -0400
commit5b479c91da90eef605f851508744bfe8269591a0 (patch)
treed7c2844926d96d794d66b974b300eba2d047465e /drivers/md
parent08a02ecd28bad35a47357e611044dcbeab06e3d7 (diff)
md: improve partition detection in md array
md currently uses ->media_changed to make sure rescan_partitions is call on md array after they are assembled. However that doesn't happen until the array is opened, which is later than some people would like. So use blkdev_ioctl to do the rescan immediately that the array has been assembled. This means we can remove all the ->change infrastructure as it was only used to trigger a partition rescan. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c26
-rw-r--r--drivers/md/raid1.c1
-rw-r--r--drivers/md/raid5.c2
3 files changed, 8 insertions, 21 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 65814b0340cb..2901d0c0ee9e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3104,6 +3104,7 @@ static int do_md_run(mddev_t * mddev)
3104 struct gendisk *disk; 3104 struct gendisk *disk;
3105 struct mdk_personality *pers; 3105 struct mdk_personality *pers;
3106 char b[BDEVNAME_SIZE]; 3106 char b[BDEVNAME_SIZE];
3107 struct block_device *bdev;
3107 3108
3108 if (list_empty(&mddev->disks)) 3109 if (list_empty(&mddev->disks))
3109 /* cannot run an array with no devices.. */ 3110 /* cannot run an array with no devices.. */
@@ -3331,7 +3332,13 @@ static int do_md_run(mddev_t * mddev)
3331 md_wakeup_thread(mddev->thread); 3332 md_wakeup_thread(mddev->thread);
3332 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ 3333 md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
3333 3334
3334 mddev->changed = 1; 3335 bdev = bdget_disk(mddev->gendisk, 0);
3336 if (bdev) {
3337 bd_set_size(bdev, mddev->array_size << 1);
3338 blkdev_ioctl(bdev->bd_inode, NULL, BLKRRPART, 0);
3339 bdput(bdev);
3340 }
3341
3335 md_new_event(mddev); 3342 md_new_event(mddev);
3336 kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); 3343 kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE);
3337 return 0; 3344 return 0;
@@ -3453,7 +3460,6 @@ static int do_md_stop(mddev_t * mddev, int mode)
3453 mddev->pers = NULL; 3460 mddev->pers = NULL;
3454 3461
3455 set_capacity(disk, 0); 3462 set_capacity(disk, 0);
3456 mddev->changed = 1;
3457 3463
3458 if (mddev->ro) 3464 if (mddev->ro)
3459 mddev->ro = 0; 3465 mddev->ro = 0;
@@ -4593,20 +4599,6 @@ static int md_release(struct inode *inode, struct file * file)
4593 return 0; 4599 return 0;
4594} 4600}
4595 4601
4596static int md_media_changed(struct gendisk *disk)
4597{
4598 mddev_t *mddev = disk->private_data;
4599
4600 return mddev->changed;
4601}
4602
4603static int md_revalidate(struct gendisk *disk)
4604{
4605 mddev_t *mddev = disk->private_data;
4606
4607 mddev->changed = 0;
4608 return 0;
4609}
4610static struct block_device_operations md_fops = 4602static struct block_device_operations md_fops =
4611{ 4603{
4612 .owner = THIS_MODULE, 4604 .owner = THIS_MODULE,
@@ -4614,8 +4606,6 @@ static struct block_device_operations md_fops =
4614 .release = md_release, 4606 .release = md_release,
4615 .ioctl = md_ioctl, 4607 .ioctl = md_ioctl,
4616 .getgeo = md_getgeo, 4608 .getgeo = md_getgeo,
4617 .media_changed = md_media_changed,
4618 .revalidate_disk= md_revalidate,
4619}; 4609};
4620 4610
4621static int md_thread(void * arg) 4611static int md_thread(void * arg)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 97ee870b265d..1b7130cad21f 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2063,7 +2063,6 @@ static int raid1_resize(mddev_t *mddev, sector_t sectors)
2063 */ 2063 */
2064 mddev->array_size = sectors>>1; 2064 mddev->array_size = sectors>>1;
2065 set_capacity(mddev->gendisk, mddev->array_size << 1); 2065 set_capacity(mddev->gendisk, mddev->array_size << 1);
2066 mddev->changed = 1;
2067 if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) { 2066 if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) {
2068 mddev->recovery_cp = mddev->size << 1; 2067 mddev->recovery_cp = mddev->size << 1;
2069 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 2068 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 061375ee6592..a72e70ad0975 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3864,7 +3864,6 @@ static int raid5_resize(mddev_t *mddev, sector_t sectors)
3864 sectors &= ~((sector_t)mddev->chunk_size/512 - 1); 3864 sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
3865 mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1; 3865 mddev->array_size = (sectors * (mddev->raid_disks-conf->max_degraded))>>1;
3866 set_capacity(mddev->gendisk, mddev->array_size << 1); 3866 set_capacity(mddev->gendisk, mddev->array_size << 1);
3867 mddev->changed = 1;
3868 if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) { 3867 if (sectors/2 > mddev->size && mddev->recovery_cp == MaxSector) {
3869 mddev->recovery_cp = mddev->size << 1; 3868 mddev->recovery_cp = mddev->size << 1;
3870 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3869 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -3999,7 +3998,6 @@ static void end_reshape(raid5_conf_t *conf)
3999 conf->mddev->array_size = conf->mddev->size * 3998 conf->mddev->array_size = conf->mddev->size *
4000 (conf->raid_disks - conf->max_degraded); 3999 (conf->raid_disks - conf->max_degraded);
4001 set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1); 4000 set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1);
4002 conf->mddev->changed = 1;
4003 4001
4004 bdev = bdget_disk(conf->mddev->gendisk, 0); 4002 bdev = bdget_disk(conf->mddev->gendisk, 0);
4005 if (bdev) { 4003 if (bdev) {