1dnl # 2dnl # 2.6.39 API change, 3dnl # blk_start_plug() and blk_finish_plug() 4dnl # 5AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG], [ 6 ZFS_LINUX_TEST_SRC([blk_plug], [ 7 #include <linux/blkdev.h> 8 ],[ 9 struct blk_plug plug __attribute__ ((unused)); 10 11 blk_start_plug(&plug); 12 blk_finish_plug(&plug); 13 ]) 14]) 15 16AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PLUG], [ 17 AC_MSG_CHECKING([whether struct blk_plug is available]) 18 ZFS_LINUX_TEST_RESULT([blk_plug], [ 19 AC_MSG_RESULT(yes) 20 ],[ 21 ZFS_LINUX_TEST_ERROR([blk_plug]) 22 ]) 23]) 24 25dnl # 26dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue 27dnl # 4.12 - x.y, dynamically allocated bdi in request_queue 28dnl # 29AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [ 30 ZFS_LINUX_TEST_SRC([blk_queue_bdi], [ 31 #include <linux/blkdev.h> 32 ],[ 33 struct request_queue q; 34 struct backing_dev_info bdi; 35 q.backing_dev_info = &bdi; 36 ]) 37]) 38 39AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [ 40 AC_MSG_CHECKING([whether blk_queue bdi is dynamic]) 41 ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [ 42 AC_MSG_RESULT(yes) 43 AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1, 44 [blk queue backing_dev_info is dynamic]) 45 ],[ 46 AC_MSG_RESULT(no) 47 ]) 48]) 49 50dnl # 51dnl # 2.6.32 - 4.x API, 52dnl # blk_queue_discard() 53dnl # 54AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ 55 ZFS_LINUX_TEST_SRC([blk_queue_discard], [ 56 #include <linux/blkdev.h> 57 ],[ 58 struct request_queue *q __attribute__ ((unused)) = NULL; 59 int value __attribute__ ((unused)); 60 value = blk_queue_discard(q); 61 ]) 62]) 63 64AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ 65 AC_MSG_CHECKING([whether blk_queue_discard() is available]) 66 ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ 67 AC_MSG_RESULT(yes) 68 ],[ 69 ZFS_LINUX_TEST_ERROR([blk_queue_discard]) 70 ]) 71]) 72 73dnl # 74dnl # 4.8 - 4.x API, 75dnl # blk_queue_secure_erase() 76dnl # 77dnl # 2.6.36 - 4.7 API, 78dnl # blk_queue_secdiscard() 79dnl # 80AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ 81 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ 82 #include <linux/blkdev.h> 83 ],[ 84 struct request_queue *q __attribute__ ((unused)) = NULL; 85 int value __attribute__ ((unused)); 86 value = blk_queue_secure_erase(q); 87 ]) 88 89 ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ 90 #include <linux/blkdev.h> 91 ],[ 92 struct request_queue *q __attribute__ ((unused)) = NULL; 93 int value __attribute__ ((unused)); 94 value = blk_queue_secdiscard(q); 95 ]) 96]) 97 98AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ 99 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) 100 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ 101 AC_MSG_RESULT(yes) 102 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, 103 [blk_queue_secure_erase() is available]) 104 ],[ 105 AC_MSG_RESULT(no) 106 107 AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) 108 ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ 109 AC_MSG_RESULT(yes) 110 AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, 111 [blk_queue_secdiscard() is available]) 112 ],[ 113 ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) 114 ]) 115 ]) 116]) 117 118dnl # 119dnl # 4.16 API change, 120dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear 121dnl # 122AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [ 123 ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [ 124 #include <linux/kernel.h> 125 #include <linux/blkdev.h> 126 ],[ 127 struct request_queue *q = NULL; 128 blk_queue_flag_set(0, q); 129 ]) 130]) 131 132AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [ 133 AC_MSG_CHECKING([whether blk_queue_flag_set() exists]) 134 ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [ 135 AC_MSG_RESULT(yes) 136 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, 137 [blk_queue_flag_set() exists]) 138 ],[ 139 AC_MSG_RESULT(no) 140 ]) 141]) 142 143AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [ 144 ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [ 145 #include <linux/kernel.h> 146 #include <linux/blkdev.h> 147 ],[ 148 struct request_queue *q = NULL; 149 blk_queue_flag_clear(0, q); 150 ]) 151]) 152 153AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [ 154 AC_MSG_CHECKING([whether blk_queue_flag_clear() exists]) 155 ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [ 156 AC_MSG_RESULT(yes) 157 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, 158 [blk_queue_flag_clear() exists]) 159 ],[ 160 AC_MSG_RESULT(no) 161 ]) 162]) 163 164dnl # 165dnl # 2.6.36 API change, 166dnl # Added blk_queue_flush() interface, while the previous interface 167dnl # was available to all the new one is GPL-only. Thus in addition to 168dnl # detecting if this function is available we determine if it is 169dnl # GPL-only. If the GPL-only interface is there we implement our own 170dnl # compatibility function, otherwise we use the function. The hope 171dnl # is that long term this function will be opened up. 172dnl # 173dnl # 4.7 API change, 174dnl # Replace blk_queue_flush with blk_queue_write_cache 175dnl # 176AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ 177 ZFS_LINUX_TEST_SRC([blk_queue_flush], [ 178 #include <linux/blkdev.h> 179 ], [ 180 struct request_queue *q = NULL; 181 (void) blk_queue_flush(q, REQ_FLUSH); 182 ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) 183 184 ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ 185 #include <linux/kernel.h> 186 #include <linux/blkdev.h> 187 ], [ 188 struct request_queue *q = NULL; 189 blk_queue_write_cache(q, true, true); 190 ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) 191]) 192 193AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ 194 AC_MSG_CHECKING([whether blk_queue_flush() is available]) 195 ZFS_LINUX_TEST_RESULT([blk_queue_flush], [ 196 AC_MSG_RESULT(yes) 197 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1, 198 [blk_queue_flush() is available]) 199 200 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only]) 201 ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [ 202 AC_MSG_RESULT(no) 203 ],[ 204 AC_MSG_RESULT(yes) 205 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1, 206 [blk_queue_flush() is GPL-only]) 207 ]) 208 ],[ 209 AC_MSG_RESULT(no) 210 ]) 211 212 dnl # 213 dnl # 4.7 API change 214 dnl # Replace blk_queue_flush with blk_queue_write_cache 215 dnl # 216 AC_MSG_CHECKING([whether blk_queue_write_cache() exists]) 217 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [ 218 AC_MSG_RESULT(yes) 219 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1, 220 [blk_queue_write_cache() exists]) 221 222 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only]) 223 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [ 224 AC_MSG_RESULT(no) 225 ],[ 226 AC_MSG_RESULT(yes) 227 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1, 228 [blk_queue_write_cache() is GPL-only]) 229 ]) 230 ],[ 231 AC_MSG_RESULT(no) 232 ]) 233]) 234 235dnl # 236dnl # 2.6.34 API change 237dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). 238dnl # 239AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ 240 ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ 241 #include <linux/blkdev.h> 242 ], [ 243 struct request_queue *q = NULL; 244 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); 245 ], [$NO_UNUSED_BUT_SET_VARIABLE]) 246]) 247 248AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ 249 AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) 250 ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [ 251 AC_MSG_RESULT(yes) 252 ],[ 253 ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors]) 254 ]) 255]) 256 257dnl # 258dnl # 2.6.34 API change 259dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() 260dnl # and blk_queue_max_phys_segments(). 261dnl # 262AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ 263 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ 264 #include <linux/blkdev.h> 265 ], [ 266 struct request_queue *q = NULL; 267 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); 268 ], [$NO_UNUSED_BUT_SET_VARIABLE]) 269]) 270 271AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ 272 AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) 273 ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [ 274 AC_MSG_RESULT(yes) 275 ], [ 276 ZFS_LINUX_TEST_ERROR([blk_queue_max_segments]) 277 ]) 278]) 279 280AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ 281 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG 282 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI 283 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD 284 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE 285 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET 286 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR 287 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH 288 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS 289 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS 290]) 291 292AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ 293 ZFS_AC_KERNEL_BLK_QUEUE_PLUG 294 ZFS_AC_KERNEL_BLK_QUEUE_BDI 295 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD 296 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE 297 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET 298 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR 299 ZFS_AC_KERNEL_BLK_QUEUE_FLUSH 300 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS 301 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS 302]) 303