diff options
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r-- | block/blk-settings.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 331e4eee0dda..c903bee43cf8 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -846,6 +846,32 @@ void blk_queue_flush_queueable(struct request_queue *q, bool queueable) | |||
846 | } | 846 | } |
847 | EXPORT_SYMBOL_GPL(blk_queue_flush_queueable); | 847 | EXPORT_SYMBOL_GPL(blk_queue_flush_queueable); |
848 | 848 | ||
849 | /** | ||
850 | * blk_queue_write_cache - configure queue's write cache | ||
851 | * @q: the request queue for the device | ||
852 | * @wc: write back cache on or off | ||
853 | * @fua: device supports FUA writes, if true | ||
854 | * | ||
855 | * Tell the block layer about the write cache of @q. | ||
856 | */ | ||
857 | void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua) | ||
858 | { | ||
859 | spin_lock_irq(q->queue_lock); | ||
860 | if (wc) { | ||
861 | queue_flag_set(QUEUE_FLAG_WC, q); | ||
862 | q->flush_flags = REQ_FLUSH; | ||
863 | } else | ||
864 | queue_flag_clear(QUEUE_FLAG_WC, q); | ||
865 | if (fua) { | ||
866 | if (wc) | ||
867 | q->flush_flags |= REQ_FUA; | ||
868 | queue_flag_set(QUEUE_FLAG_FUA, q); | ||
869 | } else | ||
870 | queue_flag_clear(QUEUE_FLAG_FUA, q); | ||
871 | spin_unlock_irq(q->queue_lock); | ||
872 | } | ||
873 | EXPORT_SYMBOL_GPL(blk_queue_write_cache); | ||
874 | |||
849 | static int __init blk_settings_init(void) | 875 | static int __init blk_settings_init(void) |
850 | { | 876 | { |
851 | blk_max_low_pfn = max_low_pfn - 1; | 877 | blk_max_low_pfn = max_low_pfn - 1; |