summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2016-05-18 13:45:39 -0700
committerBrian Behlendorf <[email protected]>2016-05-20 11:08:55 -0700
commit68e8f59afb0fa1b388c7dbb8720ac6756d390146 (patch)
tree1248187000ddf265bce694b975f196510c3ff908 /include/linux
parentfd4c7b7a73fda391f94f58530c86ffa5b2ef8e6f (diff)
Linux 4.7 compat: replace blk_queue_flush with blk_queue_write_cache
Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #4665
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev_compat.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
index 0cb07207e..42b474b15 100644
--- a/include/linux/blkdev_compat.h
+++ b/include/linux/blkdev_compat.h
@@ -52,6 +52,33 @@ __blk_queue_flush(struct request_queue *q, unsigned int flags)
q->flush_flags = flags & (REQ_FLUSH | REQ_FUA);
}
#endif /* HAVE_BLK_QUEUE_FLUSH && HAVE_BLK_QUEUE_FLUSH_GPL_ONLY */
+
+/*
+ * 4.7 API change,
+ * The blk_queue_write_cache() interface has replaced blk_queue_flush()
+ * interface. However, while the new interface is GPL-only. Thus if the
+ * GPL-only version is detected we implement our own trivial helper
+ * compatibility funcion.
+ */
+#if defined(HAVE_BLK_QUEUE_WRITE_CACHE) && \
+ defined(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY)
+#define blk_queue_write_cache __blk_queue_write_cache
+static inline 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);
+ else
+ queue_flag_clear(QUEUE_FLAG_WC, q);
+ if (fua)
+ queue_flag_set(QUEUE_FLAG_FUA, q);
+ else
+ queue_flag_clear(QUEUE_FLAG_FUA, q);
+ spin_unlock_irq(q->queue_lock);
+}
+#endif
+
/*
* Most of the blk_* macros were removed in 2.6.36. Ostensibly this was
* done to improve readability and allow easier grepping. However, from