mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
config: remove HAVE_BLK_QUEUE_WRITE_CACHE/HAVE_BLK_QUEUE_FLUSH
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16479
This commit is contained in:
parent
43bf9a712b
commit
ddf5122a29
@ -269,77 +269,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.36 API change,
|
||||
dnl # Added blk_queue_flush() interface, while the previous interface
|
||||
dnl # was available to all the new one is GPL-only. Thus in addition to
|
||||
dnl # detecting if this function is available we determine if it is
|
||||
dnl # GPL-only. If the GPL-only interface is there we implement our own
|
||||
dnl # compatibility function, otherwise we use the function. The hope
|
||||
dnl # is that long term this function will be opened up.
|
||||
dnl #
|
||||
dnl # 4.7 API change,
|
||||
dnl # Replace blk_queue_flush with blk_queue_write_cache
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
|
||||
ZFS_LINUX_TEST_SRC([blk_queue_flush], [
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct request_queue *q __attribute__ ((unused)) = NULL;
|
||||
(void) blk_queue_flush(q, REQ_FLUSH);
|
||||
], [], [ZFS_META_LICENSE])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/blkdev.h>
|
||||
], [
|
||||
struct request_queue *q __attribute__ ((unused)) = NULL;
|
||||
blk_queue_write_cache(q, true, true);
|
||||
], [], [ZFS_META_LICENSE])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
|
||||
AC_MSG_CHECKING([whether blk_queue_flush() is available])
|
||||
ZFS_LINUX_TEST_RESULT([blk_queue_flush], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
|
||||
[blk_queue_flush() is available])
|
||||
|
||||
AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
|
||||
ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [
|
||||
AC_MSG_RESULT(no)
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
|
||||
[blk_queue_flush() is GPL-only])
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 4.7 API change
|
||||
dnl # Replace blk_queue_flush with blk_queue_write_cache
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
|
||||
ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
|
||||
[blk_queue_write_cache() exists])
|
||||
|
||||
AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
|
||||
ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [
|
||||
AC_MSG_RESULT(no)
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1,
|
||||
[blk_queue_write_cache() is GPL-only])
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.34 API change
|
||||
dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
|
||||
@ -439,7 +368,6 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS
|
||||
ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS
|
||||
ZFS_AC_KERNEL_SRC_BLK_MQ
|
||||
@ -454,7 +382,6 @@ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_FLUSH
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS
|
||||
ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS
|
||||
ZFS_AC_KERNEL_BLK_MQ
|
||||
|
@ -61,24 +61,12 @@ blk_queue_flag_clear(unsigned int flag, struct request_queue *q)
|
||||
* Setting the flush flags directly is no longer possible; flush flags are set
|
||||
* on the queue_limits structure and passed to blk_disk_alloc(). In this case
|
||||
* we remove this function entirely.
|
||||
*
|
||||
* 4.7 API,
|
||||
* The blk_queue_write_cache() interface has replaced blk_queue_flush()
|
||||
* interface. However, the new interface is GPL-only thus we implement
|
||||
* our own trivial wrapper when the GPL-only version is detected.
|
||||
*
|
||||
* 2.6.36 - 4.6 API,
|
||||
* The blk_queue_flush() interface has replaced blk_queue_ordered()
|
||||
* interface. However, while the old interface was available to all the
|
||||
* new one is GPL-only. Thus if the GPL-only version is detected we
|
||||
* implement our own trivial helper.
|
||||
*/
|
||||
#if !defined(HAVE_BLK_ALLOC_DISK_2ARG) || \
|
||||
!defined(HAVE_BLKDEV_QUEUE_LIMITS_FEATURES)
|
||||
static inline void
|
||||
blk_queue_set_write_cache(struct request_queue *q, bool on)
|
||||
{
|
||||
#if defined(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY)
|
||||
if (on) {
|
||||
blk_queue_flag_set(QUEUE_FLAG_WC, q);
|
||||
blk_queue_flag_set(QUEUE_FLAG_FUA, q);
|
||||
@ -86,18 +74,6 @@ blk_queue_set_write_cache(struct request_queue *q, bool on)
|
||||
blk_queue_flag_clear(QUEUE_FLAG_WC, q);
|
||||
blk_queue_flag_clear(QUEUE_FLAG_FUA, q);
|
||||
}
|
||||
#elif defined(HAVE_BLK_QUEUE_WRITE_CACHE)
|
||||
blk_queue_write_cache(q, on, on);
|
||||
#elif defined(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY)
|
||||
if (on)
|
||||
q->flush_flags |= REQ_FLUSH | REQ_FUA;
|
||||
else
|
||||
q->flush_flags &= ~(REQ_FLUSH | REQ_FUA);
|
||||
#elif defined(HAVE_BLK_QUEUE_FLUSH)
|
||||
blk_queue_flush(q, on ? (REQ_FLUSH | REQ_FUA) : 0);
|
||||
#else
|
||||
#error "Unsupported kernel"
|
||||
#endif
|
||||
}
|
||||
#endif /* !HAVE_BLK_ALLOC_DISK_2ARG || !HAVE_BLKDEV_QUEUE_LIMITS_FEATURES */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user