2 dnl # 2.6.36 API change
3 dnl # In 2.6.36 kernels the blk_queue_ordered() interface has been
4 dnl # replaced by the simpler blk_queue_flush(). However, while the
5 dnl # old interface was available to all the new one is GPL-only.
6 dnl # Thus in addition to detecting if this function is available
7 dnl # we determine if it is GPL-only. If the GPL-only interface is
8 dnl # there we implement our own compatibility function, otherwise
9 dnl # we use the function. The hope is that long term this function
10 dnl # will be opened up.
12 AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
13 AC_MSG_CHECKING([whether blk_queue_flush() is available])
14 tmp_flags="$EXTRA_KCFLAGS"
15 EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}"
16 ZFS_LINUX_TRY_COMPILE([
17 #include <linux/blkdev.h>
19 struct request_queue *q = NULL;
20 (void) blk_queue_flush(q, REQ_FLUSH);
23 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1,
24 [blk_queue_flush() is available])
26 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only])
27 ZFS_LINUX_TRY_COMPILE([
28 #include <linux/module.h>
29 #include <linux/blkdev.h>
31 MODULE_LICENSE("$ZFS_META_LICENSE");
33 struct request_queue *q = NULL;
34 (void) blk_queue_flush(q, REQ_FLUSH);
39 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1,
40 [blk_queue_flush() is GPL-only])
48 dnl # Replace blk_queue_flush with blk_queue_write_cache
50 AC_MSG_CHECKING([whether blk_queue_write_cache() exists])
51 ZFS_LINUX_TRY_COMPILE([
52 #include <linux/kernel.h>
53 #include <linux/blkdev.h>
56 struct request_queue *q = NULL;
57 blk_queue_write_cache(q, true, true);
60 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1,
61 [blk_queue_write_cache() exists])
63 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only])
64 ZFS_LINUX_TRY_COMPILE([
65 #include <linux/kernel.h>
66 #include <linux/module.h>
67 #include <linux/blkdev.h>
69 MODULE_LICENSE("$ZFS_META_LICENSE");
71 struct request_queue *q = NULL;
72 blk_queue_write_cache(q, true, true);
77 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1,
78 [blk_queue_write_cache() is GPL-only])
84 EXTRA_KCFLAGS="$tmp_flags"