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 # 6.11: bdi no longer available through request_queue, so get it from 29dnl # the gendisk attached to the queue 30dnl # 31AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI], [ 32 ZFS_LINUX_TEST_SRC([blk_queue_bdi], [ 33 #include <linux/blkdev.h> 34 ],[ 35 struct request_queue q; 36 struct backing_dev_info bdi; 37 q.backing_dev_info = &bdi; 38 ]) 39]) 40 41AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_BDI], [ 42 AC_MSG_CHECKING([whether blk_queue bdi is dynamic]) 43 ZFS_LINUX_TEST_RESULT([blk_queue_bdi], [ 44 AC_MSG_RESULT(yes) 45 AC_DEFINE(HAVE_BLK_QUEUE_BDI_DYNAMIC, 1, 46 [blk queue backing_dev_info is dynamic]) 47 ],[ 48 AC_MSG_RESULT(no) 49 ]) 50]) 51 52AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISK_BDI], [ 53 ZFS_LINUX_TEST_SRC([blk_queue_disk_bdi], [ 54 #include <linux/blkdev.h> 55 #include <linux/backing-dev.h> 56 ], [ 57 struct request_queue q; 58 struct gendisk disk; 59 struct backing_dev_info bdi __attribute__ ((unused)); 60 q.disk = &disk; 61 q.disk->bdi = &bdi; 62 ]) 63]) 64 65AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISK_BDI], [ 66 AC_MSG_CHECKING([whether backing_dev_info is available through queue gendisk]) 67 ZFS_LINUX_TEST_RESULT([blk_queue_disk_bdi], [ 68 AC_MSG_RESULT(yes) 69 AC_DEFINE(HAVE_BLK_QUEUE_DISK_BDI, 1, 70 [backing_dev_info is available through queue gendisk]) 71 ],[ 72 AC_MSG_RESULT(no) 73 ]) 74]) 75 76dnl # 77dnl # 5.9: added blk_queue_update_readahead(), 78dnl # 5.15: renamed to disk_update_readahead() 79dnl # 80AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD], [ 81 ZFS_LINUX_TEST_SRC([blk_queue_update_readahead], [ 82 #include <linux/blkdev.h> 83 ],[ 84 struct request_queue q; 85 blk_queue_update_readahead(&q); 86 ]) 87 88 ZFS_LINUX_TEST_SRC([disk_update_readahead], [ 89 #include <linux/blkdev.h> 90 ],[ 91 struct gendisk disk; 92 disk_update_readahead(&disk); 93 ]) 94]) 95 96AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD], [ 97 AC_MSG_CHECKING([whether blk_queue_update_readahead() exists]) 98 ZFS_LINUX_TEST_RESULT([blk_queue_update_readahead], [ 99 AC_MSG_RESULT(yes) 100 AC_DEFINE(HAVE_BLK_QUEUE_UPDATE_READAHEAD, 1, 101 [blk_queue_update_readahead() exists]) 102 ],[ 103 AC_MSG_RESULT(no) 104 105 AC_MSG_CHECKING([whether disk_update_readahead() exists]) 106 ZFS_LINUX_TEST_RESULT([disk_update_readahead], [ 107 AC_MSG_RESULT(yes) 108 AC_DEFINE(HAVE_DISK_UPDATE_READAHEAD, 1, 109 [disk_update_readahead() exists]) 110 ],[ 111 AC_MSG_RESULT(no) 112 ]) 113 ]) 114]) 115 116dnl # 117dnl # 5.19: bdev_max_discard_sectors() available 118dnl # 2.6.32: blk_queue_discard() available 119dnl # 120AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD], [ 121 ZFS_LINUX_TEST_SRC([bdev_max_discard_sectors], [ 122 #include <linux/blkdev.h> 123 ],[ 124 struct block_device *bdev __attribute__ ((unused)) = NULL; 125 unsigned int error __attribute__ ((unused)); 126 127 error = bdev_max_discard_sectors(bdev); 128 ]) 129 130 ZFS_LINUX_TEST_SRC([blk_queue_discard], [ 131 #include <linux/blkdev.h> 132 ],[ 133 struct request_queue r; 134 struct request_queue *q = &r; 135 int value __attribute__ ((unused)); 136 memset(q, 0, sizeof(r)); 137 value = blk_queue_discard(q); 138 ],[-Wframe-larger-than=8192]) 139]) 140 141AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ 142 AC_MSG_CHECKING([whether bdev_max_discard_sectors() is available]) 143 ZFS_LINUX_TEST_RESULT([bdev_max_discard_sectors], [ 144 AC_MSG_RESULT(yes) 145 AC_DEFINE(HAVE_BDEV_MAX_DISCARD_SECTORS, 1, 146 [bdev_max_discard_sectors() is available]) 147 ],[ 148 AC_MSG_RESULT(no) 149 150 AC_MSG_CHECKING([whether blk_queue_discard() is available]) 151 ZFS_LINUX_TEST_RESULT([blk_queue_discard], [ 152 AC_MSG_RESULT(yes) 153 AC_DEFINE(HAVE_BLK_QUEUE_DISCARD, 1, 154 [blk_queue_discard() is available]) 155 ],[ 156 ZFS_LINUX_TEST_ERROR([blk_queue_discard]) 157 ]) 158 ]) 159]) 160 161dnl # 162dnl # 5.19: bdev_max_secure_erase_sectors() available 163dnl # 4.8: blk_queue_secure_erase() available 164dnl # 165AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE], [ 166 ZFS_LINUX_TEST_SRC([bdev_max_secure_erase_sectors], [ 167 #include <linux/blkdev.h> 168 ],[ 169 struct block_device *bdev __attribute__ ((unused)) = NULL; 170 unsigned int error __attribute__ ((unused)); 171 172 error = bdev_max_secure_erase_sectors(bdev); 173 ]) 174 175 ZFS_LINUX_TEST_SRC([blk_queue_secure_erase], [ 176 #include <linux/blkdev.h> 177 ],[ 178 struct request_queue r; 179 struct request_queue *q = &r; 180 int value __attribute__ ((unused)); 181 memset(q, 0, sizeof(r)); 182 value = blk_queue_secure_erase(q); 183 ],[-Wframe-larger-than=8192]) 184]) 185 186AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE], [ 187 AC_MSG_CHECKING([whether bdev_max_secure_erase_sectors() is available]) 188 ZFS_LINUX_TEST_RESULT([bdev_max_secure_erase_sectors], [ 189 AC_MSG_RESULT(yes) 190 AC_DEFINE(HAVE_BDEV_MAX_SECURE_ERASE_SECTORS, 1, 191 [bdev_max_secure_erase_sectors() is available]) 192 ],[ 193 AC_MSG_RESULT(no) 194 195 AC_MSG_CHECKING([whether blk_queue_secure_erase() is available]) 196 ZFS_LINUX_TEST_RESULT([blk_queue_secure_erase], [ 197 AC_MSG_RESULT(yes) 198 AC_DEFINE(HAVE_BLK_QUEUE_SECURE_ERASE, 1, 199 [blk_queue_secure_erase() is available]) 200 ],[ 201 ZFS_LINUX_TEST_ERROR([blk_queue_secure_erase]) 202 ]) 203 ]) 204]) 205 206dnl # 207dnl # 2.6.34 API change 208dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors(). 209dnl # 210AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ 211 ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ 212 #include <linux/blkdev.h> 213 ], [ 214 struct request_queue *q __attribute__ ((unused)) = NULL; 215 (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); 216 ], []) 217]) 218 219AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ 220 AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) 221 ZFS_LINUX_TEST_RESULT([blk_queue_max_hw_sectors], [ 222 AC_MSG_RESULT(yes) 223 ],[ 224 AC_MSG_RESULT(no) 225 ]) 226]) 227 228dnl # 229dnl # 2.6.34 API change 230dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments() 231dnl # and blk_queue_max_phys_segments(). 232dnl # 233AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ 234 ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ 235 #include <linux/blkdev.h> 236 ], [ 237 struct request_queue *q __attribute__ ((unused)) = NULL; 238 (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); 239 ], []) 240]) 241 242AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ 243 AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) 244 ZFS_LINUX_TEST_RESULT([blk_queue_max_segments], [ 245 AC_MSG_RESULT(yes) 246 ], [ 247 AC_MSG_RESULT(no) 248 ]) 249]) 250 251AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX], [ 252 ZFS_LINUX_TEST_SRC([blk_mq_rq_hctx], [ 253 #include <linux/blk-mq.h> 254 #include <linux/blkdev.h> 255 ], [ 256 struct request rq = {0}; 257 struct blk_mq_hw_ctx *hctx = NULL; 258 rq.mq_hctx = hctx; 259 ], []) 260]) 261 262AC_DEFUN([ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX], [ 263 AC_MSG_CHECKING([whether block multiqueue hardware context is cached in struct request]) 264 ZFS_LINUX_TEST_RESULT([blk_mq_rq_hctx], [ 265 AC_MSG_RESULT(yes) 266 AC_DEFINE(HAVE_BLK_MQ_RQ_HCTX, 1, [block multiqueue hardware context is cached in struct request]) 267 ], [ 268 AC_MSG_RESULT(no) 269 ]) 270]) 271 272AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE], [ 273 ZFS_AC_KERNEL_SRC_BLK_QUEUE_PLUG 274 ZFS_AC_KERNEL_SRC_BLK_QUEUE_BDI 275 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISK_BDI 276 ZFS_AC_KERNEL_SRC_BLK_QUEUE_UPDATE_READAHEAD 277 ZFS_AC_KERNEL_SRC_BLK_QUEUE_DISCARD 278 ZFS_AC_KERNEL_SRC_BLK_QUEUE_SECURE_ERASE 279 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS 280 ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS 281 ZFS_AC_KERNEL_SRC_BLK_MQ_RQ_HCTX 282]) 283 284AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE], [ 285 ZFS_AC_KERNEL_BLK_QUEUE_PLUG 286 ZFS_AC_KERNEL_BLK_QUEUE_BDI 287 ZFS_AC_KERNEL_BLK_QUEUE_DISK_BDI 288 ZFS_AC_KERNEL_BLK_QUEUE_UPDATE_READAHEAD 289 ZFS_AC_KERNEL_BLK_QUEUE_DISCARD 290 ZFS_AC_KERNEL_BLK_QUEUE_SECURE_ERASE 291 ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS 292 ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS 293 ZFS_AC_KERNEL_BLK_MQ_RQ_HCTX 294]) 295