From 6b5bc3795a36072d89afd87d6ee2ec723a022b5b Mon Sep 17 00:00:00 2001 From: Krzysztof Mazur Date: Sat, 11 Feb 2012 22:19:16 +0100 Subject: [PATCH 67/84] lsbd: add per write queue length This patch adds separate per write queue number of elements counters. Signed-off-by: Krzysztof Mazur --- drivers/block/lsbd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/block/lsbd.c b/drivers/block/lsbd.c index 45240e0..94bdc59 100644 --- a/drivers/block/lsbd.c +++ b/drivers/block/lsbd.c @@ -109,6 +109,7 @@ struct lsbd { spinlock_t wqueue_lock; struct list_head wqueue[LSBD_QUEUE_COUNT]; + unsigned int wqueue_qlen[LSBD_QUEUE_COUNT]; wait_queue_head_t wqueue_wait; unsigned int wqueue_len; unsigned int blocks_to_write; @@ -1595,6 +1596,7 @@ static int lsbd_queue_bh(struct lsbd *p, struct buffer_head *bh, spin_lock_irqsave(&p->wqueue_lock, flags); list_add_tail(&r->list, &p->wqueue[prio]); + p->wqueue_qlen[prio]++; if (!p->wqueue_len) need_wakeup = 1; p->wqueue_len++; @@ -2131,6 +2133,7 @@ static struct lsbd_request *lsbd_request_dequeue(struct lsbd *p, int throttle) r = list_entry(p->wqueue[i].next, struct lsbd_request, list); list_del(&r->list); + p->wqueue_qlen[i]--; p->wqueue_len--; break; } @@ -2565,8 +2568,10 @@ int __init lsbd_init_module(void) struct lsbd *p = &lsbd_dev[i]; unsigned int j; - for (j = 0; j < LSBD_QUEUE_COUNT; j++) + for (j = 0; j < LSBD_QUEUE_COUNT; j++) { INIT_LIST_HEAD(&p->wqueue[j]); + p->wqueue_qlen[j] = 0; + } p->id = i; spin_lock_init(&p->lock); -- 1.8.4.652.g0d6e0ce