aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-barrier.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-11-27 23:32:06 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-12-29 02:28:45 -0500
commit58eea927d2de43dc6f03d1ba2c46e55854b31540 (patch)
treebb43f43891a3154741bb6a116dc2956342160f15 /block/blk-barrier.c
parent8f11b3e99a1136fcbb67316c3260f085299c0bff (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/blk-barrier.c')
-rw-r--r--block/blk-barrier.c16
1 files changed, 10 insertions, 6 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