diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2008-11-14 03:44:33 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-11-18 09:08:56 -0500 |
commit | 68aee07f9bad2c830a898cf6d6bfc11ea24efc40 (patch) | |
tree | b0d2e14a19c16ab3022ec94641828df71b560c06 | |
parent | 561ec68e4de7947167937c49c451728e6b19e63b (diff) |
Release old elevator on change elevator
We should release old elevator when change to use a new one.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | drivers/block/xen-blkfront.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index b220c686089d..2d19f0cc47f2 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -338,12 +338,18 @@ wait: | |||
338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | 338 | static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) |
339 | { | 339 | { |
340 | struct request_queue *rq; | 340 | struct request_queue *rq; |
341 | elevator_t *old_e; | ||
341 | 342 | ||
342 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); | 343 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); |
343 | if (rq == NULL) | 344 | if (rq == NULL) |
344 | return -1; | 345 | return -1; |
345 | 346 | ||
346 | elevator_init(rq, "noop"); | 347 | old_e = rq->elevator; |
348 | if (IS_ERR_VALUE(elevator_init(rq, "noop"))) | ||
349 | printk(KERN_WARNING | ||
350 | "blkfront: Switch elevator failed, use default\n"); | ||
351 | else | ||
352 | elevator_exit(old_e); | ||
347 | 353 | ||
348 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | 354 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ |
349 | blk_queue_hardsect_size(rq, sector_size); | 355 | blk_queue_hardsect_size(rq, sector_size); |