]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - block/blk-settings.c
printk: declare printk_ratelimit_state in ratelimit.h
[net-next-2.6.git] / block / blk-settings.c
index 315b88c8cbbbbc5e6cefd00361d988a4c0b58a8a..701859fb9647c31a505f0218800744e3e6d0a775 100644 (file)
@@ -792,6 +792,26 @@ void blk_queue_update_dma_alignment(struct request_queue *q, int mask)
 }
 EXPORT_SYMBOL(blk_queue_update_dma_alignment);
 
+/**
+ * blk_queue_flush - configure queue's cache flush capability
+ * @q:         the request queue for the device
+ * @flush:     0, REQ_FLUSH or REQ_FLUSH | REQ_FUA
+ *
+ * Tell block layer cache flush capability of @q.  If it supports
+ * flushing, REQ_FLUSH should be set.  If it supports bypassing
+ * write cache for individual writes, REQ_FUA should be set.
+ */
+void blk_queue_flush(struct request_queue *q, unsigned int flush)
+{
+       WARN_ON_ONCE(flush & ~(REQ_FLUSH | REQ_FUA));
+
+       if (WARN_ON_ONCE(!(flush & REQ_FLUSH) && (flush & REQ_FUA)))
+               flush &= ~REQ_FUA;
+
+       q->flush_flags = flush & (REQ_FLUSH | REQ_FUA);
+}
+EXPORT_SYMBOL_GPL(blk_queue_flush);
+
 static int __init blk_settings_init(void)
 {
        blk_max_low_pfn = max_low_pfn - 1;