From 005bc71e4796b1a4b0194ba7af5d2bd4808888f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Mazur Date: Tue, 14 Feb 2012 17:17:56 +0100 Subject: [PATCH 73/84] lsbd: delay LSBD_QUEUE_MOVE requests Now LBSD_QUEUE_MOVE requests have the lowest priority, except when such request must be written. Signed-off-by: Krzysztof Mazur --- drivers/block/lsbd.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/block/lsbd.c b/drivers/block/lsbd.c index 1f86572..db467ea 100644 --- a/drivers/block/lsbd.c +++ b/drivers/block/lsbd.c @@ -2195,9 +2195,14 @@ static struct lsbd_request *lsbd_request_dequeue(struct lsbd *p, int throttle) /* reserve */ min_clean_sects += LSBD_CLEAN_LOW * data_sects; - for (i = 0; i < LSBD_QUEUE_COUNT; i++) { - can_throttle = 1; + for (i = 0; i <= LSBD_QUEUE_COUNT; i++) { + unsigned int queue; + + queue = i; + if (queue == LSBD_QUEUE_COUNT) + queue = LSBD_QUEUE_MOVE; + can_throttle = 1; /* never throttle below LSBD_CLEAN_LOW clean blocks */ if (clean_blocks < LSBD_CLEAN_LOW) can_throttle = 0; @@ -2206,6 +2211,17 @@ static struct lsbd_request *lsbd_request_dequeue(struct lsbd *p, int throttle) if (min_clean_sects >= clean_blocks * data_sects) can_throttle = 0; + /* + * if handing of LSBD_QUEUE_MOVE queue is not required + * it's better to delay those requests. + */ + if ((i == LSBD_QUEUE_MOVE) && can_throttle) { + if (p->wqueue_qlen[LSBD_QUEUE_HIGH] > 0) + continue; + if (p->wqueue_qlen[LSBD_QUEUE_NORMAL] > 0) + continue; + } + /* never throttle when there are high-priority requests */ if (p->wqueue_qlen[LSBD_QUEUE_HIGH]) can_throttle = 0; @@ -2222,8 +2238,8 @@ static struct lsbd_request *lsbd_request_dequeue(struct lsbd *p, int throttle) if (throttle && can_throttle) break; - if (!list_empty(&p->wqueue[i])) { - r = list_entry(p->wqueue[i].next, struct lsbd_request, + if (!list_empty(&p->wqueue[queue])) { + r = list_entry(p->wqueue[queue].next, struct lsbd_request, list); __lsbd_req_remove(p, r); break; -- 1.8.4.652.g0d6e0ce