Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263151
b: refs/heads/master
c: b53d1ed
h: refs/heads/master
i:
  263149: 9990249
  263147: 1251716
  263143: 978250c
  263135: e8ff49b
v: v3
  • Loading branch information
Jens Axboe committed Aug 19, 2011
1 parent cb72e03 commit 6bccc8b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4853abaae7e4a2af938115ce9071ef8684fb7af4
refs/heads/master: b53d1ed734a2b9af8da115b836b658daa7d47a48
18 changes: 18 additions & 0 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ struct cfq_queue {
unsigned long slice_end;
long slice_resid;

/* pending metadata requests */
int meta_pending;
/* number of requests that are on the dispatch list or inside driver */
int dispatched;

Expand Down Expand Up @@ -682,6 +684,9 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
if (rq_is_sync(rq1) != rq_is_sync(rq2))
return rq_is_sync(rq1) ? rq1 : rq2;

if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
return rq1->cmd_flags & REQ_META ? rq1 : rq2;

s1 = blk_rq_pos(rq1);
s2 = blk_rq_pos(rq2);

Expand Down Expand Up @@ -1607,6 +1612,10 @@ static void cfq_remove_request(struct request *rq)
cfqq->cfqd->rq_queued--;
cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
rq_data_dir(rq), rq_is_sync(rq));
if (rq->cmd_flags & REQ_META) {
WARN_ON(!cfqq->meta_pending);
cfqq->meta_pending--;
}
}

static int cfq_merge(struct request_queue *q, struct request **req,
Expand Down Expand Up @@ -3359,6 +3368,13 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
RB_EMPTY_ROOT(&cfqq->sort_list))
return true;

/*
* So both queues are sync. Let the new request get disk time if
* it's a metadata request and the current queue is doing regular IO.
*/
if ((rq->cmd_flags & REQ_META) && !cfqq->meta_pending)
return true;

/*
* Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
*/
Expand Down Expand Up @@ -3423,6 +3439,8 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
struct cfq_io_context *cic = RQ_CIC(rq);

cfqd->rq_queued++;
if (rq->cmd_flags & REQ_META)
cfqq->meta_pending++;

cfq_update_io_thinktime(cfqd, cfqq, cic);
cfq_update_io_seektime(cfqd, cfqq, rq);
Expand Down

0 comments on commit 6bccc8b

Please sign in to comment.