aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-barrier.c16
-rw-r--r--block/elevator.c8
-rw-r--r--include/linux/blkdev.h1
3 files changed, 10 insertions, 15 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
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 3c7078e0129d..41bbadfd17f6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -596,7 +596,6 @@ enum {
596#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 596#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
597#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) 597#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
598#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 598#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
599#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
600/* rq->queuelist of dequeued request must be list_empty() */ 599/* rq->queuelist of dequeued request must be list_empty() */
601#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 600#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
602 601