diff options
author | Jens Axboe <axboe@fb.com> | 2016-04-12 23:46:35 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-04-12 23:46:35 +0200 |
commit | 2f9a0b33ac6c4a2accaf787456080af35f1cab0b (patch) | |
tree | f9fff8867f90c42f1ec70e0ba86cf7529f881ef7 /block/blk-settings.c | |
parent | blk-mq: Make blk_mq_all_tag_busy_iter static (diff) | |
parent | block: add ability to flag write back caching on a device (diff) | |
download | linux-2f9a0b33ac6c4a2accaf787456080af35f1cab0b.tar.xz linux-2f9a0b33ac6c4a2accaf787456080af35f1cab0b.zip |
Merge branch 'for-4.7/core' into for-4.7/drivers
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) } EXPORT_SYMBOL_GPL(blk_queue_flush_queueable); +/** + * blk_queue_write_cache - configure queue's write cache + * @q: the request queue for the device + * @wc: write back cache on or off + * @fua: device supports FUA writes, if true + * + * Tell the block layer about the write cache of @q. + */ +void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua) +{ + spin_lock_irq(q->queue_lock); + if (wc) { + queue_flag_set(QUEUE_FLAG_WC, q); + q->flush_flags = REQ_FLUSH; + } else + queue_flag_clear(QUEUE_FLAG_WC, q); + if (fua) { + if (wc) + q->flush_flags |= REQ_FUA; + queue_flag_set(QUEUE_FLAG_FUA, q); + } else + queue_flag_clear(QUEUE_FLAG_FUA, q); + spin_unlock_irq(q->queue_lock); +} +EXPORT_SYMBOL_GPL(blk_queue_write_cache); + static int __init blk_settings_init(void) { blk_max_low_pfn = max_low_pfn - 1; |