FreeBSD: Remove some illumos compat from vnode.h
[zfs.git] / config / kernel-make-request-fn.m4
blob66d6a18cd976484b1628ba22174e1fa74d28d86d
1 dnl #
2 dnl # Check for make_request_fn interface.
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN], [
5         ZFS_LINUX_TEST_SRC([make_request_fn_blk_qc_t], [
6                 #include <linux/blkdev.h>
7                 static blk_qc_t make_request(struct request_queue *q,
8                     struct bio *bio) { return (BLK_QC_T_NONE); }
9         ],[
10                 blk_queue_make_request(NULL, &make_request);
11         ])
13         ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn], [
14                 #include <linux/blkdev.h>
15                 static blk_qc_t make_request(struct request_queue *q,
16                     struct bio *bio) { return (BLK_QC_T_NONE); }
17         ],[
18                 struct request_queue *q __attribute__ ((unused));
19                 q = blk_alloc_queue(make_request, NUMA_NO_NODE);
20         ])
22         ZFS_LINUX_TEST_SRC([blk_alloc_queue_request_fn_rh], [
23                 #include <linux/blkdev.h>
24                 static blk_qc_t make_request(struct request_queue *q,
25                     struct bio *bio) { return (BLK_QC_T_NONE); }
26         ],[
27                 struct request_queue *q __attribute__ ((unused));
28                 q = blk_alloc_queue_rh(make_request, NUMA_NO_NODE);
29         ])
31         ZFS_LINUX_TEST_SRC([block_device_operations_submit_bio], [
32                 #include <linux/blkdev.h>
33         ],[
34                 struct block_device_operations o;
35                 o.submit_bio = NULL;
36         ])
38         ZFS_LINUX_TEST_SRC([blk_alloc_disk], [
39                 #include <linux/blkdev.h>
40         ],[
41                 struct gendisk *disk  __attribute__ ((unused));
42                 disk = blk_alloc_disk(NUMA_NO_NODE);
43         ])
45         ZFS_LINUX_TEST_SRC([blk_alloc_disk_2arg], [
46                 #include <linux/blkdev.h>
47         ],[
48                 struct queue_limits *lim = NULL;
49                 struct gendisk *disk  __attribute__ ((unused));
50                 disk = blk_alloc_disk(lim, NUMA_NO_NODE);
51         ])
53         ZFS_LINUX_TEST_SRC([blkdev_queue_limits_features], [
54                 #include <linux/blkdev.h>
55         ],[
56                 struct queue_limits *lim = NULL;
57                 lim->features = 0;
58         ])
60         ZFS_LINUX_TEST_SRC([blk_cleanup_disk], [
61                 #include <linux/blkdev.h>
62         ],[
63                 struct gendisk *disk  __attribute__ ((unused));
64                 blk_cleanup_disk(disk);
65         ])
68 AC_DEFUN([ZFS_AC_KERNEL_MAKE_REQUEST_FN], [
69         dnl # Checked as part of the blk_alloc_queue_request_fn test
70         dnl #
71         dnl # Linux 5.9 API Change
72         dnl # make_request_fn was moved into block_device_operations->submit_bio
73         dnl #
74         AC_MSG_CHECKING([whether submit_bio is member of struct block_device_operations])
75         ZFS_LINUX_TEST_RESULT([block_device_operations_submit_bio], [
76                 AC_MSG_RESULT(yes)
78                 AC_DEFINE(HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS, 1,
79                     [submit_bio is member of struct block_device_operations])
81                 dnl #
82                 dnl # Linux 5.14 API Change:
83                 dnl # blk_alloc_queue() + alloc_disk() combo replaced by
84                 dnl # a single call to blk_alloc_disk().
85                 dnl #
86                 AC_MSG_CHECKING([whether blk_alloc_disk() exists])
87                 ZFS_LINUX_TEST_RESULT([blk_alloc_disk], [
88                         AC_MSG_RESULT(yes)
89                         AC_DEFINE([HAVE_BLK_ALLOC_DISK], 1, [blk_alloc_disk() exists])
91                         dnl #
92                         dnl # 5.20 API change,
93                         dnl # Removed blk_cleanup_disk(), put_disk() should be used.
94                         dnl #
95                         AC_MSG_CHECKING([whether blk_cleanup_disk() exists])
96                         ZFS_LINUX_TEST_RESULT([blk_cleanup_disk], [
97                                 AC_MSG_RESULT(yes)
98                                 AC_DEFINE([HAVE_BLK_CLEANUP_DISK], 1,
99                                     [blk_cleanup_disk() exists])
100                         ], [
101                                 AC_MSG_RESULT(no)
102                         ])
103                 ], [
104                         AC_MSG_RESULT(no)
105                 ])
107                 dnl #
108                 dnl # Linux 6.9 API Change:
109                 dnl # blk_alloc_queue() takes a nullable queue_limits arg.
110                 dnl #
111                 AC_MSG_CHECKING([whether blk_alloc_disk() exists and takes 2 args])
112                 ZFS_LINUX_TEST_RESULT([blk_alloc_disk_2arg], [
113                         AC_MSG_RESULT(yes)
114                         AC_DEFINE([HAVE_BLK_ALLOC_DISK_2ARG], 1, [blk_alloc_disk() exists and takes 2 args])
116                         dnl #
117                         dnl # Linux 6.11 API change:
118                         dnl # struct queue_limits gains a 'features' field,
119                         dnl # used to set flushing options
120                         dnl #
121                         AC_MSG_CHECKING([whether struct queue_limits has a features field])
122                         ZFS_LINUX_TEST_RESULT([blkdev_queue_limits_features], [
123                                 AC_MSG_RESULT(yes)
124                                 AC_DEFINE([HAVE_BLKDEV_QUEUE_LIMITS_FEATURES], 1,
125                                     [struct queue_limits has a features field])
126                         ], [
127                                 AC_MSG_RESULT(no)
128                         ])
130                         dnl #
131                         dnl # 5.20 API change,
132                         dnl # Removed blk_cleanup_disk(), put_disk() should be used.
133                         dnl #
134                         AC_MSG_CHECKING([whether blk_cleanup_disk() exists])
135                         ZFS_LINUX_TEST_RESULT([blk_cleanup_disk], [
136                                 AC_MSG_RESULT(yes)
137                                 AC_DEFINE([HAVE_BLK_CLEANUP_DISK], 1,
138                                     [blk_cleanup_disk() exists])
139                         ], [
140                                 AC_MSG_RESULT(no)
141                         ])
142                 ], [
143                         AC_MSG_RESULT(no)
144                 ])
145         ],[
146                 AC_MSG_RESULT(no)
148                 dnl # Checked as part of the blk_alloc_queue_request_fn test
149                 dnl #
150                 dnl # Linux 5.7 API Change
151                 dnl # blk_alloc_queue() expects request function.
152                 dnl #
153                 AC_MSG_CHECKING([whether blk_alloc_queue() expects request function])
154                 ZFS_LINUX_TEST_RESULT([blk_alloc_queue_request_fn], [
155                         AC_MSG_RESULT(yes)
157                         dnl # This is currently always the case.
158                         AC_MSG_CHECKING([whether make_request_fn() returns blk_qc_t])
159                         AC_MSG_RESULT(yes)
161                         AC_DEFINE(HAVE_BLK_ALLOC_QUEUE_REQUEST_FN, 1,
162                             [blk_alloc_queue() expects request function])
163                         AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
164                             [make_request_fn() return type])
165                         AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
166                             [Noting that make_request_fn() returns blk_qc_t])
167                 ],[
168                         dnl #
169                         dnl # CentOS Stream 4.18.0-257 API Change
170                         dnl # The Linux 5.7 blk_alloc_queue() change was back-
171                         dnl # ported and the symbol renamed blk_alloc_queue_rh().
172                         dnl # As of this kernel version they're not providing
173                         dnl # any compatibility code in the kernel for this.
174                         dnl #
175                         ZFS_LINUX_TEST_RESULT([blk_alloc_queue_request_fn_rh], [
176                                 AC_MSG_RESULT(yes)
178                                 dnl # This is currently always the case.
179                                 AC_MSG_CHECKING([whether make_request_fn_rh() returns blk_qc_t])
180                                 AC_MSG_RESULT(yes)
182                                 AC_DEFINE(HAVE_BLK_ALLOC_QUEUE_REQUEST_FN_RH, 1,
183                                     [blk_alloc_queue_rh() expects request function])
184                                 AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
185                                     [make_request_fn() return type])
186                                 AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
187                                     [Noting that make_request_fn() returns blk_qc_t])
188                         ],[
189                                 AC_MSG_RESULT(no)
191                                 dnl #
192                                 dnl # Linux 4.4 API Change
193                                 dnl # make_request_fn returns blk_qc_t.
194                                 dnl #
195                                 AC_MSG_CHECKING(
196                                     [whether make_request_fn() returns blk_qc_t])
197                                 ZFS_LINUX_TEST_RESULT([make_request_fn_blk_qc_t], [
198                                         AC_MSG_RESULT(yes)
199                                         AC_DEFINE(MAKE_REQUEST_FN_RET, blk_qc_t,
200                                             [make_request_fn() return type])
201                                         AC_DEFINE(HAVE_MAKE_REQUEST_FN_RET_QC, 1,
202                                             [Noting that make_request_fn() ]
203                                             [returns blk_qc_t])
204                                 ],[
205                                         ZFS_LINUX_TEST_ERROR([make_request_fn])
206                                 ])
207                         ])
208                 ])
209         ])