Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37538
b: refs/heads/master
c: 5380a10
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe authored and Jens Axboe committed Sep 30, 2006
1 parent 44d1215 commit ba80c38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 43 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: 8840faa1eebba22a9e2f86acddc0cf5145937df4
refs/heads/master: 5380a101d33d1d3a32c6b6bd2e17e5dd835842b0
58 changes: 16 additions & 42 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ struct cfq_rq {

struct cfq_queue *cfq_queue;
struct cfq_io_context *io_context;

unsigned int crq_flags;
};

enum cfqq_state_flags {
Expand Down Expand Up @@ -221,27 +219,6 @@ CFQ_CFQQ_FNS(idle_window);
CFQ_CFQQ_FNS(prio_changed);
#undef CFQ_CFQQ_FNS

enum cfq_rq_state_flags {
CFQ_CRQ_FLAG_is_sync = 0,
};

#define CFQ_CRQ_FNS(name) \
static inline void cfq_mark_crq_##name(struct cfq_rq *crq) \
{ \
crq->crq_flags |= (1 << CFQ_CRQ_FLAG_##name); \
} \
static inline void cfq_clear_crq_##name(struct cfq_rq *crq) \
{ \
crq->crq_flags &= ~(1 << CFQ_CRQ_FLAG_##name); \
} \
static inline int cfq_crq_##name(const struct cfq_rq *crq) \
{ \
return (crq->crq_flags & (1 << CFQ_CRQ_FLAG_##name)) != 0; \
}

CFQ_CRQ_FNS(is_sync);
#undef CFQ_CRQ_FNS

static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short);
static void cfq_dispatch_insert(request_queue_t *, struct cfq_rq *);
static struct cfq_queue *cfq_get_queue(struct cfq_data *cfqd, unsigned int key, struct task_struct *tsk, gfp_t gfp_mask);
Expand Down Expand Up @@ -290,9 +267,9 @@ cfq_choose_req(struct cfq_data *cfqd, struct cfq_rq *crq1, struct cfq_rq *crq2)
if (crq2 == NULL)
return crq1;

if (cfq_crq_is_sync(crq1) && !cfq_crq_is_sync(crq2))
if (rq_is_sync(crq1->request) && !rq_is_sync(crq2->request))
return crq1;
else if (cfq_crq_is_sync(crq2) && !cfq_crq_is_sync(crq1))
else if (rq_is_sync(crq2->request) && !rq_is_sync(crq1->request))
return crq2;

s1 = crq1->request->sector;
Expand Down Expand Up @@ -477,7 +454,7 @@ static inline void cfq_del_crq_rb(struct cfq_rq *crq)
{
struct cfq_queue *cfqq = crq->cfq_queue;
struct cfq_data *cfqd = cfqq->cfqd;
const int sync = cfq_crq_is_sync(crq);
const int sync = rq_is_sync(crq->request);

BUG_ON(!cfqq->queued[sync]);
cfqq->queued[sync]--;
Expand All @@ -495,7 +472,7 @@ static void cfq_add_crq_rb(struct cfq_rq *crq)
struct request *rq = crq->request;
struct request *__alias;

cfqq->queued[cfq_crq_is_sync(crq)]++;
cfqq->queued[rq_is_sync(rq)]++;

/*
* looks a little odd, but the first insert might return an alias.
Expand All @@ -508,8 +485,10 @@ static void cfq_add_crq_rb(struct cfq_rq *crq)
static inline void
cfq_reposition_crq_rb(struct cfq_queue *cfqq, struct cfq_rq *crq)
{
elv_rb_del(&cfqq->sort_list, crq->request);
cfqq->queued[cfq_crq_is_sync(crq)]--;
struct request *rq = crq->request;

elv_rb_del(&cfqq->sort_list, rq);
cfqq->queued[rq_is_sync(rq)]--;
cfq_add_crq_rb(crq);
}

Expand Down Expand Up @@ -814,11 +793,11 @@ static void cfq_dispatch_insert(request_queue_t *q, struct cfq_rq *crq)
{
struct cfq_data *cfqd = q->elevator->elevator_data;
struct cfq_queue *cfqq = crq->cfq_queue;
struct request *rq;
struct request *rq = crq->request;

cfq_remove_request(crq->request);
cfqq->on_dispatch[cfq_crq_is_sync(crq)]++;
elv_dispatch_sort(q, crq->request);
cfq_remove_request(rq);
cfqq->on_dispatch[rq_is_sync(rq)]++;
elv_dispatch_sort(q, rq);

rq = list_entry(q->queue_head.prev, struct request, queuelist);
cfqd->last_sector = rq->sector + rq->nr_sectors;
Expand Down Expand Up @@ -1585,7 +1564,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
*/
if (new_cfqq->slice_left < cfqd->cfq_slice_idle)
return 0;
if (cfq_crq_is_sync(crq) && !cfq_cfqq_sync(cfqq))
if (rq_is_sync(crq->request) && !cfq_cfqq_sync(cfqq))
return 1;

return 0;
Expand Down Expand Up @@ -1634,7 +1613,7 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
struct cfq_io_context *cic = crq->io_context;

/*
* check if this request is a better next-serve candidate
* check if this request is a better next-serve candidate)) {
*/
cfqq->next_crq = cfq_choose_req(cfqd, cfqq->next_crq, crq);
BUG_ON(!cfqq->next_crq);
Expand All @@ -1643,7 +1622,7 @@ cfq_crq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
* we never wait for an async request and we don't allow preemption
* of an async request. so just return early
*/
if (!cfq_crq_is_sync(crq)) {
if (!rq_is_sync(crq->request)) {
/*
* sync process issued an async request, if it's waiting
* then expire it and kick rq handling.
Expand Down Expand Up @@ -1709,7 +1688,7 @@ static void cfq_completed_request(request_queue_t *q, struct request *rq)
struct cfq_rq *crq = RQ_DATA(rq);
struct cfq_queue *cfqq = crq->cfq_queue;
struct cfq_data *cfqd = cfqq->cfqd;
const int sync = cfq_crq_is_sync(crq);
const int sync = rq_is_sync(rq);
unsigned long now;

now = jiffies;
Expand Down Expand Up @@ -1905,11 +1884,6 @@ cfq_set_request(request_queue_t *q, struct request *rq, struct bio *bio,
crq->cfq_queue = cfqq;
crq->io_context = cic;

if (is_sync)
cfq_mark_crq_is_sync(crq);
else
cfq_clear_crq_is_sync(crq);

rq->elevator_private = crq;
return 0;
}
Expand Down

0 comments on commit ba80c38

Please sign in to comment.