diff options
author | NeilBrown <neilb@suse.de> | 2009-01-08 16:31:08 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-01-08 16:31:08 -0500 |
commit | 8b76539823d71576927e3eb08b395eb6620f628d (patch) | |
tree | 37f9c4da6c861a69b4695ea7818eab2cf6ce95f4 /drivers/md | |
parent | cd2ac9321c26dc7a76455cd2a4df89123fa2b73e (diff) |
md: move allocation of ->queue from mddev_find to md_probe
It is more balanced to just do simple initialisation in mddev_find,
which allocates and links a new md device, and leave all the
more sophisticated allocation to md_probe (which calls mddev_find).
md_probe already allocated the gendisk. It should allocate the
queue too.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1f770c16d435..da838cc32cc9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -221,7 +221,9 @@ static void mddev_put(mddev_t *mddev) | |||
221 | if (!mddev->raid_disks && list_empty(&mddev->disks)) { | 221 | if (!mddev->raid_disks && list_empty(&mddev->disks)) { |
222 | list_del(&mddev->all_mddevs); | 222 | list_del(&mddev->all_mddevs); |
223 | spin_unlock(&all_mddevs_lock); | 223 | spin_unlock(&all_mddevs_lock); |
224 | blk_cleanup_queue(mddev->queue); | 224 | if (mddev->queue) |
225 | blk_cleanup_queue(mddev->queue); | ||
226 | mddev->queue = NULL; | ||
225 | if (mddev->sysfs_state) | 227 | if (mddev->sysfs_state) |
226 | sysfs_put(mddev->sysfs_state); | 228 | sysfs_put(mddev->sysfs_state); |
227 | mddev->sysfs_state = NULL; | 229 | mddev->sysfs_state = NULL; |
@@ -275,16 +277,6 @@ static mddev_t * mddev_find(dev_t unit) | |||
275 | new->resync_max = MaxSector; | 277 | new->resync_max = MaxSector; |
276 | new->level = LEVEL_NONE; | 278 | new->level = LEVEL_NONE; |
277 | 279 | ||
278 | new->queue = blk_alloc_queue(GFP_KERNEL); | ||
279 | if (!new->queue) { | ||
280 | kfree(new); | ||
281 | return NULL; | ||
282 | } | ||
283 | /* Can be unlocked because the queue is new: no concurrency */ | ||
284 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, new->queue); | ||
285 | |||
286 | blk_queue_make_request(new->queue, md_fail_request); | ||
287 | |||
288 | goto retry; | 280 | goto retry; |
289 | } | 281 | } |
290 | 282 | ||
@@ -3493,9 +3485,23 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3493 | mddev_put(mddev); | 3485 | mddev_put(mddev); |
3494 | return NULL; | 3486 | return NULL; |
3495 | } | 3487 | } |
3488 | |||
3489 | mddev->queue = blk_alloc_queue(GFP_KERNEL); | ||
3490 | if (!mddev->queue) { | ||
3491 | mutex_unlock(&disks_mutex); | ||
3492 | mddev_put(mddev); | ||
3493 | return NULL; | ||
3494 | } | ||
3495 | /* Can be unlocked because the queue is new: no concurrency */ | ||
3496 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, mddev->queue); | ||
3497 | |||
3498 | blk_queue_make_request(mddev->queue, md_fail_request); | ||
3499 | |||
3496 | disk = alloc_disk(1 << shift); | 3500 | disk = alloc_disk(1 << shift); |
3497 | if (!disk) { | 3501 | if (!disk) { |
3498 | mutex_unlock(&disks_mutex); | 3502 | mutex_unlock(&disks_mutex); |
3503 | blk_cleanup_queue(mddev->queue); | ||
3504 | mddev->queue = NULL; | ||
3499 | mddev_put(mddev); | 3505 | mddev_put(mddev); |
3500 | return NULL; | 3506 | return NULL; |
3501 | } | 3507 | } |