2012-06-06 14:15:42

by chetan L

[permalink] [raw]
Subject: [PATCH 1/1] block/nbd: micro-optimization in nbd request completion


Add in-flight cmds to the tail. That way while searching(during request completion),we will always get a hit on the first element.


Signed-off-by: Chetan Loke <[email protected]>
---
drivers/block/nbd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 061427a..8957b9f 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -481,7 +481,7 @@ static void nbd_handle_req(struct nbd_device *nbd, struct request *req)
nbd_end_request(req);
} else {
spin_lock(&nbd->queue_lock);
- list_add(&req->queuelist, &nbd->queue_head);
+ list_add_tail(&req->queuelist, &nbd->queue_head);
spin_unlock(&nbd->queue_lock);
}

--
1.7.5.2


2012-06-06 17:20:36

by Paul Clements

[permalink] [raw]
Subject: Re: [PATCH 1/1] block/nbd: micro-optimization in nbd request completion

Makes sense. Looks good to me.

Acked-by: [email protected]

On Wed, Jun 6, 2012 at 10:15 AM, Chetan Loke <[email protected]> wrote:
>
> Add in-flight cmds to the tail. That way while searching(during request completion),we will always get a hit on the first element.
>
>
> Signed-off-by: Chetan Loke <[email protected]>
> ---
> ?drivers/block/nbd.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 061427a..8957b9f 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -481,7 +481,7 @@ static void nbd_handle_req(struct nbd_device *nbd, struct request *req)
> ? ? ? ? ? ? ? ?nbd_end_request(req);
> ? ? ? ?} else {
> ? ? ? ? ? ? ? ?spin_lock(&nbd->queue_lock);
> - ? ? ? ? ? ? ? list_add(&req->queuelist, &nbd->queue_head);
> + ? ? ? ? ? ? ? list_add_tail(&req->queuelist, &nbd->queue_head);
> ? ? ? ? ? ? ? ?spin_unlock(&nbd->queue_lock);
> ? ? ? ?}
>
> --
> 1.7.5.2
>