block: fix flush machinery for stacking drivers with differring flush flags
[linux-2.6.git] / block / blk.h
index 83e4bff..20b900a 100644 (file)
@@ -17,12 +17,13 @@ int blk_rq_append_bio(struct request_queue *q, struct request *rq,
                      struct bio *bio);
 void blk_dequeue_request(struct request *rq);
 void __blk_queue_free_tags(struct request_queue *q);
+bool __blk_end_bidi_request(struct request *rq, int error,
+                           unsigned int nr_bytes, unsigned int bidi_bytes);
 
 void blk_rq_timed_out_timer(unsigned long data);
 void blk_delete_timer(struct request *);
 void blk_add_timer(struct request *);
 void __generic_unplug_device(struct request_queue *);
-void blk_run_queue_async(struct request_queue *q);
 
 /*
  * Internal atomic flags for request handling
@@ -62,6 +63,7 @@ static inline struct request *__elv_next_request(struct request_queue *q)
                        rq = list_entry_rq(q->queue_head.next);
                        return rq;
                }
+
                /*
                 * Flush request is running and flush request isn't queueable
                 * in the drive, we can hold the queue till flush request is
@@ -82,7 +84,8 @@ static inline struct request *__elv_next_request(struct request_queue *q)
                        q->flush_queue_delayed = 1;
                        return NULL;
                }
-               if (!q->elevator->ops->elevator_dispatch_fn(q, 0))
+               if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags) ||
+                   !q->elevator->ops->elevator_dispatch_fn(q, 0))
                        return NULL;
        }
 }