Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242239
b: refs/heads/master
c: 9d5a4e9
h: refs/heads/master
i:
  242237: 1bb3d13
  242235: 3383c1e
  242231: e5f3abc
  242223: 07d2170
  242207: 3fb2956
  242175: 039da57
v: v3
  • Loading branch information
Mike Snitzer authored and Jens Axboe committed Feb 11, 2011
1 parent daa4926 commit 7dab264
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 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: ae1b1539622fb46e51b4d13b3f9e5f4c713f86ae
refs/heads/master: 9d5a4e946ce5352f19400b6370f4cd8e72806278
29 changes: 25 additions & 4 deletions trunk/block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,25 @@ static void freed_request(struct request_queue *q, int sync, int priv)
__freed_request(q, sync ^ 1);
}

/*
* Determine if elevator data should be initialized when allocating the
* request associated with @bio.
*/
static bool blk_rq_should_init_elevator(struct bio *bio)
{
if (!bio)
return true;

/*
* Flush requests do not use the elevator so skip initialization.
* This allows a request to share the flush and elevator data.
*/
if (bio->bi_rw & (REQ_FLUSH | REQ_FUA))
return false;

return true;
}

/*
* Get a free request, queue_lock must be held.
* Returns NULL on failure, with queue_lock held.
Expand All @@ -749,7 +768,7 @@ static struct request *get_request(struct request_queue *q, int rw_flags,
struct request_list *rl = &q->rq;
struct io_context *ioc = NULL;
const bool is_sync = rw_is_sync(rw_flags) != 0;
int may_queue, priv;
int may_queue, priv = 0;

may_queue = elv_may_queue(q, rw_flags);
if (may_queue == ELV_MQUEUE_NO)
Expand Down Expand Up @@ -793,9 +812,11 @@ static struct request *get_request(struct request_queue *q, int rw_flags,
rl->count[is_sync]++;
rl->starved[is_sync] = 0;

priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
if (priv)
rl->elvpriv++;
if (blk_rq_should_init_elevator(bio)) {
priv = !test_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
if (priv)
rl->elvpriv++;
}

if (blk_queue_io_stat(q))
rw_flags |= REQ_IO_STAT;
Expand Down

0 comments on commit 7dab264

Please sign in to comment.