Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block
[linux-2.6.git] / block / blk.h
index f864012..1e675e5 100644 (file)
@@ -51,6 +51,8 @@ static inline void blk_clear_rq_complete(struct request *rq)
  */
 #define ELV_ON_HASH(rq)                (!hlist_unhashed(&(rq)->hash))
 
+struct request *blk_do_flush(struct request_queue *q, struct request *rq);
+
 static inline struct request *__elv_next_request(struct request_queue *q)
 {
        struct request *rq;
@@ -58,7 +60,11 @@ static inline struct request *__elv_next_request(struct request_queue *q)
        while (1) {
                while (!list_empty(&q->queue_head)) {
                        rq = list_entry_rq(q->queue_head.next);
-                       if (blk_do_ordered(q, &rq))
+                       if (!(rq->cmd_flags & (REQ_FLUSH | REQ_FUA)) ||
+                           rq == &q->flush_rq)
+                               return rq;
+                       rq = blk_do_flush(q, rq);
+                       if (rq)
                                return rq;
                }