public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Release old elevator on change elevator
@ 2008-11-14  8:36 Zhaolei
  2008-11-14  8:40 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Zhaolei @ 2008-11-14  8:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, jeremy

We should release old elevator when change to use a new one.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 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 b220c68..2d19f0c 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);
-- 
1.5.5.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Release old elevator on change elevator
  2008-11-14  8:36 [PATCH] Release old elevator on change elevator Zhaolei
@ 2008-11-14  8:40 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2008-11-14  8:40 UTC (permalink / raw)
  To: Zhaolei; +Cc: linux-kernel, jeremy

On Fri, Nov 14 2008, Zhaolei wrote:
> We should release old elevator when change to use a new one.
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  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 b220c68..2d19f0c 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);
> -- 
> 1.5.5.3

I thought we'd already switched that to the nonrot flag, but that is
merged up for 2.6.29. So this looks appropriate for 2.6.28, I'll queue
it up.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-14  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-14  8:36 [PATCH] Release old elevator on change elevator Zhaolei
2008-11-14  8:40 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox