diff options
Diffstat (limited to 'block/blk-flush.c')
-rw-r--r-- | block/blk-flush.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c index f357f1fc411c..cb4c8440a1fc 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -56,22 +56,38 @@ static struct request *blk_flush_complete_seq(struct request_queue *q, | |||
56 | return next_rq; | 56 | return next_rq; |
57 | } | 57 | } |
58 | 58 | ||
59 | static void blk_flush_complete_seq_end_io(struct request_queue *q, | ||
60 | unsigned seq, int error) | ||
61 | { | ||
62 | bool was_empty = elv_queue_empty(q); | ||
63 | struct request *next_rq; | ||
64 | |||
65 | next_rq = blk_flush_complete_seq(q, seq, error); | ||
66 | |||
67 | /* | ||
68 | * Moving a request silently to empty queue_head may stall the | ||
69 | * queue. Kick the queue in those cases. | ||
70 | */ | ||
71 | if (was_empty && next_rq) | ||
72 | __blk_run_queue(q); | ||
73 | } | ||
74 | |||
59 | static void pre_flush_end_io(struct request *rq, int error) | 75 | static void pre_flush_end_io(struct request *rq, int error) |
60 | { | 76 | { |
61 | elv_completed_request(rq->q, rq); | 77 | elv_completed_request(rq->q, rq); |
62 | blk_flush_complete_seq(rq->q, QUEUE_FSEQ_PREFLUSH, error); | 78 | blk_flush_complete_seq_end_io(rq->q, QUEUE_FSEQ_PREFLUSH, error); |
63 | } | 79 | } |
64 | 80 | ||
65 | static void flush_data_end_io(struct request *rq, int error) | 81 | static void flush_data_end_io(struct request *rq, int error) |
66 | { | 82 | { |
67 | elv_completed_request(rq->q, rq); | 83 | elv_completed_request(rq->q, rq); |
68 | blk_flush_complete_seq(rq->q, QUEUE_FSEQ_DATA, error); | 84 | blk_flush_complete_seq_end_io(rq->q, QUEUE_FSEQ_DATA, error); |
69 | } | 85 | } |
70 | 86 | ||
71 | static void post_flush_end_io(struct request *rq, int error) | 87 | static void post_flush_end_io(struct request *rq, int error) |
72 | { | 88 | { |
73 | elv_completed_request(rq->q, rq); | 89 | elv_completed_request(rq->q, rq); |
74 | blk_flush_complete_seq(rq->q, QUEUE_FSEQ_POSTFLUSH, error); | 90 | blk_flush_complete_seq_end_io(rq->q, QUEUE_FSEQ_POSTFLUSH, error); |
75 | } | 91 | } |
76 | 92 | ||
77 | static void init_flush_request(struct request *rq, struct gendisk *disk) | 93 | static void init_flush_request(struct request *rq, struct gendisk *disk) |