From: Zhaolei Date: Fri, 14 Nov 2008 08:44:33 +0000 (+0100) Subject: Release old elevator on change elevator X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=68aee07f9bad2c830a898cf6d6bfc11ea24efc40;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git Release old elevator on change elevator We should release old elevator when change to use a new one. Signed-off-by: Zhao Lei Signed-off-by: Jens Axboe --- diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index b220c686089..2d19f0cc47f 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -338,12 +338,18 @@ wait: static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) { struct request_queue *rq; + elevator_t *old_e; rq = blk_init_queue(do_blkif_request, &blkif_io_lock); if (rq == NULL) return -1; - elevator_init(rq, "noop"); + old_e = rq->elevator; + if (IS_ERR_VALUE(elevator_init(rq, "noop"))) + printk(KERN_WARNING + "blkfront: Switch elevator failed, use default\n"); + else + elevator_exit(old_e); /* Hard sector size and max sectors impersonate the equiv. hardware. */ blk_queue_hardsect_size(rq, sector_size);