4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
5 AC_MSG_CHECKING([which ldiskfs series to use])
6 case x$LDISKFS_SERIES in
9 *.series) # set externally
13 AS_IF([test -z "$LDISKFS_SERIES"], [
14 AS_IF([test x$RHEL_KERNEL = xyes], [
15 case $RHEL_RELEASE_NO in
16 92) LDISKFS_SERIES="5.14-rhel9.2.series" ;;
17 91) LDISKFS_SERIES="5.14-rhel9.1.series" ;;
18 90) LDISKFS_SERIES="5.14-rhel9.series" ;;
19 88) LDISKFS_SERIES="4.18-rhel8.8.series" ;;
20 87) LDISKFS_SERIES="4.18-rhel8.7.series" ;;
21 86) LDISKFS_SERIES="4.18-rhel8.6.series" ;;
22 85) LDISKFS_SERIES="4.18-rhel8.5.series" ;;
23 84) LDISKFS_SERIES="4.18-rhel8.4.series" ;;
24 83) LDISKFS_SERIES="4.18-rhel8.3.series" ;;
25 82) LDISKFS_SERIES="4.18-rhel8.2.series" ;;
26 81) LDISKFS_SERIES="4.18-rhel8.1.series" ;;
27 80) LDISKFS_SERIES="4.18-rhel8.series" ;;
28 79) LDISKFS_SERIES="3.10-rhel7.9.series" ;;
29 78) LDISKFS_SERIES="3.10-rhel7.8.series" ;;
30 77) LDISKFS_SERIES="3.10-rhel7.7.series" ;;
31 76) LDISKFS_SERIES="3.10-rhel7.6.series" ;;
33 ], [test x$SUSE_KERNEL = xyes], [
34 AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
35 AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
36 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
37 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
38 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
39 case ${suse_vers}sp$suse_patchlevel in # (
40 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
41 if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
42 # This file was added shortly after -150.22 so
43 # this must be 150.22 or earlier
44 LDISKFS_SERIES="4.12-sles15-22.series"
47 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
48 if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
49 # This file was added after -197.7 so
50 # this must be -197.7 or earlier
51 LDISKFS_SERIES="4.12-sles15sp1-7.series"
56 )], [LDISKFS_SERIES="5.4.21-ml.series"],
58 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
59 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
60 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
61 case ${suse_vers}sp${suse_patchlevel} in # (
62 15sp2 ) LDISKFS_SERIES="5.4.21-ml.series"
63 grep -A3 ext4_update_dx_flag $LINUX/fs/ext4/ext4.h \
64 | grep ext4_test_inode_flag
65 if test $? -eq 0; then
66 LDISKFS_SERIES="5.4.0-66-ubuntu20.series"
69 15sp3 ) LDISKFS_SERIES="5.3.18-sles15sp3.series"
71 15sp4 ) LDISKFS_SERIES="5.14.21-sles15sp4.series"
73 15sp5 ) LDISKFS_SERIES="5.14.21-sles15sp5.series"
77 ], [test x$UBUNTU_KERNEL = xyes], [
78 BASEVER=$(echo $LINUXRELEASE | cut -d'-' -f1)
79 AS_VERSION_COMPARE([$BASEVER],[5.11.0],[
80 AS_VERSION_COMPARE([$BASEVER],[5.8.0],[
81 AS_VERSION_COMPARE([$BASEVER],[5.4.0],[
82 AS_VERSION_COMPARE([$BASEVER],[5.0.0],[
83 AS_VERSION_COMPARE([$BASEVER],[4.15.0],[
84 AS_VERSION_COMPARE([$BASEVER],[4.4.0], [],
86 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
89 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
90 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
92 [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
93 [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
94 [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
95 [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
98 [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
100 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
102 [test -z "$KPLEV"], [
103 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
104 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
106 [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
107 [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
110 [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
111 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
112 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
114 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
116 [test -z "$KPLEV"], [
117 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
118 LDISKFS_SERIES="5.4.0-90-ubuntu20.series"
120 [test $KPLEV -eq 1007], [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
121 [test $KPLEV -ge 90], [LDISKFS_SERIES="5.4.0-90-ubuntu20.series"],
122 [test $KPLEV -ge 80], [LDISKFS_SERIES="5.4.0-80-ubuntu20.series"],
123 [test $KPLEV -ge 66], [LDISKFS_SERIES="5.4.0-66-ubuntu20.series"],
124 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"]
127 [LDISKFS_SERIES="5.4.0-ml.series"])],
129 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
131 [test -z "$KPLEV"], [
132 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
133 LDISKFS_SERIES="5.8.0-63-ubuntu20.series"
135 [test $KPLEV -ge 63], [LDISKFS_SERIES="5.8.0-63-ubuntu20.series"],
136 [LDISKFS_SERIES="5.8.0-53-ubuntu20.series"]
139 [LDISKFS_SERIES="5.8.0-ml.series"])],
140 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"],
141 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"])
142 ], [test x$OPENEULER_KERNEL = xyes], [
143 case $OPENEULER_VERSION_NO in
144 2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;;
145 2203.1) LDISKFS_SERIES="5.10.0-oe2203sp1.series" ;;
149 # Not RHEL/SLES/openEuler or Ubuntu .. probably mainline
150 AS_IF([test -z "$LDISKFS_SERIES"],
152 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
153 [LDISKFS_SERIES="5.4.0-ml.series"],[
154 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
155 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
156 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
157 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],
158 [LDISKFS_SERIES="5.4.136-ml.series"], # lt
159 [LDISKFS_SERIES="5.8.0-ml.series"], # eq
160 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.9.0],
161 [LDISKFS_SERIES="5.8.0-ml.series"], # lt
162 [LDISKFS_SERIES="5.9.0-ml.series"], # eq
163 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.10.0],
164 [LDISKFS_SERIES="5.9.0-ml.series"], # lt
165 [LDISKFS_SERIES="5.10.0-ml.series"], # eq
166 [LDISKFS_SERIES="5.10.0-ml.series"], # gt
173 AS_IF([test -z "$LDISKFS_SERIES"],
174 [AC_MSG_RESULT([failed to identify series])],
175 [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
176 AC_SUBST(LDISKFS_SERIES)
177 ]) # LDISKFS_LINUX_SERIES
180 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
182 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
183 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
185 AC_DEFUN([LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
186 LB2_LINUX_TEST_SRC([ext4_free_blocks_with_buffer_head], [
187 #include <linux/fs.h>
188 #include "$EXT4_SRC_DIR/ext4.h"
190 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
191 ],[],[],[ext4_free_blocks])
193 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
194 AC_MSG_CHECKING([if 'ext4_free_blocks' needs 'struct buffer_head'])
195 LB2_LINUX_TEST_RESULT([ext4_free_blocks_with_buffer_head], [
196 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
197 [ext4_free_blocks do not require struct buffer_head])
199 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
202 # LB_EXT4_JOURNAL_START_3ARGS
204 # 3.9 added a type argument to ext4_journal_start and friends
206 AC_DEFUN([LB_SRC_EXT4_JOURNAL_START_3ARGS], [
207 LB2_LINUX_TEST_SRC([ext4_journal_start], [
208 #include <linux/fs.h>
209 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
211 ext4_journal_start(NULL, 0, 0);
212 ],[],[],[__ext4_journal_start_sb])
214 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
215 AC_MSG_CHECKING([if ext4_journal_start takes 3 arguments])
216 LB2_LINUX_TEST_RESULT([ext4_journal_start], [
217 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1,
218 [ext4_journal_start takes 3 arguments])
220 ]) # LB_EXT4_JOURNAL_START_3ARGS
223 # LB_EXT4_BREAD_4ARGS
225 # 3.18 ext4_bread has 4 arguments
226 # NOTE: It may not be exported for modules, use a positive compiler test here.
228 AC_DEFUN([LB_SRC_EXT4_BREAD_4ARGS], [
229 LB2_LINUX_TEST_SRC([ext4_bread], [
230 #include <linux/fs.h>
231 #include "$EXT4_SRC_DIR/ext4.h"
233 struct buffer_head *ext4_bread(handle_t *handle,
235 ext4_lblk_t block, int map_flags)
237 struct buffer_head *bh = NULL;
245 ext4_bread(NULL, NULL, 0, 0);
246 ],[],[],[ext4_bread])
248 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
249 AC_MSG_CHECKING([if ext4_bread takes 4 arguments])
250 LB2_LINUX_TEST_RESULT([ext4_bread], [
251 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1,
252 [ext4_bread takes 4 arguments])
254 ]) # LB_EXT4_BREAD_4ARGS
257 # LB_EXT4_HAVE_INFO_DQUOT
259 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
261 AC_DEFUN([LB_SRC_EXT4_HAVE_INFO_DQUOT], [
262 LB2_LINUX_TEST_SRC([ext4_info_dquot], [
263 #include <linux/fs.h>
264 #include <linux/quota.h>
265 #include "$EXT4_SRC_DIR/ext4.h"
267 struct ext4_inode_info in;
273 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
274 AC_MSG_CHECKING([if i_dquot is in ext4_inode_info])
275 LB2_LINUX_TEST_RESULT([ext4_info_dquot], [
276 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1,
277 [i_dquot is in ext4_inode_info])
279 ]) # LB_EXT4_HAVE_INFO_DQUOT
282 # LB_EXT4_HAVE_I_CRYPT_INFO
284 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
286 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
287 # If we have i_crypt_info in ext4_inode_info, the config option
288 # should be enabled to make the ldiskfs module compilation happy.
289 # Otherwise i_crypy_info is in struct inode, we need to check kernel
290 # config option to determine that.
292 AC_DEFUN([LB_SRC_EXT4_HAVE_I_CRYPT_INFO], [
293 LB2_SRC_CHECK_CONFIG([EXT4_FS_ENCRYPTION])
294 LB2_LINUX_TEST_SRC([ext4_i_crypt_info], [
295 #define CONFIG_EXT4_FS_ENCRYPTION 1
296 #include <linux/fs.h>
297 #include "$EXT4_SRC_DIR/ext4.h"
299 struct ext4_inode_info in;
301 in.i_crypt_info = NULL;
304 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
305 AC_MSG_CHECKING([if i_crypt_info is in ext4_inode_info])
306 LB2_LINUX_TEST_RESULT([ext4_i_crypt_info], [
307 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
308 [enable encryption for ldiskfs])
309 test_have_i_crypt_info=yes
311 test_have_i_crypt_info=no
313 AS_IF([test x$test_have_i_crypt_info = xno], [
314 LB2_TEST_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
315 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
316 [enable encryption for ldiskfs])
319 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
322 # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
324 # kernel 4.18.0-240.1.1.el8 and
325 # kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
327 # ext4_journal_ensure_credits was introduced to ensure given handle
328 # has at least requested amount of credits available, and possibly
329 # restarting transaction if needed.
331 AC_DEFUN([LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS], [
332 LB2_LINUX_TEST_SRC([ext4_journal_ensure_credits], [
333 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
334 int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
335 int extend_cred, int revoke_cred) { return 0; }
337 ext4_journal_ensure_credits(NULL, 0, 0);
338 ],[-Werror],[],[__ext4_journal_ensure_credits])
340 AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
341 AC_MSG_CHECKING([if 'ext4_journal_ensure_credits' exists])
342 LB2_LINUX_TEST_RESULT([ext4_journal_ensure_credits], [
343 AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
344 ['ext4_journal_ensure_credits' exists])
346 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
349 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
351 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
352 # ext4_iget changed to a macro with 3 args was function with 2 args
354 AC_DEFUN([LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG], [
355 LB2_LINUX_TEST_SRC([ext4_iget_3args], [
356 #include <linux/fs.h>
357 #include "$EXT4_SRC_DIR/ext4.h"
359 int f = EXT4_IGET_SPECIAL;
363 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
364 AC_MSG_CHECKING([if ldiskfs_iget takes a flags argument])
365 LB2_LINUX_TEST_RESULT([ext4_iget_3args], [
366 AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
367 [if ldiskfs_iget takes a flags argument])
369 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
372 # LDISKFS_AC_PATCH_PROGRAM
374 # Determine which program should be used to apply the patches to
375 # the ext4 source code to produce the ldiskfs source code.
377 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
378 AC_ARG_ENABLE([quilt],
379 [AS_HELP_STRING([--disable-quilt],
380 [disable use of quilt for ldiskfs])],
381 [AS_IF([test "x$enableval" = xno],
387 AS_IF([test x$use_quilt = xmaybe], [
388 AC_PATH_PROG([quilt_avail], [quilt], [no])
389 AS_IF([test x$quilt_avail = xno], [
396 AS_IF([test x$use_quilt = xno], [
397 AC_PATH_PROG([patch_avail], [patch], [no])
398 AS_IF([test x$patch_avail = xno], [
399 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
402 ]) # LDISKFS_AC_PATCH_PROGRAM
405 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
407 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
408 # ext4: avoid declaring fs inconsistent due to invalid file handles
409 # __ext4_find_entry became a helper function for ext4_find_entry
410 # conflicting with previous ldiskfs patches.
411 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
412 # avoid conflicting with __ext4_find_entry
414 # When the following check succeeds __ext4_find_entry helper is not
417 AC_DEFUN([LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
418 LB2_LINUX_TEST_SRC([ldiskfs_find_entry_locked], [
419 #include <linux/fs.h>
420 #include "$EXT4_SRC_DIR/ext4.h"
421 #include "$EXT4_SRC_DIR/namei.c"
423 static int __ext4_find_entry(void) { return 0; }
425 int x = __ext4_find_entry();
429 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
430 AC_MSG_CHECKING([if __ldiskfs_find_entry is available])
431 LB2_LINUX_TEST_RESULT([ldiskfs_find_entry_locked], [
432 AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
433 [if __ldiskfs_find_entry is available])
435 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
438 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
440 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
441 # ext4fs_dirhash UNICODE support
443 AC_DEFUN([LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR], [
444 LB2_LINUX_TEST_SRC([ext4fs_dirhash], [
445 #include <linux/fs.h>
446 #include "$EXT4_SRC_DIR/ext4.h"
448 int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
450 ],[-Werror],[],[ext4fs_dirhash])
452 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
453 AC_MSG_CHECKING([if ldiskfsfs_dirhash takes an inode argument])
454 LB2_LINUX_TEST_RESULT([ext4fs_dirhash], [
455 AC_DEFINE(HAVE_LDISKFSFS_DIRHASH_WITH_DIR, 1,
456 [if ldiskfsfs_dirhash takes an inode argument])
458 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
461 # LB_JBD2_H_TOTAL_CREDITS
463 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
464 # jbd2: Reserve space for revoke descriptor blocks
466 AC_DEFUN([LB_SRC_JBD2_H_TOTAL_CREDITS], [
467 LB2_LINUX_TEST_SRC([handle_t_h_revoke_credits], [
468 #include <linux/jbd2.h>
470 int x = offsetof(struct jbd2_journal_handle, h_total_credits);
474 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
475 AC_MSG_CHECKING([if struct jbd2_journal_handle has h_total_credits member])
476 LB2_LINUX_TEST_RESULT([handle_t_h_revoke_credits], [
477 AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
478 [struct jbd2_journal_handle has h_total_credits member])
480 ]) # LB_JBD2_H_TOTAL_CREDITS
483 # LB_EXT4_INC_DEC_COUNT_2ARGS
485 # Linux v5.9-rc7-8-g15ed2851b0f4
486 # ext4: remove unused argument from ext4_(inc|dec)_count
488 AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
489 AC_MSG_CHECKING([if ext4_(inc|dec)_count() have 2 arguments])
490 AS_IF([grep -q -E 'void ext4_inc_count.handle_t \*handle' $EXT4_SRC_DIR/namei.c],[
491 AC_DEFINE(HAVE_EXT4_INC_DEC_COUNT_2ARGS, 1,
492 [ext4_(inc|dec)_count() has 2 arguments])
497 ]) # LB_EXT4_INC_DEC_COUNT_2ARGS
500 # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
501 # Linux commit v5.10-rc2-9-gede7dc7fa0af
502 # jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
504 AC_DEFUN([LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
505 LB2_LINUX_TEST_SRC([jbd2_journal_get_max_txn_bufs], [
506 #include <linux/jbd2.h>
508 journal_t *journal = NULL;
509 int x = jbd2_journal_get_max_txn_bufs(journal);
513 AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
514 AC_MSG_CHECKING([if jbd2_journal_get_max_txn_bufs is available])
515 LB2_LINUX_TEST_RESULT([jbd2_journal_get_max_txn_bufs], [
516 AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
517 [if jbd2_journal_get_max_txn_bufs is available])
519 ]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
522 # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
524 # Linux v5.14-rc2-19-g188c299e2a26
525 # ext4: Support for checksumming from journal triggers
527 AC_DEFUN([LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A], [
528 tmp_flags="$EXTRA_KCFLAGS"
529 EXTRA_KCFLAGS="-Werror"
530 LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
531 ext4_journal_get_write_access, [
532 #include <linux/fs.h>
533 #include "$EXT4_SRC_DIR/ext4.h"
534 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
536 int __ext4_journal_get_write_access(const char *where, unsigned int line,
538 struct super_block *sb,
539 struct buffer_head *bh,
540 enum ext4_journal_trigger_type trigger_type)
545 handle_t *handle = NULL;
546 struct super_block *sb = NULL;
547 struct buffer_head *bh = NULL;
548 enum ext4_journal_trigger_type trigger_type = EXT4_JTR_NONE;
549 int err = ext4_journal_get_write_access(handle, sb, bh, trigger_type);
553 AC_DEFINE(HAVE_EXT4_JOURNAL_GET_WRITE_ACCESS_4ARGS, 1,
554 [ext4_journal_get_write_access() has 4 arguments])
556 EXTRA_KCFLAGS="$tmp_flags"
557 ]) # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
559 # LB_HAVE_INODE_LOCK_SHARED
561 AC_DEFUN([LB_HAVE_INODE_LOCK_SHARED], [
562 LB_CHECK_COMPILE([if inode_lock_shared() defined],
564 #include <linux/fs.h>
568 inode_lock_shared(&i);
570 AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1,
571 [inode_lock_shared() defined])
573 ]) # LB_HAVE_INODE_LOCK_SHARED
575 # LB_HAVE_INODE_IVERSION
577 AC_DEFUN([LB_HAVE_INODE_IVERSION], [
578 LB_CHECK_COMPILE([if iversion primitives defined],
579 inode_set_iversion, [
580 #include <linux/iversion.h>
584 inode_set_iversion(&i, 0);
586 AC_DEFINE(HAVE_INODE_IVERSION, 1,
587 [iversion primitives defined])
589 ]) # LB_HAVE_INODE_IVERSION
594 AC_DEFUN([LB_CONFIG_LDISKFS], [
595 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
596 # However we continue to support this option through Lustre 2.5.
597 AC_ARG_WITH([ldiskfs],
599 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
600 AS_IF([test x$withval != xyes -a x$withval != xno],
603 The ldiskfs option is deprecated,
604 and no longer supports paths to external ldiskfs source
608 AC_ARG_ENABLE([ldiskfs],
609 [AS_HELP_STRING([--disable-ldiskfs],
610 [disable ldiskfs osd (default is enable)])],
611 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
612 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
613 [AS_IF([test "${with_ldiskfs+set}" = set],
614 [enable_ldiskfs=$with_ldiskfs],
615 [enable_ldiskfs=maybe])
618 AS_IF([test x$enable_server = xno],
619 [AS_CASE([$enable_ldiskfs],
620 [maybe], [enable_ldiskfs=no],
621 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
624 AS_IF([test x$enable_ldiskfs != xno],[
625 # In the future, we chould change enable_ldiskfs from maybe to
626 # either yes or no based on additional tests, e.g. whether a patch
627 # set is available for the detected kernel. For now, we just always
629 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
630 AC_SUBST(ENABLE_LDISKFS, yes)
633 LDISKFS_AC_PATCH_PROGRAM
634 LB_EXT4_INC_DEC_COUNT_2ARGS
635 LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
636 LB_HAVE_INODE_LOCK_SHARED
637 LB_HAVE_INODE_IVERSION
638 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
639 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
640 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
641 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
642 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
643 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
645 AC_SUBST(ENABLE_LDISKFS, no)
648 AC_MSG_CHECKING([whether to build ldiskfs])
649 AC_MSG_RESULT([$enable_ldiskfs])
651 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
652 ]) # LB_CONFIG_LDISKFS
654 AS_IF([test x$enable_ldiskfs != xno],[
655 AC_DEFUN([LB_EXT4_SRC_DIR_SRC],[
656 LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
657 LB_SRC_EXT4_JOURNAL_START_3ARGS
658 LB_SRC_EXT4_BREAD_4ARGS
659 LB_SRC_EXT4_HAVE_INFO_DQUOT
660 LB_SRC_EXT4_HAVE_I_CRYPT_INFO
661 LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS
662 LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG
663 LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
664 LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR
665 LB_SRC_JBD2_H_TOTAL_CREDITS
666 LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS
667 LB2_SRC_CHECK_CONFIG_IM([FS_ENCRYPTION])
669 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [
670 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
671 LB_EXT4_JOURNAL_START_3ARGS
673 LB_EXT4_HAVE_INFO_DQUOT
674 LB_EXT4_HAVE_I_CRYPT_INFO
675 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
676 LB_LDISKFS_IGET_HAS_FLAGS_ARG
677 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
678 LB_LDISKFSFS_DIRHASH_WANTS_DIR
679 LB_JBD2_H_TOTAL_CREDITS
680 LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
681 LB2_TEST_CHECK_CONFIG_IM([FS_ENCRYPTION], [
683 EXT4_CRYPTO='%/crypto.c'])
685 AC_SUBST(EXT4_CRYPTO)
689 # LB_VALIDATE_EXT4_SRC_DIR
691 # Spot check the existence of several source files common to ext4.
692 # Detecting this at configure time allows us to avoid a potential build
693 # failure and provide a useful error message to explain what is wrong.
695 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
696 enable_ldiskfs_build="no"
697 AS_IF([test -n "$EXT4_SRC_DIR"], [
698 enable_ldiskfs_build="yes"
699 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
700 enable_ldiskfs_build="no"
701 AC_MSG_WARN([ext4 must exist for ldiskfs build])
703 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
704 enable_ldiskfs_build="no"
705 AC_MSG_WARN([ext4 must exist for ldiskfs build])
707 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
708 enable_ldiskfs_build="no"
709 AC_MSG_WARN([ext4 must exist for ldiskfs build])
711 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
712 enable_ldiskfs_build="no"
713 AC_MSG_WARN([ext4 must exist for ldiskfs build])
717 AS_IF([test "x$enable_ldiskfs_build" = xno], [
722 Disabling ldiskfs support because complete ext4 source does not exist.
724 If you are building using kernel-devel packages and require ldiskfs
725 server support then ensure that the matching kernel-debuginfo-common
726 and kernel-debuginfo-common-<arch> packages are installed.
729 ]) # LB_VALIDATE_EXT4_SRC_DIR
734 # Determine the location of the ext4 source code. It it required
735 # for several configure tests and to build ldiskfs.
737 AC_DEFUN([LB_EXT4_SRC_DIR], [
738 AC_MSG_CHECKING([ext4 source directory])
739 # Kernel ext source located with devel headers
741 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
742 EXT4_SRC_DIR="$linux_src/fs/ext4"
744 # Kernel ext source provided by kernel-debuginfo-common package
745 # that extracted to $LINUX
746 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
747 2>/dev/null | tail -1)
748 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
749 EXT4_SRC_DIR="$linux_src/fs/ext4"
751 # Kernel ext source provided by kernel-debuginfo-common package
752 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
753 2>/dev/null | tail -1)
754 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
755 EXT4_SRC_DIR="$linux_src/fs/ext4"
761 AC_MSG_RESULT([$EXT4_SRC_DIR])
762 AC_SUBST(EXT4_SRC_DIR)
764 LB_VALIDATE_EXT4_SRC_DIR
768 # LB_DEFINE_E2FSPROGS_NAMES
770 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
772 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
773 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
774 AC_ARG_WITH([ldiskfsprogs],
775 AS_HELP_STRING([--with-ldiskfsprogs],
776 [use alternate names for ldiskfs-enabled e2fsprogs]),
779 AS_IF([test "x$withval" = xyes], [
780 AC_MSG_RESULT([enabled])
781 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
782 E2FSPROGS="ldiskfsprogs"
783 MKE2FS="mkfs.ldiskfs"
784 DEBUGFS="debugfs.ldiskfs"
785 TUNE2FS="tunefs.ldiskfs"
786 E2LABEL="label.ldiskfs"
787 DUMPE2FS="dumpfs.ldiskfs"
788 E2FSCK="fsck.ldiskfs"
789 PFSCK="pfsck.ldiskfs"
791 AC_MSG_RESULT([disabled])
792 E2FSPROGS="e2fsprogs"
802 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
803 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
804 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
805 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
806 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
807 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
808 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
809 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
811 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
812 AC_SUBST([MKE2FS], [$MKE2FS])
813 AC_SUBST([DEBUGFS], [$DEBUGFS])
814 AC_SUBST([TUNE2FS], [$TUNE2FS])
815 AC_SUBST([E2LABEL], [$E2LABEL])
816 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
817 AC_SUBST([E2FSCK], [$E2FSCK])
818 AC_SUBST([PFSCK], [$PFSCK])
819 ]) # LB_DEFINE_E2FSPROGS_NAMES