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 91) LDISKFS_SERIES="5.14-rhel9.1.series" ;;
17 90) LDISKFS_SERIES="5.14-rhel9.series" ;;
18 87) LDISKFS_SERIES="4.18-rhel8.7.series" ;;
19 86) LDISKFS_SERIES="4.18-rhel8.6.series" ;;
20 85) LDISKFS_SERIES="4.18-rhel8.5.series" ;;
21 84) LDISKFS_SERIES="4.18-rhel8.4.series" ;;
22 83) LDISKFS_SERIES="4.18-rhel8.3.series" ;;
23 82) LDISKFS_SERIES="4.18-rhel8.2.series" ;;
24 81) LDISKFS_SERIES="4.18-rhel8.1.series" ;;
25 80) LDISKFS_SERIES="4.18-rhel8.series" ;;
26 79) LDISKFS_SERIES="3.10-rhel7.9.series" ;;
27 78) LDISKFS_SERIES="3.10-rhel7.8.series" ;;
28 77) LDISKFS_SERIES="3.10-rhel7.7.series" ;;
29 76) LDISKFS_SERIES="3.10-rhel7.6.series" ;;
31 ], [test x$SUSE_KERNEL = xyes], [
32 AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
33 AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
34 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
35 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
36 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
37 case ${suse_vers}sp$suse_patchlevel in # (
38 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
39 if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
40 # This file was added shortly after -150.22 so
41 # this must be 150.22 or earlier
42 LDISKFS_SERIES="4.12-sles15-22.series"
45 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
46 if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
47 # This file was added after -197.7 so
48 # this must be -197.7 or earlier
49 LDISKFS_SERIES="4.12-sles15sp1-7.series"
54 )], [LDISKFS_SERIES="5.4.21-ml.series"],
56 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
57 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
58 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
59 case ${suse_vers}sp${suse_patchlevel} in # (
60 15sp2 ) LDISKFS_SERIES="5.4.21-ml.series"
61 grep -A3 ext4_update_dx_flag $LINUX/fs/ext4/ext4.h \
62 | grep ext4_test_inode_flag
63 if test $? -eq 0; then
64 LDISKFS_SERIES="5.4.0-66-ubuntu20.series"
67 15sp3 ) LDISKFS_SERIES="5.3.18-sles15sp3.series"
69 15sp4 ) LDISKFS_SERIES="5.14.21-sles15sp4.series"
73 ], [test x$UBUNTU_KERNEL = xyes], [
74 BASEVER=$(echo $LINUXRELEASE | cut -d'-' -f1)
75 AS_VERSION_COMPARE([$BASEVER],[5.11.0],[
76 AS_VERSION_COMPARE([$BASEVER],[5.8.0],[
77 AS_VERSION_COMPARE([$BASEVER],[5.4.0],[
78 AS_VERSION_COMPARE([$BASEVER],[5.0.0],[
79 AS_VERSION_COMPARE([$BASEVER],[4.15.0],[
80 AS_VERSION_COMPARE([$BASEVER],[4.4.0], [],
82 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
85 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
86 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
88 [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
89 [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
90 [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
91 [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
94 [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
96 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
99 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
100 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
102 [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
103 [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
106 [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
107 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
108 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
110 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
112 [test -z "$KPLEV"], [
113 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
114 LDISKFS_SERIES="5.4.0-90-ubuntu20.series"
116 [test $KPLEV -eq 1007], [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
117 [test $KPLEV -ge 90], [LDISKFS_SERIES="5.4.0-90-ubuntu20.series"],
118 [test $KPLEV -ge 80], [LDISKFS_SERIES="5.4.0-80-ubuntu20.series"],
119 [test $KPLEV -ge 66], [LDISKFS_SERIES="5.4.0-66-ubuntu20.series"],
120 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"]
123 [LDISKFS_SERIES="5.4.0-ml.series"])],
125 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
127 [test -z "$KPLEV"], [
128 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
129 LDISKFS_SERIES="5.8.0-63-ubuntu20.series"
131 [test $KPLEV -ge 63], [LDISKFS_SERIES="5.8.0-63-ubuntu20.series"],
132 [LDISKFS_SERIES="5.8.0-53-ubuntu20.series"]
135 [LDISKFS_SERIES="5.8.0-ml.series"])],
136 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"],
137 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"])
138 ], [test x$OPENEULER_KERNEL = xyes], [
139 case $OPENEULER_VERSION_NO in
140 2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;;
144 # Not RHEL/SLES/openEuler or Ubuntu .. probably mainline
145 AS_IF([test -z "$LDISKFS_SERIES"],
147 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
148 [LDISKFS_SERIES="5.4.0-ml.series"],[
149 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
150 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
151 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
152 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],
153 [LDISKFS_SERIES="5.4.136-ml.series"], # lt
154 [LDISKFS_SERIES="5.8.0-ml.series"], # eq
155 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.9.0],
156 [LDISKFS_SERIES="5.8.0-ml.series"], # lt
157 [LDISKFS_SERIES="5.9.0-ml.series"], # eq
158 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.10.0],
159 [LDISKFS_SERIES="5.9.0-ml.series"], # lt
160 [LDISKFS_SERIES="5.10.0-ml.series"], # eq
161 [LDISKFS_SERIES="5.10.0-ml.series"], # gt
168 AS_IF([test -z "$LDISKFS_SERIES"],
169 [AC_MSG_RESULT([failed to identify series])],
170 [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
171 AC_SUBST(LDISKFS_SERIES)
172 ]) # LDISKFS_LINUX_SERIES
175 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
177 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
178 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
180 AC_DEFUN([LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
181 LB2_LINUX_TEST_SRC([ext4_free_blocks_with_buffer_head], [
182 #include <linux/fs.h>
183 #include "$EXT4_SRC_DIR/ext4.h"
185 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
186 ],[],[],[ext4_free_blocks])
188 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
189 AC_MSG_CHECKING([if 'ext4_free_blocks' needs 'struct buffer_head'])
190 LB2_LINUX_TEST_RESULT([ext4_free_blocks_with_buffer_head], [
191 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
192 [ext4_free_blocks do not require struct buffer_head])
194 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
197 # LB_EXT4_JOURNAL_START_3ARGS
199 # 3.9 added a type argument to ext4_journal_start and friends
201 AC_DEFUN([LB_SRC_EXT4_JOURNAL_START_3ARGS], [
202 LB2_LINUX_TEST_SRC([ext4_journal_start], [
203 #include <linux/fs.h>
204 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
206 ext4_journal_start(NULL, 0, 0);
207 ],[],[],[__ext4_journal_start_sb])
209 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
210 AC_MSG_CHECKING([if ext4_journal_start takes 3 arguments])
211 LB2_LINUX_TEST_RESULT([ext4_journal_start], [
212 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1,
213 [ext4_journal_start takes 3 arguments])
215 ]) # LB_EXT4_JOURNAL_START_3ARGS
218 # LB_EXT4_BREAD_4ARGS
220 # 3.18 ext4_bread has 4 arguments
221 # NOTE: It may not be exported for modules, use a positive compiler test here.
223 AC_DEFUN([LB_SRC_EXT4_BREAD_4ARGS], [
224 LB2_LINUX_TEST_SRC([ext4_bread], [
225 #include <linux/fs.h>
226 #include "$EXT4_SRC_DIR/ext4.h"
228 struct buffer_head *ext4_bread(handle_t *handle,
230 ext4_lblk_t block, int map_flags)
232 struct buffer_head *bh = NULL;
240 ext4_bread(NULL, NULL, 0, 0);
241 ],[],[],[ext4_bread])
243 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
244 AC_MSG_CHECKING([if ext4_bread takes 4 arguments])
245 LB2_LINUX_TEST_RESULT([ext4_bread], [
246 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1,
247 [ext4_bread takes 4 arguments])
249 ]) # LB_EXT4_BREAD_4ARGS
252 # LB_EXT4_HAVE_INFO_DQUOT
254 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
256 AC_DEFUN([LB_SRC_EXT4_HAVE_INFO_DQUOT], [
257 LB2_LINUX_TEST_SRC([ext4_info_dquot], [
258 #include <linux/fs.h>
259 #include <linux/quota.h>
260 #include "$EXT4_SRC_DIR/ext4.h"
262 struct ext4_inode_info in;
268 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
269 AC_MSG_CHECKING([if i_dquot is in ext4_inode_info])
270 LB2_LINUX_TEST_RESULT([ext4_info_dquot], [
271 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1,
272 [i_dquot is in ext4_inode_info])
274 ]) # LB_EXT4_HAVE_INFO_DQUOT
277 # LB_EXT4_HAVE_I_CRYPT_INFO
279 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
281 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
282 # If we have i_crypt_info in ext4_inode_info, the config option
283 # should be enabled to make the ldiskfs module compilation happy.
284 # Otherwise i_crypy_info is in struct inode, we need to check kernel
285 # config option to determine that.
287 AC_DEFUN([LB_SRC_EXT4_HAVE_I_CRYPT_INFO], [
288 LB2_SRC_CHECK_CONFIG([EXT4_FS_ENCRYPTION])
289 LB2_LINUX_TEST_SRC([ext4_i_crypt_info], [
290 #define CONFIG_EXT4_FS_ENCRYPTION 1
291 #include <linux/fs.h>
292 #include "$EXT4_SRC_DIR/ext4.h"
294 struct ext4_inode_info in;
296 in.i_crypt_info = NULL;
299 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
300 AC_MSG_CHECKING([if i_crypt_info is in ext4_inode_info])
301 LB2_LINUX_TEST_RESULT([ext4_i_crypt_info], [
302 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
303 [enable encryption for ldiskfs])
304 test_have_i_crypt_info=yes
306 test_have_i_crypt_info=no
308 AS_IF([test x$test_have_i_crypt_info = xno], [
309 LB2_TEST_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
310 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
311 [enable encryption for ldiskfs])
314 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
317 # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
319 # kernel 4.18.0-240.1.1.el8 and
320 # kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
322 # ext4_journal_ensure_credits was introduced to ensure given handle
323 # has at least requested amount of credits available, and possibly
324 # restarting transaction if needed.
326 AC_DEFUN([LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS], [
327 LB2_LINUX_TEST_SRC([ext4_journal_ensure_credits], [
328 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
329 int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
330 int extend_cred, int revoke_cred) { return 0; }
332 ext4_journal_ensure_credits(NULL, 0, 0);
333 ],[-Werror],[],[__ext4_journal_ensure_credits])
335 AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
336 AC_MSG_CHECKING([if 'ext4_journal_ensure_credits' exists])
337 LB2_LINUX_TEST_RESULT([ext4_journal_ensure_credits], [
338 AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
339 ['ext4_journal_ensure_credits' exists])
341 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
344 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
346 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
347 # ext4_iget changed to a macro with 3 args was function with 2 args
349 AC_DEFUN([LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG], [
350 LB2_LINUX_TEST_SRC([ext4_iget_3args], [
351 #include <linux/fs.h>
352 #include "$EXT4_SRC_DIR/ext4.h"
354 int f = EXT4_IGET_SPECIAL;
358 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
359 AC_MSG_CHECKING([if ldiskfs_iget takes a flags argument])
360 LB2_LINUX_TEST_RESULT([ext4_iget_3args], [
361 AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
362 [if ldiskfs_iget takes a flags argument])
364 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
367 # LDISKFS_AC_PATCH_PROGRAM
369 # Determine which program should be used to apply the patches to
370 # the ext4 source code to produce the ldiskfs source code.
372 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
373 AC_ARG_ENABLE([quilt],
374 [AS_HELP_STRING([--disable-quilt],
375 [disable use of quilt for ldiskfs])],
376 [AS_IF([test "x$enableval" = xno],
382 AS_IF([test x$use_quilt = xmaybe], [
383 AC_PATH_PROG([quilt_avail], [quilt], [no])
384 AS_IF([test x$quilt_avail = xno], [
391 AS_IF([test x$use_quilt = xno], [
392 AC_PATH_PROG([patch_avail], [patch], [no])
393 AS_IF([test x$patch_avail = xno], [
394 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
397 ]) # LDISKFS_AC_PATCH_PROGRAM
400 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
402 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
403 # ext4: avoid declaring fs inconsistent due to invalid file handles
404 # __ext4_find_entry became a helper function for ext4_find_entry
405 # conflicting with previous ldiskfs patches.
406 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
407 # avoid conflicting with __ext4_find_entry
409 # When the following check succeeds __ext4_find_entry helper is not
412 AC_DEFUN([LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
413 LB2_LINUX_TEST_SRC([ldiskfs_find_entry_locked], [
414 #include <linux/fs.h>
415 #include "$EXT4_SRC_DIR/ext4.h"
416 #include "$EXT4_SRC_DIR/namei.c"
418 static int __ext4_find_entry(void) { return 0; }
420 int x = __ext4_find_entry();
424 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
425 AC_MSG_CHECKING([if __ldiskfs_find_entry is available])
426 LB2_LINUX_TEST_RESULT([ldiskfs_find_entry_locked], [
427 AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
428 [if __ldiskfs_find_entry is available])
430 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
433 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
435 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
436 # ext4fs_dirhash UNICODE support
438 AC_DEFUN([LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR], [
439 LB2_LINUX_TEST_SRC([ext4fs_dirhash], [
440 #include <linux/fs.h>
441 #include "$EXT4_SRC_DIR/ext4.h"
443 int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
445 ],[-Werror],[],[ext4fs_dirhash])
447 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
448 AC_MSG_CHECKING([if ldiskfsfs_dirhash takes an inode argument])
449 LB2_LINUX_TEST_RESULT([ext4fs_dirhash], [
450 AC_DEFINE(HAVE_LDISKFSFS_DIRHASH_WITH_DIR, 1,
451 [if ldiskfsfs_dirhash takes an inode argument])
453 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
456 # LB_JBD2_H_TOTAL_CREDITS
458 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
459 # jbd2: Reserve space for revoke descriptor blocks
461 AC_DEFUN([LB_SRC_JBD2_H_TOTAL_CREDITS], [
462 LB2_LINUX_TEST_SRC([handle_t_h_revoke_credits], [
463 #include <linux/jbd2.h>
465 int x = offsetof(struct jbd2_journal_handle, h_total_credits);
469 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
470 AC_MSG_CHECKING([if struct jbd2_journal_handle has h_total_credits member])
471 LB2_LINUX_TEST_RESULT([handle_t_h_revoke_credits], [
472 AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
473 [struct jbd2_journal_handle has h_total_credits member])
475 ]) # LB_JBD2_H_TOTAL_CREDITS
478 # LB_EXT4_INC_DEC_COUNT_2ARGS
480 # Linux v5.9-rc7-8-g15ed2851b0f4
481 # ext4: remove unused argument from ext4_(inc|dec)_count
483 AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
484 AC_MSG_CHECKING([if ext4_(inc|dec)_count() have 2 arguments])
485 AS_IF([grep -q -E 'void ext4_inc_count.handle_t \*handle' $EXT4_SRC_DIR/namei.c],[
486 AC_DEFINE(HAVE_EXT4_INC_DEC_COUNT_2ARGS, 1,
487 [ext4_(inc|dec)_count() has 2 arguments])
492 ]) # LB_EXT4_INC_DEC_COUNT_2ARGS
495 # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
496 # Linux commit v5.10-rc2-9-gede7dc7fa0af
497 # jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
499 AC_DEFUN([LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
500 LB2_LINUX_TEST_SRC([jbd2_journal_get_max_txn_bufs], [
501 #include <linux/jbd2.h>
503 journal_t *journal = NULL;
504 int x = jbd2_journal_get_max_txn_bufs(journal);
508 AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
509 AC_MSG_CHECKING([if jbd2_journal_get_max_txn_bufs is available])
510 LB2_LINUX_TEST_RESULT([jbd2_journal_get_max_txn_bufs], [
511 AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
512 [if jbd2_journal_get_max_txn_bufs is available])
514 ]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
517 # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
519 # Linux v5.14-rc2-19-g188c299e2a26
520 # ext4: Support for checksumming from journal triggers
522 AC_DEFUN([LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A], [
523 tmp_flags="$EXTRA_KCFLAGS"
524 EXTRA_KCFLAGS="-Werror"
525 LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
526 ext4_journal_get_write_access, [
527 #include <linux/fs.h>
528 #include "$EXT4_SRC_DIR/ext4.h"
529 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
531 int __ext4_journal_get_write_access(const char *where, unsigned int line,
533 struct super_block *sb,
534 struct buffer_head *bh,
535 enum ext4_journal_trigger_type trigger_type)
540 handle_t *handle = NULL;
541 struct super_block *sb = NULL;
542 struct buffer_head *bh = NULL;
543 enum ext4_journal_trigger_type trigger_type = EXT4_JTR_NONE;
544 int err = ext4_journal_get_write_access(handle, sb, bh, trigger_type);
548 AC_DEFINE(HAVE_EXT4_JOURNAL_GET_WRITE_ACCESS_4ARGS, 1,
549 [ext4_journal_get_write_access() has 4 arguments])
551 EXTRA_KCFLAGS="$tmp_flags"
552 ]) # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
557 AC_DEFUN([LB_CONFIG_LDISKFS], [
558 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
559 # However we continue to support this option through Lustre 2.5.
560 AC_ARG_WITH([ldiskfs],
562 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
563 AS_IF([test x$withval != xyes -a x$withval != xno],
566 The ldiskfs option is deprecated,
567 and no longer supports paths to external ldiskfs source
571 AC_ARG_ENABLE([ldiskfs],
572 [AS_HELP_STRING([--disable-ldiskfs],
573 [disable ldiskfs osd (default is enable)])],
574 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
575 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
576 [AS_IF([test "${with_ldiskfs+set}" = set],
577 [enable_ldiskfs=$with_ldiskfs],
578 [enable_ldiskfs=maybe])
581 AS_IF([test x$enable_server = xno],
582 [AS_CASE([$enable_ldiskfs],
583 [maybe], [enable_ldiskfs=no],
584 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
587 AS_IF([test x$enable_ldiskfs != xno],[
588 # In the future, we chould change enable_ldiskfs from maybe to
589 # either yes or no based on additional tests, e.g. whether a patch
590 # set is available for the detected kernel. For now, we just always
592 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
593 AC_SUBST(ENABLE_LDISKFS, yes)
596 LDISKFS_AC_PATCH_PROGRAM
597 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
598 LB_EXT4_JOURNAL_START_3ARGS
600 LB_EXT4_HAVE_INFO_DQUOT
601 LB_EXT4_HAVE_I_CRYPT_INFO
602 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
603 LB_LDISKFS_IGET_HAS_FLAGS_ARG
604 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
605 LB_LDISKFSFS_DIRHASH_WANTS_DIR
606 LB_JBD2_H_TOTAL_CREDITS
607 LB_EXT4_INC_DEC_COUNT_2ARGS
608 LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
609 LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
610 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
611 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
612 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
613 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
614 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
615 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
617 AC_SUBST(ENABLE_LDISKFS, no)
620 AC_MSG_CHECKING([whether to build ldiskfs])
621 AC_MSG_RESULT([$enable_ldiskfs])
623 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
624 ]) # LB_CONFIG_LDISKFS
626 AS_IF([test x$enable_ldiskfs != xno],[
627 AC_DEFUN([LB_EXT4_SRC_DIR_SRC],[
628 LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
629 LB_SRC_EXT4_JOURNAL_START_3ARGS
630 LB_SRC_EXT4_BREAD_4ARGS
631 LB_SRC_EXT4_HAVE_INFO_DQUOT
632 LB_SRC_EXT4_HAVE_I_CRYPT_INFO
633 LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS
634 LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG
635 LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
636 LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR
637 LB_SRC_JBD2_H_TOTAL_CREDITS
638 LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS
640 LB2_LINUX_TEST_COMPILE_ALL([ldiskfs],
641 [for available ldiskfs ext4 interfaces])
643 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [
644 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
645 LB_EXT4_JOURNAL_START_3ARGS
647 LB_EXT4_HAVE_INFO_DQUOT
648 LB_EXT4_HAVE_I_CRYPT_INFO
649 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
650 LB_LDISKFS_IGET_HAS_FLAGS_ARG
651 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
652 LB_LDISKFSFS_DIRHASH_WANTS_DIR
653 LB_JBD2_H_TOTAL_CREDITS
654 LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
659 # LB_VALIDATE_EXT4_SRC_DIR
661 # Spot check the existence of several source files common to ext4.
662 # Detecting this at configure time allows us to avoid a potential build
663 # failure and provide a useful error message to explain what is wrong.
665 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
666 enable_ldiskfs_build="no"
667 AS_IF([test -n "$EXT4_SRC_DIR"], [
668 enable_ldiskfs_build="yes"
669 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
670 enable_ldiskfs_build="no"
671 AC_MSG_WARN([ext4 must exist for ldiskfs build])
673 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
674 enable_ldiskfs_build="no"
675 AC_MSG_WARN([ext4 must exist for ldiskfs build])
677 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
678 enable_ldiskfs_build="no"
679 AC_MSG_WARN([ext4 must exist for ldiskfs build])
681 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
682 enable_ldiskfs_build="no"
683 AC_MSG_WARN([ext4 must exist for ldiskfs build])
687 AS_IF([test "x$enable_ldiskfs_build" = xno], [
692 Disabling ldiskfs support because complete ext4 source does not exist.
694 If you are building using kernel-devel packages and require ldiskfs
695 server support then ensure that the matching kernel-debuginfo-common
696 and kernel-debuginfo-common-<arch> packages are installed.
699 ]) # LB_VALIDATE_EXT4_SRC_DIR
704 # Determine the location of the ext4 source code. It it required
705 # for several configure tests and to build ldiskfs.
707 AC_DEFUN([LB_EXT4_SRC_DIR], [
708 AC_MSG_CHECKING([ext4 source directory])
709 # Kernel ext source located with devel headers
711 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
712 EXT4_SRC_DIR="$linux_src/fs/ext4"
714 # Kernel ext source provided by kernel-debuginfo-common package
715 # that extracted to $LINUX
716 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
717 2>/dev/null | tail -1)
718 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
719 EXT4_SRC_DIR="$linux_src/fs/ext4"
721 # Kernel ext source provided by kernel-debuginfo-common package
722 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
723 2>/dev/null | tail -1)
724 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
725 EXT4_SRC_DIR="$linux_src/fs/ext4"
731 AC_MSG_RESULT([$EXT4_SRC_DIR])
732 AC_SUBST(EXT4_SRC_DIR)
734 LB_VALIDATE_EXT4_SRC_DIR
738 # LB_DEFINE_E2FSPROGS_NAMES
740 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
742 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
743 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
744 AC_ARG_WITH([ldiskfsprogs],
745 AS_HELP_STRING([--with-ldiskfsprogs],
746 [use alternate names for ldiskfs-enabled e2fsprogs]),
749 AS_IF([test "x$withval" = xyes], [
750 AC_MSG_RESULT([enabled])
751 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
752 E2FSPROGS="ldiskfsprogs"
753 MKE2FS="mkfs.ldiskfs"
754 DEBUGFS="debugfs.ldiskfs"
755 TUNE2FS="tunefs.ldiskfs"
756 E2LABEL="label.ldiskfs"
757 DUMPE2FS="dumpfs.ldiskfs"
758 E2FSCK="fsck.ldiskfs"
759 PFSCK="pfsck.ldiskfs"
761 AC_MSG_RESULT([disabled])
762 E2FSPROGS="e2fsprogs"
772 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
773 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
774 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
775 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
776 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
777 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
778 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
779 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
781 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
782 AC_SUBST([MKE2FS], [$MKE2FS])
783 AC_SUBST([DEBUGFS], [$DEBUGFS])
784 AC_SUBST([TUNE2FS], [$TUNE2FS])
785 AC_SUBST([E2LABEL], [$E2LABEL])
786 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
787 AC_SUBST([E2FSCK], [$E2FSCK])
788 AC_SUBST([PFSCK], [$PFSCK])
789 ]) # LB_DEFINE_E2FSPROGS_NAMES