Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20088
b: refs/heads/master
c: 30e9656
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 8, 2006
1 parent 19194d2 commit e36bcc3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 35 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: e5ea0a9fca5612808839dd4bcc41c46fc02451f9
refs/heads/master: 30e9656cc340035e102fea46e1908689494b042d
70 changes: 38 additions & 32 deletions trunk/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void elv_requeue_request(request_queue_t *q, struct request *rq)

rq->flags &= ~REQ_STARTED;

__elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE, 0);
elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE);
}

static void elv_drain_elevator(request_queue_t *q)
Expand All @@ -310,41 +310,11 @@ static void elv_drain_elevator(request_queue_t *q)
}
}

void __elv_add_request(request_queue_t *q, struct request *rq, int where,
int plug)
void elv_insert(request_queue_t *q, struct request *rq, int where)
{
struct list_head *pos;
unsigned ordseq;

if (q->ordcolor)
rq->flags |= REQ_ORDERED_COLOR;

if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
/*
* toggle ordered color
*/
if (blk_barrier_rq(rq))
q->ordcolor ^= 1;

/*
* barriers implicitly indicate back insertion
*/
if (where == ELEVATOR_INSERT_SORT)
where = ELEVATOR_INSERT_BACK;

/*
* this request is scheduling boundary, update end_sector
*/
if (blk_fs_request(rq)) {
q->end_sector = rq_end_sector(rq);
q->boundary_rq = rq;
}
} else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
where = ELEVATOR_INSERT_BACK;

if (plug)
blk_plug_device(q);

rq->q = q;

switch (where) {
Expand Down Expand Up @@ -425,6 +395,42 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
}
}

void __elv_add_request(request_queue_t *q, struct request *rq, int where,
int plug)
{
if (q->ordcolor)
rq->flags |= REQ_ORDERED_COLOR;

if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)) {
/*
* toggle ordered color
*/
if (blk_barrier_rq(rq))
q->ordcolor ^= 1;

/*
* barriers implicitly indicate back insertion
*/
if (where == ELEVATOR_INSERT_SORT)
where = ELEVATOR_INSERT_BACK;

/*
* this request is scheduling boundary, update
* end_sector
*/
if (blk_fs_request(rq)) {
q->end_sector = rq_end_sector(rq);
q->boundary_rq = rq;
}
} else if (!(rq->flags & REQ_ELVPRIV) && where == ELEVATOR_INSERT_SORT)
where = ELEVATOR_INSERT_BACK;

if (plug)
blk_plug_device(q);

elv_insert(q, rq, where);
}

void elv_add_request(request_queue_t *q, struct request *rq, int where,
int plug)
{
Expand Down
4 changes: 2 additions & 2 deletions trunk/block/ll_rw_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static void queue_flush(request_queue_t *q, unsigned which)
rq->end_io = end_io;
q->prepare_flush_fn(q, rq);

__elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
elv_insert(q, rq, ELEVATOR_INSERT_FRONT);
}

static inline struct request *start_ordered(request_queue_t *q,
Expand Down Expand Up @@ -490,7 +490,7 @@ static inline struct request *start_ordered(request_queue_t *q,
else
q->ordseq |= QUEUE_ORDSEQ_POSTFLUSH;

__elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
elv_insert(q, rq, ELEVATOR_INSERT_FRONT);

if (q->ordered & QUEUE_ORDERED_PREFLUSH) {
queue_flush(q, QUEUE_ORDERED_PREFLUSH);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/elevator.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct elevator_queue
extern void elv_dispatch_sort(request_queue_t *, struct request *);
extern void elv_add_request(request_queue_t *, struct request *, int, int);
extern void __elv_add_request(request_queue_t *, struct request *, int, int);
extern void elv_insert(request_queue_t *, struct request *, int);
extern int elv_merge(request_queue_t *, struct request **, struct bio *);
extern void elv_merge_requests(request_queue_t *, struct request *,
struct request *);
Expand Down

0 comments on commit e36bcc3

Please sign in to comment.