diff options
Diffstat (limited to 'block/blk-barrier.c')
-rw-r--r-- | block/blk-barrier.c | 16 |
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 |