1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
6 # config/lustre-build-ldiskfs.m4
8 # ldiskfs OSD related configuration
12 # LDISKFS_LINUX_SERIES
14 AC_DEFUN([LDISKFS_LINUX_SERIES], [
15 AC_MSG_CHECKING([which ldiskfs series to use])
16 case x$LDISKFS_SERIES in
19 *.series) # set externally
23 AS_IF([test -z "$LDISKFS_SERIES"], [
24 AS_IF([test x$RHEL_KERNEL = xyes], [
25 case $RHEL_RELEASE_NO in
26 93) LDISKFS_SERIES="5.14-rhel9.3.series" ;;
27 92) LDISKFS_SERIES="5.14-rhel9.2.series" ;;
28 91) LDISKFS_SERIES="5.14-rhel9.1.series" ;;
29 90) LDISKFS_SERIES="5.14-rhel9.series" ;;
30 89) LDISKFS_SERIES="4.18-rhel8.9.series" ;;
31 88) LDISKFS_SERIES="4.18-rhel8.8.series" ;;
32 87) LDISKFS_SERIES="4.18-rhel8.7.series" ;;
33 86) LDISKFS_SERIES="4.18-rhel8.6.series" ;;
34 85) LDISKFS_SERIES="4.18-rhel8.5.series" ;;
35 84) LDISKFS_SERIES="4.18-rhel8.4.series" ;;
36 79) LDISKFS_SERIES="3.10-rhel7.9.series" ;;
38 ], [test x$SUSE_KERNEL = xyes], [
39 AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
40 AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
41 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
42 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
43 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
44 case ${suse_vers}sp$suse_patchlevel in # (
45 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
46 if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
47 # This file was added shortly after -150.22 so
48 # this must be 150.22 or earlier
49 LDISKFS_SERIES="4.12-sles15-22.series"
52 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
53 if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
54 # This file was added after -197.7 so
55 # this must be -197.7 or earlier
56 LDISKFS_SERIES="4.12-sles15sp1-7.series"
61 )], [LDISKFS_SERIES="5.4.21-ml.series"],
63 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
64 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
65 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
66 case ${suse_vers}sp${suse_patchlevel} in # (
67 15sp2 ) LDISKFS_SERIES="5.4.21-ml.series"
68 grep -A3 ext4_update_dx_flag $LINUX/fs/ext4/ext4.h \
69 | grep ext4_test_inode_flag
70 if test $? -eq 0; then
71 LDISKFS_SERIES="5.4.0-66-ubuntu20.series"
74 15sp3 ) LDISKFS_SERIES="5.3.18-sles15sp3.series"
75 update=$(echo $LINUXRELEASE | cut -d- -f2 | cut -d. -f2)
76 if test $update -ge 59; then
77 LDISKFS_SERIES="5.3.18-sles15sp3-59.series"
80 15sp4 ) LDISKFS_SERIES="5.14.21-sles15sp4.series"
82 15sp5 ) LDISKFS_SERIES="5.14.21-sles15sp5.series"
86 ], [test x$UBUNTU_KERNEL = xyes], [
87 BASEVER=$(echo $LINUXRELEASE | cut -d'-' -f1)
88 AS_VERSION_COMPARE([$BASEVER],[5.15.0],[
89 AS_VERSION_COMPARE([$BASEVER],[5.11.0],[
90 AS_VERSION_COMPARE([$BASEVER],[5.8.0],[
91 AS_VERSION_COMPARE([$BASEVER],[5.4.0],[
92 AS_VERSION_COMPARE([$BASEVER],[5.0.0],[
93 AS_VERSION_COMPARE([$BASEVER],[4.15.0],[
94 AS_VERSION_COMPARE([$BASEVER],[4.4.0], [],
96 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
99 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
100 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
102 [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
103 [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
104 [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
105 [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
108 [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.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="4.15.0-24-ubuntu18.series"
116 [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
117 [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
120 [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
121 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
122 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
124 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
126 [test -z "$KPLEV"], [
127 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
128 LDISKFS_SERIES="5.4.0-90-ubuntu20.series"
130 [test $KPLEV -eq 1007], [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
131 [test $KPLEV -ge 90], [LDISKFS_SERIES="5.4.0-90-ubuntu20.series"],
132 [test $KPLEV -ge 80], [LDISKFS_SERIES="5.4.0-80-ubuntu20.series"],
133 [test $KPLEV -ge 66], [LDISKFS_SERIES="5.4.0-66-ubuntu20.series"],
134 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"]
137 [LDISKFS_SERIES="5.4.0-ml.series"])],
139 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
141 [test -z "$KPLEV"], [
142 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
143 LDISKFS_SERIES="5.8.0-63-ubuntu20.series"
145 [test $KPLEV -ge 63], [LDISKFS_SERIES="5.8.0-63-ubuntu20.series"],
146 [LDISKFS_SERIES="5.8.0-53-ubuntu20.series"]
149 [LDISKFS_SERIES="5.8.0-ml.series"])],
150 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"],
151 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"])],
152 [LDISKFS_SERIES="5.15.0-83-ubuntu20.series"],
153 [LDISKFS_SERIES="5.15.0-83-ubuntu20.series"])
154 ], [test x$OPENEULER_KERNEL = xyes], [
155 case $OPENEULER_VERSION_NO in
156 2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;;
157 2203.*) LDISKFS_SERIES="5.10.0-oe2203sp1.series" ;;
161 # Not RHEL/SLES/openEuler or Ubuntu .. probably mainline
162 AS_IF([test -z "$LDISKFS_SERIES"],
164 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
165 [LDISKFS_SERIES="5.4.0-ml.series"],[
166 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
167 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
168 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
169 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],
170 [LDISKFS_SERIES="5.4.136-ml.series"], # lt
171 [LDISKFS_SERIES="5.8.0-ml.series"], # eq
172 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.9.0],
173 [LDISKFS_SERIES="5.8.0-ml.series"], # lt
174 [LDISKFS_SERIES="5.9.0-ml.series"], # eq
175 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.10.0],
176 [LDISKFS_SERIES="5.9.0-ml.series"], # lt
177 [LDISKFS_SERIES="5.10.0-ml.series"], # eq
178 [LDISKFS_SERIES="5.10.0-ml.series"], # gt
185 AS_IF([test -z "$LDISKFS_SERIES"],
186 [AC_MSG_RESULT([failed to identify series])],
187 [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
188 AC_SUBST(LDISKFS_SERIES)
189 ]) # LDISKFS_LINUX_SERIES
192 # LB_EXT4_BREAD_4ARGS
194 # 3.18 ext4_bread has 4 arguments
195 # NOTE: It may not be exported for modules, use a positive compiler test here.
197 AC_DEFUN([LB_SRC_EXT4_BREAD_4ARGS], [
198 LB2_LINUX_TEST_SRC([ext4_bread], [
199 #include <linux/fs.h>
200 #include "$EXT4_SRC_DIR/ext4.h"
202 struct buffer_head *ext4_bread(handle_t *handle,
204 ext4_lblk_t block, int map_flags)
206 struct buffer_head *bh = NULL;
214 ext4_bread(NULL, NULL, 0, 0);
215 ],[],[],[ext4_bread])
217 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
218 LB2_MSG_LINUX_TEST_RESULT([if ext4_bread takes 4 arguments],
220 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1,
221 [ext4_bread takes 4 arguments])
223 ]) # LB_EXT4_BREAD_4ARGS
226 # LB_EXT4_HAVE_INFO_DQUOT
228 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
230 AC_DEFUN([LB_SRC_EXT4_HAVE_INFO_DQUOT], [
231 LB2_LINUX_TEST_SRC([ext4_info_dquot], [
232 #include <linux/fs.h>
233 #include <linux/quota.h>
234 #include "$EXT4_SRC_DIR/ext4.h"
236 struct ext4_inode_info in;
242 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
243 LB2_MSG_LINUX_TEST_RESULT([if i_dquot is in ext4_inode_info],
245 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1,
246 [i_dquot is in ext4_inode_info])
248 ]) # LB_EXT4_HAVE_INFO_DQUOT
251 # LB_EXT4_HAVE_I_CRYPT_INFO
253 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
255 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
256 # If we have i_crypt_info in ext4_inode_info, the config option
257 # should be enabled to make the ldiskfs module compilation happy.
258 # Otherwise i_crypy_info is in struct inode, we need to check kernel
259 # config option to determine that.
261 AC_DEFUN([LB_SRC_EXT4_HAVE_I_CRYPT_INFO], [
262 LB2_SRC_CHECK_CONFIG([EXT4_FS_ENCRYPTION])
263 LB2_LINUX_TEST_SRC([ext4_i_crypt_info], [
264 #define CONFIG_EXT4_FS_ENCRYPTION 1
265 #include <linux/fs.h>
266 #include "$EXT4_SRC_DIR/ext4.h"
268 struct ext4_inode_info in;
270 in.i_crypt_info = NULL;
273 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
274 LB2_MSG_LINUX_TEST_RESULT([if i_crypt_info is in ext4_inode_info],
275 [ext4_i_crypt_info], [
276 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
277 [enable encryption for ldiskfs])
278 test_have_i_crypt_info=yes
280 test_have_i_crypt_info=no
282 AS_IF([test x$test_have_i_crypt_info = xno], [
283 LB2_TEST_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
284 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
285 [enable encryption for ldiskfs])
288 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
291 # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
293 # kernel 4.18.0-240.1.1.el8 and
294 # kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
296 # ext4_journal_ensure_credits was introduced to ensure given handle
297 # has at least requested amount of credits available, and possibly
298 # restarting transaction if needed.
300 AC_DEFUN([LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS], [
301 LB2_LINUX_TEST_SRC([ext4_journal_ensure_credits], [
302 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
303 int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
304 int extend_cred, int revoke_cred) { return 0; }
306 ext4_journal_ensure_credits(NULL, 0, 0);
307 ],[-Werror],[],[__ext4_journal_ensure_credits])
309 AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
310 LB2_MSG_LINUX_TEST_RESULT([if 'ext4_journal_ensure_credits' exists],
311 [ext4_journal_ensure_credits], [
312 AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
313 ['ext4_journal_ensure_credits' exists])
315 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
318 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
320 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
321 # ext4_iget changed to a macro with 3 args was function with 2 args
323 AC_DEFUN([LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG], [
324 LB2_LINUX_TEST_SRC([ext4_iget_3args], [
325 #include <linux/fs.h>
326 #include "$EXT4_SRC_DIR/ext4.h"
328 int f = EXT4_IGET_SPECIAL;
332 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
333 LB2_MSG_LINUX_TEST_RESULT([if ldiskfs_iget takes a flags argument],
335 AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
336 [if ldiskfs_iget takes a flags argument])
338 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
341 # LDISKFS_AC_PATCH_PROGRAM
343 # Determine which program should be used to apply the patches to
344 # the ext4 source code to produce the ldiskfs source code.
346 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
347 AC_ARG_ENABLE([quilt],
348 [AS_HELP_STRING([--disable-quilt],
349 [disable use of quilt for ldiskfs])],
350 [AS_IF([test "x$enableval" = xno],
356 AS_IF([test x$use_quilt = xmaybe], [
357 AC_PATH_PROG([quilt_avail], [quilt], [no])
358 AS_IF([test x$quilt_avail = xno], [
365 AS_IF([test x$use_quilt = xno], [
366 AC_PATH_PROG([patch_avail], [patch], [no])
367 AS_IF([test x$patch_avail = xno], [
368 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
371 ]) # LDISKFS_AC_PATCH_PROGRAM
374 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
376 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
377 # ext4: avoid declaring fs inconsistent due to invalid file handles
378 # __ext4_find_entry became a helper function for ext4_find_entry
379 # conflicting with previous ldiskfs patches.
380 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
381 # avoid conflicting with __ext4_find_entry
383 # When the following check succeeds __ext4_find_entry helper is not
386 AC_DEFUN([LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
387 LB2_LINUX_TEST_SRC([ldiskfs_find_entry_locked], [
388 #include <linux/fs.h>
389 #include "$EXT4_SRC_DIR/ext4.h"
390 #include "$EXT4_SRC_DIR/namei.c"
392 static int __ext4_find_entry(void) { return 0; }
394 int x = __ext4_find_entry();
398 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
399 LB2_MSG_LINUX_TEST_RESULT([if __ldiskfs_find_entry is available],
400 [ldiskfs_find_entry_locked], [
401 AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
402 [if __ldiskfs_find_entry is available])
404 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
407 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
409 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
410 # ext4fs_dirhash UNICODE support
412 AC_DEFUN([LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR], [
413 LB2_LINUX_TEST_SRC([ext4fs_dirhash], [
414 #include <linux/fs.h>
415 #include "$EXT4_SRC_DIR/ext4.h"
417 int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
419 ],[-Werror],[],[ext4fs_dirhash])
421 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
422 LB2_MSG_LINUX_TEST_RESULT([if ldiskfsfs_dirhash takes an inode argument],
424 AC_DEFINE(HAVE_LDISKFSFS_DIRHASH_WITH_DIR, 1,
425 [if ldiskfsfs_dirhash takes an inode argument])
427 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
430 # LB_JBD2_H_TOTAL_CREDITS
432 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
433 # jbd2: Reserve space for revoke descriptor blocks
435 AC_DEFUN([LB_SRC_JBD2_H_TOTAL_CREDITS], [
436 LB2_LINUX_TEST_SRC([handle_t_h_revoke_credits], [
437 #include <linux/jbd2.h>
439 int x = offsetof(struct jbd2_journal_handle, h_total_credits);
443 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
444 LB2_MSG_LINUX_TEST_RESULT([if struct jbd2_journal_handle has h_total_credits member],
445 [handle_t_h_revoke_credits], [
446 AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
447 [struct jbd2_journal_handle has h_total_credits member])
449 ]) # LB_JBD2_H_TOTAL_CREDITS
452 # LB_EXT4_INC_DEC_COUNT_2ARGS
454 # Linux v5.9-rc7-8-g15ed2851b0f4
455 # ext4: remove unused argument from ext4_(inc|dec)_count
457 AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
458 AC_MSG_CHECKING([if ext4_(inc|dec)_count() have 2 arguments])
459 AS_IF([grep -q -E 'void ext4_inc_count.handle_t \*handle' $EXT4_SRC_DIR/namei.c],[
460 AC_DEFINE(HAVE_EXT4_INC_DEC_COUNT_2ARGS, 1,
461 [ext4_(inc|dec)_count() has 2 arguments])
466 ]) # LB_EXT4_INC_DEC_COUNT_2ARGS
469 # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
470 # Linux commit v5.10-rc2-9-gede7dc7fa0af
471 # jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
473 AC_DEFUN([LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
474 LB2_LINUX_TEST_SRC([jbd2_journal_get_max_txn_bufs], [
475 #include <linux/jbd2.h>
477 journal_t *journal = NULL;
478 int x = jbd2_journal_get_max_txn_bufs(journal);
482 AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
483 LB2_MSG_LINUX_TEST_RESULT([if jbd2_journal_get_max_txn_bufs is available],
484 [jbd2_journal_get_max_txn_bufs], [
485 AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
486 [if jbd2_journal_get_max_txn_bufs is available])
488 ]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
491 # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
493 # Linux v5.14-rc2-19-g188c299e2a26
494 # ext4: Support for checksumming from journal triggers
496 AC_DEFUN([LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A], [
497 tmp_flags="$EXTRA_KCFLAGS"
498 EXTRA_KCFLAGS="-Werror"
499 LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
500 ext4_journal_get_write_access, [
501 #include <linux/fs.h>
502 #include "$EXT4_SRC_DIR/ext4.h"
503 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
505 int __ext4_journal_get_write_access(const char *where, unsigned int line,
507 struct super_block *sb,
508 struct buffer_head *bh,
509 enum ext4_journal_trigger_type trigger_type)
514 handle_t *handle = NULL;
515 struct super_block *sb = NULL;
516 struct buffer_head *bh = NULL;
517 enum ext4_journal_trigger_type trigger_type = EXT4_JTR_NONE;
518 int err = ext4_journal_get_write_access(handle, sb, bh, trigger_type);
522 AC_DEFINE(HAVE_EXT4_JOURNAL_GET_WRITE_ACCESS_4ARGS, 1,
523 [ext4_journal_get_write_access() has 4 arguments])
525 EXTRA_KCFLAGS="$tmp_flags"
526 ]) # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
529 # LB_HAVE_INODE_LOCK_SHARED
531 AC_DEFUN([LB_HAVE_INODE_LOCK_SHARED], [
532 LB_CHECK_COMPILE([if inode_lock_shared() defined],
534 #include <linux/fs.h>
538 inode_lock_shared(&i);
540 AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1,
541 [inode_lock_shared() defined])
543 ]) # LB_HAVE_INODE_LOCK_SHARED
546 # LB_HAVE_INODE_IVERSION
548 AC_DEFUN([LB_HAVE_INODE_IVERSION], [
549 LB_CHECK_COMPILE([if iversion primitives defined],
550 inode_set_iversion, [
551 #include <linux/iversion.h>
555 inode_set_iversion(&i, 0);
557 AC_DEFINE(HAVE_INODE_IVERSION, 1,
558 [iversion primitives defined])
560 ]) # LB_HAVE_INODE_IVERSION
565 AC_DEFUN([LB_CONFIG_LDISKFS], [
566 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
567 # However we continue to support this option through Lustre 2.5.
568 AC_ARG_WITH([ldiskfs],
570 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
571 AS_IF([test x$withval != xyes -a x$withval != xno],
574 The ldiskfs option is deprecated,
575 and no longer supports paths to external ldiskfs source
579 AC_ARG_ENABLE([ldiskfs],
580 [AS_HELP_STRING([--disable-ldiskfs],
581 [disable ldiskfs osd (default is enable)])],
582 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
583 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
584 [AS_IF([test "${with_ldiskfs+set}" = set],
585 [enable_ldiskfs=$with_ldiskfs],
586 [enable_ldiskfs=maybe])
589 AS_IF([test x$enable_server = xno],
590 [AS_CASE([$enable_ldiskfs],
591 [maybe], [enable_ldiskfs=no],
592 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
595 AS_IF([test x$enable_ldiskfs != xno],[
596 # In the future, we chould change enable_ldiskfs from maybe to
597 # either yes or no based on additional tests, e.g. whether a patch
598 # set is available for the detected kernel. For now, we just always
600 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
601 AC_SUBST(ENABLE_LDISKFS, yes)
604 LDISKFS_AC_PATCH_PROGRAM
605 LB_EXT4_INC_DEC_COUNT_2ARGS
606 LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
607 LB_HAVE_INODE_LOCK_SHARED
608 LB_HAVE_INODE_IVERSION
609 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
610 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
611 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
612 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
613 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
614 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
616 AC_SUBST(ENABLE_LDISKFS, no)
619 AC_MSG_CHECKING([whether to build ldiskfs])
620 AC_MSG_RESULT([$enable_ldiskfs])
622 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
623 ]) # LB_CONFIG_LDISKFS
625 AS_IF([test x$enable_ldiskfs != xno],[
626 AC_DEFUN([LB_EXT4_SRC_DIR_SRC],[
627 LB_SRC_EXT4_BREAD_4ARGS
628 LB_SRC_EXT4_HAVE_INFO_DQUOT
629 LB_SRC_EXT4_HAVE_I_CRYPT_INFO
630 LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS
631 LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG
632 LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
633 LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR
634 LB_SRC_JBD2_H_TOTAL_CREDITS
635 LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS
636 LB2_SRC_CHECK_CONFIG_IM([FS_ENCRYPTION])
638 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [
640 LB_EXT4_HAVE_INFO_DQUOT
641 LB_EXT4_HAVE_I_CRYPT_INFO
642 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
643 LB_LDISKFS_IGET_HAS_FLAGS_ARG
644 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
645 LB_LDISKFSFS_DIRHASH_WANTS_DIR
646 LB_JBD2_H_TOTAL_CREDITS
647 LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
648 LB2_TEST_CHECK_CONFIG_IM([FS_ENCRYPTION], [
650 EXT4_CRYPTO='%/crypto.c'])
652 AC_SUBST(EXT4_CRYPTO)
656 # LB_VALIDATE_EXT4_SRC_DIR
658 # Spot check the existence of several source files common to ext4.
659 # Detecting this at configure time allows us to avoid a potential build
660 # failure and provide a useful error message to explain what is wrong.
662 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
663 enable_ldiskfs_build="no"
664 AS_IF([test -n "$EXT4_SRC_DIR"], [
665 enable_ldiskfs_build="yes"
666 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
667 enable_ldiskfs_build="no"
668 AC_MSG_WARN([ext4 must exist for ldiskfs build])
670 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
671 enable_ldiskfs_build="no"
672 AC_MSG_WARN([ext4 must exist for ldiskfs build])
674 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
675 enable_ldiskfs_build="no"
676 AC_MSG_WARN([ext4 must exist for ldiskfs build])
678 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
679 enable_ldiskfs_build="no"
680 AC_MSG_WARN([ext4 must exist for ldiskfs build])
684 AS_IF([test "x$enable_ldiskfs_build" = xno], [
689 Disabling ldiskfs support because complete ext4 source does not exist.
691 If you are building using kernel-devel packages and require ldiskfs
692 server support then ensure that the matching kernel-debuginfo-common
693 and kernel-debuginfo-common-<arch> packages are installed.
696 ]) # LB_VALIDATE_EXT4_SRC_DIR
701 # Determine the location of the ext4 source code. It it required
702 # for several configure tests and to build ldiskfs.
704 AC_DEFUN([LB_EXT4_SRC_DIR], [
705 AC_MSG_CHECKING([ext4 source directory])
706 # Kernel ext source located with devel headers
708 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
709 EXT4_SRC_DIR="$linux_src/fs/ext4"
711 # Kernel ext source provided by kernel-debuginfo-common package
712 # that extracted to $LINUX
713 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
714 2>/dev/null | tail -1)
715 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
716 EXT4_SRC_DIR="$linux_src/fs/ext4"
718 # Kernel ext source provided by kernel-debuginfo-common package
719 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
720 2>/dev/null | tail -1)
721 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
722 EXT4_SRC_DIR="$linux_src/fs/ext4"
728 AC_MSG_RESULT([$EXT4_SRC_DIR])
729 AC_SUBST(EXT4_SRC_DIR)
731 LB_VALIDATE_EXT4_SRC_DIR
735 # LB_DEFINE_E2FSPROGS_NAMES
737 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
739 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
740 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
741 AC_ARG_WITH([ldiskfsprogs],
742 AS_HELP_STRING([--with-ldiskfsprogs],
743 [use alternate names for ldiskfs-enabled e2fsprogs]),
746 AS_IF([test "x$withval" = xyes], [
747 AC_MSG_RESULT([enabled])
748 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
749 E2FSPROGS="ldiskfsprogs"
750 MKE2FS="mkfs.ldiskfs"
751 DEBUGFS="debugfs.ldiskfs"
752 TUNE2FS="tunefs.ldiskfs"
753 E2LABEL="label.ldiskfs"
754 DUMPE2FS="dumpfs.ldiskfs"
755 E2FSCK="fsck.ldiskfs"
756 PFSCK="pfsck.ldiskfs"
758 AC_MSG_RESULT([disabled])
759 E2FSPROGS="e2fsprogs"
769 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
770 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
771 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
772 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
773 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
774 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
775 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
776 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
778 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
779 AC_SUBST([MKE2FS], [$MKE2FS])
780 AC_SUBST([DEBUGFS], [$DEBUGFS])
781 AC_SUBST([TUNE2FS], [$TUNE2FS])
782 AC_SUBST([E2LABEL], [$E2LABEL])
783 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
784 AC_SUBST([E2FSCK], [$E2FSCK])
785 AC_SUBST([PFSCK], [$PFSCK])
786 ]) # LB_DEFINE_E2FSPROGS_NAMES