aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-barrier.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-11-27 23:32:07 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-12-29 02:28:45 -0500
commita185eb4bc84155fff35b602ce99602c010de9634 (patch)
treee052052cbac813166b614325b32584d8bb9beff0 /block/blk-barrier.c
parent58eea927d2de43dc6f03d1ba2c46e55854b31540 (diff)
block: fix empty barrier on write-through w/ ordered tag
Empty barrier on write-through (or no cache) w/ ordered tag has no command to execute and without any command to execute ordered tag is never issued to the device and the ordering is never achieved. Force draining for such cases. 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.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index c63044e9c4c0..8eba4e43bb0c 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -166,9 +166,21 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp)
166 * For an empty barrier, there's no actual BAR request, which 166 * For an empty barrier, there's no actual BAR request, which
167 * in turn makes POSTFLUSH unnecessary. Mask them off. 167 * in turn makes POSTFLUSH unnecessary. Mask them off.
168 */ 168 */
169 if (!rq->hard_nr_sectors) 169 if (!rq->hard_nr_sectors) {
170 q->ordered &= ~(QUEUE_ORDERED_DO_BAR | 170 q->ordered &= ~(QUEUE_ORDERED_DO_BAR |
171 QUEUE_ORDERED_DO_POSTFLUSH); 171 QUEUE_ORDERED_DO_POSTFLUSH);
172 /*
173 * Empty barrier on a write-through device w/ ordered
174 * tag has no command to issue and without any command
175 * to issue, ordering by tag can't be used. Drain
176 * instead.
177 */
178 if ((q->ordered & QUEUE_ORDERED_BY_TAG) &&
179 !(q->ordered & QUEUE_ORDERED_DO_PREFLUSH)) {
180 q->ordered &= ~QUEUE_ORDERED_BY_TAG;
181 q->ordered |= QUEUE_ORDERED_BY_DRAIN;
182 }
183 }
172 184
173 /* stash away the original request */ 185 /* stash away the original request */
174 elv_dequeue_request(q, rq); 186 elv_dequeue_request(q, rq);