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: 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 # 5.9: added blk_queue_update_readahead(), 52dnl # 5.15: renamed to disk_update_readahead() 53dnl # 54AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD], [ 55 ZFS_LINUX_TEST_SRC([blk_queue_update_readahead], [ 56 #include <linux/blkdev.h> 57 ],[ 58 struct request_queue q; 59 blk_queue_update_readahead(&q); 60 ]) 61 62 ZFS_LINUX_TEST_SRC([disk_update_readahead], [ 63 #include <linux/blkdev.h> 64 ],[ 65 struct gendisk disk; 66 disk_update_readahead(&disk); 67 ]) 68]) 69 70AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [ 71 AC_MSG_CHECKING([whether blk_queue_update_readahead() exists]) 72 ZFS_LINUX_TEST_RESULT([blk_queue_update_readahead], [ 73 AC_MSG_RESULT(yes) 74 AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1, 75 [blk_queue_update_readahead() exists]) 76 ],[ 77 AC_MSG_CHECKING([whether disk_update_readahead() exists]) 78 ZFS_LINUX_TEST_RESULT([disk_update_readahead], [ 79 AC_MSG_RESULT(yes) 80 AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1, 81 [disk_update_readahead() exists]) 82 ],[ 83 AC_MSG_RESULT(no) 84 ]) 85 ]) 86]) 87 88dnl # 89dnl # 2.6.32 API, 90dnl # blk_queue_discard() 91dnl # 92AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ 93 ZFS_LINUX_TEST_SRC([blk_queue_discard], [ 94 #include <linux/blkdev.h> 95 ],[ 96 struct request_queue *q __attribute__ ((unused)) = NULL; 97 int value __attribute__ ((unused)); 98 value = blk_queue_discard(q); 99 ]) 100]) 101 102AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ 103 AC_MSG_CHECKING([whether blk_queue_discard() is available]) 104 ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ 105 AC_MSG_RESULT(yes) 106 ],[ 107 ZFS_LINUX_TEST_ERROR([blk_queue_discard]) 108 ]) 109]) 110 111dnl # 112dnl # 4.8 API, 113dnl # blk_queue_secure_erase() 114dnl # 115dnl # 2.6.36 - 4.7 API, 116dnl # blk_queue_secdiscard() 117dnl # 118AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ 119 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ 120 #include <linux/blkdev.h> 121 ],[ 122 struct request_queue *q __attribute__ ((unused)) = NULL; 123 int value __attribute__ ((unused)); 124 value = blk_queue_secure_erase(q); 125 ]) 126 127 ZFS_LINUX_TEST_SRC([blk_queue_secdiscard], [ 128 #include <linux/blkdev.h> 129 ],[ 130 struct request_queue *q __attribute__ ((unused)) = NULL; 131 int value __attribute__ ((unused)); 132 value = blk_queue_secdiscard(q); 133 ]) 134]) 135 136AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ 137 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) 138 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ 139 AC_MSG_RESULT(yes) 140 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, 141 [blk_queue_secure_erase() is available]) 142 ],[ 143 AC_MSG_RESULT(no) 144 145 AC_MSG_CHECKING([whether blk_queue_secdiscard() is available]) 146 ZFS_LINUX_TEST_RESULT([blk_queue_secdiscard], [ 147 AC_MSG_RESULT(yes) 148 AC_DEFINE(HAVE_BLK_QUEUE_SECDISCARD, 1, 149 [blk_queue_secdiscard() is available]) 150 ],[ 151 ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) 152 ]) 153 ]) 154]) 155 156dnl # 157dnl # 4.16 API change, 158dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear 159dnl # 160AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET], [ 161 ZFS_LINUX_TEST_SRC([blk_queue_flag_set], [ 162 #include <linux/kernel.h> 163 #include <linux/blkdev.h> 164 ],[ 165 struct request_queue *q = NULL; 166 blk_queue_flag_set(0, q); 167 ]) 168]) 169 170AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET], [ 171 AC_MSG_CHECKING([whether blk_queue_flag_set() exists]) 172 ZFS_LINUX_TEST_RESULT([blk_queue_flag_set], [ 173 AC_MSG_RESULT(yes) 174 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_SET, 1, 175 [blk_queue_flag_set() exists]) 176 ],[ 177 AC_MSG_RESULT(no) 178 ]) 179]) 180 181AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR], [ 182 ZFS_LINUX_TEST_SRC([blk_queue_flag_clear], [ 183 #include <linux/kernel.h> 184 #include <linux/blkdev.h> 185 ],[ 186 struct request_queue *q = NULL; 187 blk_queue_flag_clear(0, q); 188 ]) 189]) 190 191AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR], [ 192 AC_MSG_CHECKING([whether blk_queue_flag_clear() exists]) 193 ZFS_LINUX_TEST_RESULT([blk_queue_flag_clear], [ 194 AC_MSG_RESULT(yes) 195 AC_DEFINE(HAVE_BLK_QUEUE_FLAG_CLEAR, 1, 196 [blk_queue_flag_clear() exists]) 197 ],[ 198 AC_MSG_RESULT(no) 199 ]) 200]) 201 202dnl # 203dnl # 2.6.36 API change, 204dnl # Added blk_queue_flush() interface, while the previous interface 205dnl # was available to all the new one is GPL-only. Thus in addition to 206dnl # detecting if this function is available we determine if it is 207dnl # GPL-only. If the GPL-only interface is there we implement our own 208dnl # compatibility function, otherwise we use the function. The hope 209dnl # is that long term this function will be opened up. 210dnl # 211dnl # 4.7 API change, 212dnl # Replace blk_queue_flush with blk_queue_write_cache 213dnl # 214AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ 215 ZFS_LINUX_TEST_SRC([blk_queue_flush], [ 216 #include <linux/blkdev.h> 217 ], [ 218 struct request_queue *q = NULL; 219 (void) blk_queue_flush(q, REQ_FLUSH); 220 ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) 221 222 ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ 223 #include <linux/kernel.h> 224 #include <linux/blkdev.h> 225 ], [ 226 struct request_queue *q = NULL; 227 blk_queue_write_cache(q, true, true); 228 ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) 229]) 230 231AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ 232 AC_MSG_CHECKING([whether blk_queue_flush() is available]) 233 ZFS_LINUX_TEST_RESULT([blk_queue_flush], [ 234 AC_MSG_RESULT(yes) 235 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH, 1, 236 [blk_queue_flush() is available]) 237 238 AC_MSG_CHECKING([whether blk_queue_flush() is GPL-only]) 239 ZFS_LINUX_TEST_RESULT([blk_queue_flush_license], [ 240 AC_MSG_RESULT(no) 241 ],[ 242 AC_MSG_RESULT(yes) 243 AC_DEFINE(HAVE_BLK_QUEUE_FLUSH_GPL_ONLY, 1, 244 [blk_queue_flush() is GPL-only]) 245 ]) 246 ],[ 247 AC_MSG_RESULT(no) 248 ]) 249 250 dnl # 251 dnl # 4.7 API change 252 dnl # Replace blk_queue_flush with blk_queue_write_cache 253 dnl # 254 AC_MSG_CHECKING([whether blk_queue_write_cache() exists]) 255 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache], [ 256 AC_MSG_RESULT(yes) 257 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE, 1, 258 [blk_queue_write_cache() exists]) 259 260 AC_MSG_CHECKING([whether blk_queue_write_cache() is GPL-only]) 261 ZFS_LINUX_TEST_RESULT([blk_queue_write_cache_license], [ 262 AC_MSG_RESULT(no) 263 ],[ 264 AC_MSG_RESULT(yes) 265 AC_DEFINE(HAVE_BLK_QUEUE_WRITE_CACHE_GPL_ONLY, 1, 266 [blk_queue_write_cache() is GPL-only]) 267 ]) 268 ],[ 269 AC_MSG_RESULT(no) 270 ]) 271]) 272 273dnl # 274dnl # 2.6.34 API change 275dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). 276dnl # 277AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ 278 ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ 279 #include <linux/blkdev.h> 280 ], [ 281 struct request_queue *q = NULL; 282 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); 283 ], [$NO_UNUSED_BUT_SET_VARIABLE]) 284]) 285 286AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ 287 AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) 288 ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [ 289 AC_MSG_RESULT(yes) 290 ],[ 291 ZFS_LINUX_TEST_ERROR([blk_queue_max_hw_sectors]) 292 ]) 293]) 294 295dnl # 296dnl # 2.6.34 API change 297dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() 298dnl # and blk_queue_max_phys_segments(). 299dnl # 300AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ 301 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ 302 #include <linux/blkdev.h> 303 ], [ 304 struct request_queue *q = NULL; 305 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); 306 ], [$NO_UNUSED_BUT_SET_VARIABLE]) 307]) 308 309AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ 310 AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) 311 ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [ 312 AC_MSG_RESULT(yes) 313 ], [ 314 ZFS_LINUX_TEST_ERROR([blk_queue_max_segments]) 315 ]) 316]) 317 318AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ 319 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG 320 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI 321 ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD 322 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD 323 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE 324 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_SET 325 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLAG_CLEAR 326 ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH 327 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS 328 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS 329]) 330 331AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ 332 ZFS_AC_KERNEL_BLK_QUEUE_PLUG 333 ZFS_AC_KERNEL_BLK_QUEUE_BDI 334 ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD 335 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD 336 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE 337 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_SET 338 ZFS_AC_KERNEL_BLK_QUEUE_FLAG_CLEAR 339 ZFS_AC_KERNEL_BLK_QUEUE_FLUSH 340 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS 341 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS 342]) 343