diff options
author | NeilBrown <neilb@suse.de> | 2007-05-09 05:35:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:57 -0400 |
commit | 5b479c91da90eef605f851508744bfe8269591a0 (patch) | |
tree | d7c2844926d96d794d66b974b300eba2d047465e /drivers/md/md.c | |
parent | 08a02ecd28bad35a47357e611044dcbeab06e3d7 (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/md.c')
-rw-r--r-- | drivers/md/md.c | 26 |
1 files changed, 8 insertions, 18 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 | ||
4596 | static int md_media_changed(struct gendisk *disk) | ||
4597 | { | ||
4598 | mddev_t *mddev = disk->private_data; | ||
4599 | |||
4600 | return mddev->changed; | ||
4601 | } | ||
4602 | |||
4603 | static int md_revalidate(struct gendisk *disk) | ||
4604 | { | ||
4605 | mddev_t *mddev = disk->private_data; | ||
4606 | |||
4607 | mddev->changed = 0; | ||
4608 | return 0; | ||
4609 | } | ||
4610 | static struct block_device_operations md_fops = | 4602 | static 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 | ||
4621 | static int md_thread(void * arg) | 4611 | static int md_thread(void * arg) |