]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-blk-queue.m4
Linux 5.12 compat: idmapped mounts
[FreeBSD/FreeBSD.git] / config / kernel-blk-queue.m4
1 dnl #
2 dnl # 2.6.39 API change,
3 dnl # blk_start_plug() and blk_finish_plug()
4 dnl #
5 AC_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
16 AC_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
25 dnl #
26 dnl # 2.6.32 - 4.11, statically allocated bdi in request_queue
27 dnl # 4.12 - x.y, dynamically allocated bdi in request_queue
28 dnl #
29 AC_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
39 AC_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
50 dnl #
51 dnl # 2.6.32 - 4.x API,
52 dnl #   blk_queue_discard()
53 dnl #
54 AC_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
64 AC_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
73 dnl #
74 dnl # 4.8 - 4.x API,
75 dnl #   blk_queue_secure_erase()
76 dnl #
77 dnl # 2.6.36 - 4.7 API,
78 dnl #   blk_queue_secdiscard()
79 dnl #
80 AC_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
98 AC_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
118 dnl #
119 dnl # 4.16 API change,
120 dnl # Introduction of blk_queue_flag_set and blk_queue_flag_clear
121 dnl #
122 AC_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
132 AC_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
143 AC_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
153 AC_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
164 dnl #
165 dnl # 2.6.36 API change,
166 dnl # Added blk_queue_flush() interface, while the previous interface
167 dnl # was available to all the new one is GPL-only.  Thus in addition to
168 dnl # detecting if this function is available we determine if it is
169 dnl # GPL-only.  If the GPL-only interface is there we implement our own
170 dnl # compatibility function, otherwise we use the function.  The hope
171 dnl # is that long term this function will be opened up.
172 dnl #
173 dnl # 4.7 API change,
174 dnl # Replace blk_queue_flush with blk_queue_write_cache
175 dnl #
176 AC_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
193 AC_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
235 dnl #
236 dnl # 2.6.34 API change
237 dnl # blk_queue_max_hw_sectors() replaces blk_queue_max_sectors().
238 dnl #
239 AC_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
248 AC_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
257 dnl #
258 dnl # 2.6.34 API change
259 dnl # blk_queue_max_segments() consolidates blk_queue_max_hw_segments()
260 dnl # and blk_queue_max_phys_segments().
261 dnl #
262 AC_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
271 AC_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
280 AC_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
292 AC_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 ])