diff options
author | Tejun Heo <tj@kernel.org> | 2008-11-27 23:32:06 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-12-29 02:28:45 -0500 |
commit | 58eea927d2de43dc6f03d1ba2c46e55854b31540 (patch) | |
tree | bb43f43891a3154741bb6a116dc2956342160f15 /block | |
parent | 8f11b3e99a1136fcbb67316c3260f085299c0bff (diff) |
block: simplify empty barrier implementation
Empty barrier required special handling in __elv_next_request() to
complete it without letting the low level driver see it.
With previous changes, barrier code is now flexible enough to skip the
BAR step using the same barrier sequence selection mechanism. Drop
the special handling and mask off q->ordered from start_ordered().
Remove blk_empty_barrier() test which now has no user.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-barrier.c | 16 | ||||
-rw-r--r-- | block/elevator.c | 8 |
2 files changed, 10 insertions, 14 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c index b03d88013e1e..c63044e9c4c0 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c | |||
@@ -162,6 +162,14 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp) | |||
162 | q->ordered = q->next_ordered; | 162 | q->ordered = q->next_ordered; |
163 | q->ordseq |= QUEUE_ORDSEQ_STARTED; | 163 | q->ordseq |= QUEUE_ORDSEQ_STARTED; |
164 | 164 | ||
165 | /* | ||
166 | * For an empty barrier, there's no actual BAR request, which | ||
167 | * in turn makes POSTFLUSH unnecessary. Mask them off. | ||
168 | */ | ||
169 | if (!rq->hard_nr_sectors) | ||
170 | q->ordered &= ~(QUEUE_ORDERED_DO_BAR | | ||
171 | QUEUE_ORDERED_DO_POSTFLUSH); | ||
172 | |||
165 | /* stash away the original request */ | 173 | /* stash away the original request */ |
166 | elv_dequeue_request(q, rq); | 174 | elv_dequeue_request(q, rq); |
167 | q->orig_bar_rq = rq; | 175 | q->orig_bar_rq = rq; |
@@ -171,13 +179,9 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp) | |||
171 | * Queue ordered sequence. As we stack them at the head, we | 179 | * Queue ordered sequence. As we stack them at the head, we |
172 | * need to queue in reverse order. Note that we rely on that | 180 | * need to queue in reverse order. Note that we rely on that |
173 | * no fs request uses ELEVATOR_INSERT_FRONT and thus no fs | 181 | * no fs request uses ELEVATOR_INSERT_FRONT and thus no fs |
174 | * request gets inbetween ordered sequence. If this request is | 182 | * request gets inbetween ordered sequence. |
175 | * an empty barrier, we don't need to do a postflush ever since | ||
176 | * there will be no data written between the pre and post flush. | ||
177 | * Hence a single flush will suffice. | ||
178 | */ | 183 | */ |
179 | if ((q->ordered & QUEUE_ORDERED_DO_POSTFLUSH) && | 184 | if (q->ordered & QUEUE_ORDERED_DO_POSTFLUSH) { |
180 | !blk_empty_barrier(q->orig_bar_rq)) { | ||
181 | queue_flush(q, QUEUE_ORDERED_DO_POSTFLUSH); | 185 | queue_flush(q, QUEUE_ORDERED_DO_POSTFLUSH); |
182 | rq = &q->post_flush_rq; | 186 | rq = &q->post_flush_rq; |
183 | } else | 187 | } else |
diff --git a/block/elevator.c b/block/elevator.c index 261ffaaf47bd..ff60177a3bab 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -755,14 +755,6 @@ struct request *elv_next_request(struct request_queue *q) | |||
755 | int ret; | 755 | int ret; |
756 | 756 | ||
757 | while ((rq = __elv_next_request(q)) != NULL) { | 757 | while ((rq = __elv_next_request(q)) != NULL) { |
758 | /* | ||
759 | * Kill the empty barrier place holder, the driver must | ||
760 | * not ever see it. | ||
761 | */ | ||
762 | if (blk_empty_barrier(rq)) { | ||
763 | __blk_end_request(rq, 0, blk_rq_bytes(rq)); | ||
764 | continue; | ||
765 | } | ||
766 | if (!(rq->cmd_flags & REQ_STARTED)) { | 758 | if (!(rq->cmd_flags & REQ_STARTED)) { |
767 | /* | 759 | /* |
768 | * This is the first time the device driver | 760 | * This is the first time the device driver |