Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320916
b: refs/heads/master
c: 8a5ecdd
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Jun 25, 2012
1 parent 598c290 commit a2626dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b1208b56f31408f7d8381ff5d08e970aa5ee761c
refs/heads/master: 8a5ecdd42862bf87ceab00bf2a15d7eabf58c02d
13 changes: 7 additions & 6 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
if (!list_empty(&q->queue_head) && q->request_fn)
__blk_run_queue(q);

drain |= q->rq.elvpriv;
drain |= q->nr_rqs_elvpriv;

/*
* Unfortunately, requests are queued at and tracked from
Expand All @@ -397,7 +397,7 @@ void blk_drain_queue(struct request_queue *q, bool drain_all)
if (drain_all) {
drain |= !list_empty(&q->queue_head);
for (i = 0; i < 2; i++) {
drain |= q->rq.count[i];
drain |= q->nr_rqs[i];
drain |= q->in_flight[i];
drain |= !list_empty(&q->flush_queue[i]);
}
Expand Down Expand Up @@ -526,7 +526,6 @@ static int blk_init_free_list(struct request_queue *q)

rl->count[BLK_RW_SYNC] = rl->count[BLK_RW_ASYNC] = 0;
rl->starved[BLK_RW_SYNC] = rl->starved[BLK_RW_ASYNC] = 0;
rl->elvpriv = 0;
init_waitqueue_head(&rl->wait[BLK_RW_SYNC]);
init_waitqueue_head(&rl->wait[BLK_RW_ASYNC]);

Expand Down Expand Up @@ -791,9 +790,10 @@ static void freed_request(struct request_queue *q, unsigned int flags)
struct request_list *rl = &q->rq;
int sync = rw_is_sync(flags);

q->nr_rqs[sync]--;
rl->count[sync]--;
if (flags & REQ_ELVPRIV)
rl->elvpriv--;
q->nr_rqs_elvpriv--;

__freed_request(q, sync);

Expand Down Expand Up @@ -902,6 +902,7 @@ static struct request *__get_request(struct request_queue *q, int rw_flags,
if (rl->count[is_sync] >= (3 * q->nr_requests / 2))
return NULL;

q->nr_rqs[is_sync]++;
rl->count[is_sync]++;
rl->starved[is_sync] = 0;

Expand All @@ -917,7 +918,7 @@ static struct request *__get_request(struct request_queue *q, int rw_flags,
*/
if (blk_rq_should_init_elevator(bio) && !blk_queue_bypass(q)) {
rw_flags |= REQ_ELVPRIV;
rl->elvpriv++;
q->nr_rqs_elvpriv++;
if (et->icq_cache && ioc)
icq = ioc_lookup_icq(ioc, q);
}
Expand Down Expand Up @@ -978,7 +979,7 @@ static struct request *__get_request(struct request_queue *q, int rw_flags,
rq->elv.icq = NULL;

spin_lock_irq(q->queue_lock);
rl->elvpriv--;
q->nr_rqs_elvpriv--;
spin_unlock_irq(q->queue_lock);
goto out;

Expand Down
11 changes: 6 additions & 5 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ struct request_list {
* count[], starved[], and wait[] are indexed by
* BLK_RW_SYNC/BLK_RW_ASYNC
*/
int count[2];
int starved[2];
int elvpriv;
mempool_t *rq_pool;
wait_queue_head_t wait[2];
int count[2];
int starved[2];
mempool_t *rq_pool;
wait_queue_head_t wait[2];
};

/*
Expand Down Expand Up @@ -282,6 +281,8 @@ struct request_queue {
struct list_head queue_head;
struct request *last_merge;
struct elevator_queue *elevator;
int nr_rqs[2]; /* # allocated [a]sync rqs */
int nr_rqs_elvpriv; /* # allocated rqs w/ elvpriv */

/*
* the queue request freelist, one for reads and one for writes
Expand Down

0 comments on commit a2626dc

Please sign in to comment.