Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172999
b: refs/heads/master
c: 8682e1f
h: refs/heads/master
i:
  172997: d080d50
  172995: 3aa1508
  172991: 0a6e6c2
v: v3
  • Loading branch information
Vivek Goyal authored and Jens Axboe committed Dec 3, 2009
1 parent 3444abb commit eadc2b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 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: 220841906fccafaf4094e87bdb6d252e20cf8c7c
refs/heads/master: 8682e1f15f26dae9a9e8af794d179055fbd81166
30 changes: 20 additions & 10 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,9 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq,
struct cfq_io_context *cic;
struct cfq_queue *cfqq;

/* Deny merge if bio and rq don't belong to same cfq group */
if ((RQ_CFQQ(rq))->cfqg != cfq_get_cfqg(cfqd, 0))
return false;
/*
* Disallow merge of a sync bio into an async request.
*/
Expand Down Expand Up @@ -1698,6 +1701,10 @@ static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
if (!cfqq)
return NULL;

/* If new queue belongs to different cfq_group, don't choose it */
if (cur_cfqq->cfqg != cfqq->cfqg)
return NULL;

/*
* It only makes sense to merge sync queues.
*/
Expand Down Expand Up @@ -2950,29 +2957,32 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
if (!cfqq)
return false;

if (cfq_slice_used(cfqq))
return true;

if (cfq_class_idle(new_cfqq))
return false;

if (cfq_class_idle(cfqq))
return true;

/* Allow preemption only if we are idling on sync-noidle tree */
if (cfqd->serving_type == SYNC_NOIDLE_WORKLOAD &&
cfqq_type(new_cfqq) == SYNC_NOIDLE_WORKLOAD &&
new_cfqq->service_tree->count == 2 &&
RB_EMPTY_ROOT(&cfqq->sort_list))
return true;

/*
* if the new request is sync, but the currently running queue is
* not, let the sync request have priority.
*/
if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
return true;

if (new_cfqq->cfqg != cfqq->cfqg)
return false;

if (cfq_slice_used(cfqq))
return true;

/* Allow preemption only if we are idling on sync-noidle tree */
if (cfqd->serving_type == SYNC_NOIDLE_WORKLOAD &&
cfqq_type(new_cfqq) == SYNC_NOIDLE_WORKLOAD &&
new_cfqq->service_tree->count == 2 &&
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.
Expand Down

0 comments on commit eadc2b9

Please sign in to comment.