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 83) LDISKFS_SERIES="4.18-rhel8.3.series" ;;
37 82) LDISKFS_SERIES="4.18-rhel8.2.series" ;;
38 81) LDISKFS_SERIES="4.18-rhel8.1.series" ;;
39 80) LDISKFS_SERIES="4.18-rhel8.series" ;;
40 79) LDISKFS_SERIES="3.10-rhel7.9.series" ;;
41 78) LDISKFS_SERIES="3.10-rhel7.8.series" ;;
42 77) LDISKFS_SERIES="3.10-rhel7.7.series" ;;
43 76) LDISKFS_SERIES="3.10-rhel7.6.series" ;;
45 ], [test x$SUSE_KERNEL = xyes], [
46 AS_VERSION_COMPARE([$LINUXRELEASE],[5.3.18],[
47 AS_VERSION_COMPARE([$LINUXRELEASE],[4.12.14],[], [], [
48 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
49 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
50 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
51 case ${suse_vers}sp$suse_patchlevel in # (
52 15sp0 ) LDISKFS_SERIES="4.12-sles15.series"
53 if test ! -f $LINUX/arch/x86/kernel/cpu/hygon.c ; then
54 # This file was added shortly after -150.22 so
55 # this must be 150.22 or earlier
56 LDISKFS_SERIES="4.12-sles15-22.series"
59 15sp1 ) LDISKFS_SERIES="4.12-sles15sp1.series"
60 if test ! -f $LINUX/arch/x86/kernel/cpu/umwait.c ; then
61 # This file was added after -197.7 so
62 # this must be -197.7 or earlier
63 LDISKFS_SERIES="4.12-sles15sp1-7.series"
68 )], [LDISKFS_SERIES="5.4.21-ml.series"],
70 suse_conf=$LINUX_OBJ/include/generated/uapi/linux/suse_version.h
71 suse_vers=$(awk '[$]2 == "SUSE_VERSION" {print [$]3 }' $suse_conf)
72 suse_patchlevel=$(awk '[$]2 == "SUSE_PATCHLEVEL" {print [$]3 }' $suse_conf)
73 case ${suse_vers}sp${suse_patchlevel} in # (
74 15sp2 ) LDISKFS_SERIES="5.4.21-ml.series"
75 grep -A3 ext4_update_dx_flag $LINUX/fs/ext4/ext4.h \
76 | grep ext4_test_inode_flag
77 if test $? -eq 0; then
78 LDISKFS_SERIES="5.4.0-66-ubuntu20.series"
81 15sp3 ) LDISKFS_SERIES="5.3.18-sles15sp3.series"
82 update=$(echo $LINUXRELEASE | cut -d- -f2 | cut -d. -f2)
83 if test $update -ge 59; then
84 LDISKFS_SERIES="5.3.18-sles15sp3-59.series"
87 15sp4 ) LDISKFS_SERIES="5.14.21-sles15sp4.series"
89 15sp5 ) LDISKFS_SERIES="5.14.21-sles15sp5.series"
93 ], [test x$UBUNTU_KERNEL = xyes], [
94 BASEVER=$(echo $LINUXRELEASE | cut -d'-' -f1)
95 AS_VERSION_COMPARE([$BASEVER],[5.15.0],[
96 AS_VERSION_COMPARE([$BASEVER],[5.11.0],[
97 AS_VERSION_COMPARE([$BASEVER],[5.8.0],[
98 AS_VERSION_COMPARE([$BASEVER],[5.4.0],[
99 AS_VERSION_COMPARE([$BASEVER],[5.0.0],[
100 AS_VERSION_COMPARE([$BASEVER],[4.15.0],[
101 AS_VERSION_COMPARE([$BASEVER],[4.4.0], [],
103 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
105 [test -z "$KPLEV"], [
106 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
107 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
109 [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
110 [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
111 [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
112 [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
115 [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
117 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
119 [test -z "$KPLEV"], [
120 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
121 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
123 [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
124 [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
127 [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
128 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
129 [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])],
131 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
133 [test -z "$KPLEV"], [
134 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
135 LDISKFS_SERIES="5.4.0-90-ubuntu20.series"
137 [test $KPLEV -eq 1007], [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"],
138 [test $KPLEV -ge 90], [LDISKFS_SERIES="5.4.0-90-ubuntu20.series"],
139 [test $KPLEV -ge 80], [LDISKFS_SERIES="5.4.0-80-ubuntu20.series"],
140 [test $KPLEV -ge 66], [LDISKFS_SERIES="5.4.0-66-ubuntu20.series"],
141 [LDISKFS_SERIES="5.4.0-42-ubuntu20.series"]
144 [LDISKFS_SERIES="5.4.0-ml.series"])],
146 KPLEV=$(echo $LINUXRELEASE | cut -d'-' -f2)
148 [test -z "$KPLEV"], [
149 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
150 LDISKFS_SERIES="5.8.0-63-ubuntu20.series"
152 [test $KPLEV -ge 63], [LDISKFS_SERIES="5.8.0-63-ubuntu20.series"],
153 [LDISKFS_SERIES="5.8.0-53-ubuntu20.series"]
156 [LDISKFS_SERIES="5.8.0-ml.series"])],
157 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"],
158 [LDISKFS_SERIES="5.11.0-40-ubuntu20.series"])],
159 [LDISKFS_SERIES="5.15.0-83-ubuntu20.series"],
160 [LDISKFS_SERIES="5.15.0-83-ubuntu20.series"])
161 ], [test x$OPENEULER_KERNEL = xyes], [
162 case $OPENEULER_VERSION_NO in
163 2203.0) LDISKFS_SERIES="5.10.0-oe2203.series" ;;
164 2203.*) LDISKFS_SERIES="5.10.0-oe2203sp1.series" ;;
168 # Not RHEL/SLES/openEuler or Ubuntu .. probably mainline
169 AS_IF([test -z "$LDISKFS_SERIES"],
171 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
172 [LDISKFS_SERIES="5.4.0-ml.series"],[
173 AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.21],
174 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
175 [LDISKFS_SERIES="5.4.21-ml.series"], # eq
176 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.8.0],
177 [LDISKFS_SERIES="5.4.136-ml.series"], # lt
178 [LDISKFS_SERIES="5.8.0-ml.series"], # eq
179 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.9.0],
180 [LDISKFS_SERIES="5.8.0-ml.series"], # lt
181 [LDISKFS_SERIES="5.9.0-ml.series"], # eq
182 [AS_VERSION_COMPARE([$LINUXRELEASE],[5.10.0],
183 [LDISKFS_SERIES="5.9.0-ml.series"], # lt
184 [LDISKFS_SERIES="5.10.0-ml.series"], # eq
185 [LDISKFS_SERIES="5.10.0-ml.series"], # gt
192 AS_IF([test -z "$LDISKFS_SERIES"],
193 [AC_MSG_RESULT([failed to identify series])],
194 [AC_MSG_RESULT([$LDISKFS_SERIES for $LINUXRELEASE])])
195 AC_SUBST(LDISKFS_SERIES)
196 ]) # LDISKFS_LINUX_SERIES
199 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
201 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
202 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
204 AC_DEFUN([LB_SRC_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
205 LB2_LINUX_TEST_SRC([ext4_free_blocks_with_buffer_head], [
206 #include <linux/fs.h>
207 #include "$EXT4_SRC_DIR/ext4.h"
209 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
210 ],[],[],[ext4_free_blocks])
212 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
213 LB2_MSG_LINUX_TEST_RESULT([if 'ext4_free_blocks' needs 'struct buffer_head'],
214 [ext4_free_blocks_with_buffer_head], [
215 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
216 [ext4_free_blocks do not require struct buffer_head])
218 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
221 # LB_EXT4_BREAD_4ARGS
223 # 3.18 ext4_bread has 4 arguments
224 # NOTE: It may not be exported for modules, use a positive compiler test here.
226 AC_DEFUN([LB_SRC_EXT4_BREAD_4ARGS], [
227 LB2_LINUX_TEST_SRC([ext4_bread], [
228 #include <linux/fs.h>
229 #include "$EXT4_SRC_DIR/ext4.h"
231 struct buffer_head *ext4_bread(handle_t *handle,
233 ext4_lblk_t block, int map_flags)
235 struct buffer_head *bh = NULL;
243 ext4_bread(NULL, NULL, 0, 0);
244 ],[],[],[ext4_bread])
246 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
247 LB2_MSG_LINUX_TEST_RESULT([if ext4_bread takes 4 arguments],
249 AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1,
250 [ext4_bread takes 4 arguments])
252 ]) # LB_EXT4_BREAD_4ARGS
255 # LB_EXT4_HAVE_INFO_DQUOT
257 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
259 AC_DEFUN([LB_SRC_EXT4_HAVE_INFO_DQUOT], [
260 LB2_LINUX_TEST_SRC([ext4_info_dquot], [
261 #include <linux/fs.h>
262 #include <linux/quota.h>
263 #include "$EXT4_SRC_DIR/ext4.h"
265 struct ext4_inode_info in;
271 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
272 LB2_MSG_LINUX_TEST_RESULT([if i_dquot is in ext4_inode_info],
274 AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1,
275 [i_dquot is in ext4_inode_info])
277 ]) # LB_EXT4_HAVE_INFO_DQUOT
280 # LB_EXT4_HAVE_I_CRYPT_INFO
282 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
284 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
285 # If we have i_crypt_info in ext4_inode_info, the config option
286 # should be enabled to make the ldiskfs module compilation happy.
287 # Otherwise i_crypy_info is in struct inode, we need to check kernel
288 # config option to determine that.
290 AC_DEFUN([LB_SRC_EXT4_HAVE_I_CRYPT_INFO], [
291 LB2_SRC_CHECK_CONFIG([EXT4_FS_ENCRYPTION])
292 LB2_LINUX_TEST_SRC([ext4_i_crypt_info], [
293 #define CONFIG_EXT4_FS_ENCRYPTION 1
294 #include <linux/fs.h>
295 #include "$EXT4_SRC_DIR/ext4.h"
297 struct ext4_inode_info in;
299 in.i_crypt_info = NULL;
302 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
303 LB2_MSG_LINUX_TEST_RESULT([if i_crypt_info is in ext4_inode_info],
304 [ext4_i_crypt_info], [
305 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
306 [enable encryption for ldiskfs])
307 test_have_i_crypt_info=yes
309 test_have_i_crypt_info=no
311 AS_IF([test x$test_have_i_crypt_info = xno], [
312 LB2_TEST_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
313 AC_DEFINE(CONFIG_LDISKFS_FS_ENCRYPTION, 1,
314 [enable encryption for ldiskfs])
317 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
320 # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
322 # kernel 4.18.0-240.1.1.el8 and
323 # kernel 5.4 commit a413036791d040e33badcc634453a4d0c0705499
325 # ext4_journal_ensure_credits was introduced to ensure given handle
326 # has at least requested amount of credits available, and possibly
327 # restarting transaction if needed.
329 AC_DEFUN([LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS], [
330 LB2_LINUX_TEST_SRC([ext4_journal_ensure_credits], [
331 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
332 int __ext4_journal_ensure_credits(handle_t *handle, int check_cred,
333 int extend_cred, int revoke_cred) { return 0; }
335 ext4_journal_ensure_credits(NULL, 0, 0);
336 ],[-Werror],[],[__ext4_journal_ensure_credits])
338 AC_DEFUN([LB_LDISKFS_JOURNAL_ENSURE_CREDITS], [
339 LB2_MSG_LINUX_TEST_RESULT([if 'ext4_journal_ensure_credits' exists],
340 [ext4_journal_ensure_credits], [
341 AC_DEFINE(HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS, 1,
342 ['ext4_journal_ensure_credits' exists])
344 ]) # LB_LDISKFS_JOURNAL_ENSURE_CREDITS
347 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
349 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
350 # ext4_iget changed to a macro with 3 args was function with 2 args
352 AC_DEFUN([LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG], [
353 LB2_LINUX_TEST_SRC([ext4_iget_3args], [
354 #include <linux/fs.h>
355 #include "$EXT4_SRC_DIR/ext4.h"
357 int f = EXT4_IGET_SPECIAL;
361 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
362 LB2_MSG_LINUX_TEST_RESULT([if ldiskfs_iget takes a flags argument],
364 AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
365 [if ldiskfs_iget takes a flags argument])
367 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
370 # LDISKFS_AC_PATCH_PROGRAM
372 # Determine which program should be used to apply the patches to
373 # the ext4 source code to produce the ldiskfs source code.
375 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
376 AC_ARG_ENABLE([quilt],
377 [AS_HELP_STRING([--disable-quilt],
378 [disable use of quilt for ldiskfs])],
379 [AS_IF([test "x$enableval" = xno],
385 AS_IF([test x$use_quilt = xmaybe], [
386 AC_PATH_PROG([quilt_avail], [quilt], [no])
387 AS_IF([test x$quilt_avail = xno], [
394 AS_IF([test x$use_quilt = xno], [
395 AC_PATH_PROG([patch_avail], [patch], [no])
396 AS_IF([test x$patch_avail = xno], [
397 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
400 ]) # LDISKFS_AC_PATCH_PROGRAM
403 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
405 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
406 # ext4: avoid declaring fs inconsistent due to invalid file handles
407 # __ext4_find_entry became a helper function for ext4_find_entry
408 # conflicting with previous ldiskfs patches.
409 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
410 # avoid conflicting with __ext4_find_entry
412 # When the following check succeeds __ext4_find_entry helper is not
415 AC_DEFUN([LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
416 LB2_LINUX_TEST_SRC([ldiskfs_find_entry_locked], [
417 #include <linux/fs.h>
418 #include "$EXT4_SRC_DIR/ext4.h"
419 #include "$EXT4_SRC_DIR/namei.c"
421 static int __ext4_find_entry(void) { return 0; }
423 int x = __ext4_find_entry();
427 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
428 LB2_MSG_LINUX_TEST_RESULT([if __ldiskfs_find_entry is available],
429 [ldiskfs_find_entry_locked], [
430 AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
431 [if __ldiskfs_find_entry is available])
433 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
436 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
438 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
439 # ext4fs_dirhash UNICODE support
441 AC_DEFUN([LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR], [
442 LB2_LINUX_TEST_SRC([ext4fs_dirhash], [
443 #include <linux/fs.h>
444 #include "$EXT4_SRC_DIR/ext4.h"
446 int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
448 ],[-Werror],[],[ext4fs_dirhash])
450 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
451 LB2_MSG_LINUX_TEST_RESULT([if ldiskfsfs_dirhash takes an inode argument],
453 AC_DEFINE(HAVE_LDISKFSFS_DIRHASH_WITH_DIR, 1,
454 [if ldiskfsfs_dirhash takes an inode argument])
456 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
459 # LB_JBD2_H_TOTAL_CREDITS
461 # kernel 5.5 commit 933f1c1e0b75bbc29730eef07c9e196c6dfd37e5
462 # jbd2: Reserve space for revoke descriptor blocks
464 AC_DEFUN([LB_SRC_JBD2_H_TOTAL_CREDITS], [
465 LB2_LINUX_TEST_SRC([handle_t_h_revoke_credits], [
466 #include <linux/jbd2.h>
468 int x = offsetof(struct jbd2_journal_handle, h_total_credits);
472 AC_DEFUN([LB_JBD2_H_TOTAL_CREDITS], [
473 LB2_MSG_LINUX_TEST_RESULT([if struct jbd2_journal_handle has h_total_credits member],
474 [handle_t_h_revoke_credits], [
475 AC_DEFINE(HAVE_JOURNAL_TOTAL_CREDITS, 1,
476 [struct jbd2_journal_handle has h_total_credits member])
478 ]) # LB_JBD2_H_TOTAL_CREDITS
481 # LB_EXT4_INC_DEC_COUNT_2ARGS
483 # Linux v5.9-rc7-8-g15ed2851b0f4
484 # ext4: remove unused argument from ext4_(inc|dec)_count
486 AC_DEFUN([LB_EXT4_INC_DEC_COUNT_2ARGS], [
487 AC_MSG_CHECKING([if ext4_(inc|dec)_count() have 2 arguments])
488 AS_IF([grep -q -E 'void ext4_inc_count.handle_t \*handle' $EXT4_SRC_DIR/namei.c],[
489 AC_DEFINE(HAVE_EXT4_INC_DEC_COUNT_2ARGS, 1,
490 [ext4_(inc|dec)_count() has 2 arguments])
495 ]) # LB_EXT4_INC_DEC_COUNT_2ARGS
498 # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
499 # Linux commit v5.10-rc2-9-gede7dc7fa0af
500 # jbd2: rename j_maxlen to j_total_len and add jbd2_journal_max_txn_bufs
502 AC_DEFUN([LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
503 LB2_LINUX_TEST_SRC([jbd2_journal_get_max_txn_bufs], [
504 #include <linux/jbd2.h>
506 journal_t *journal = NULL;
507 int x = jbd2_journal_get_max_txn_bufs(journal);
511 AC_DEFUN([LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS], [
512 LB2_MSG_LINUX_TEST_RESULT([if jbd2_journal_get_max_txn_bufs is available],
513 [jbd2_journal_get_max_txn_bufs], [
514 AC_DEFINE(HAVE_JBD2_JOURNAL_GET_MAX_TXN_BUFS, 1,
515 [if jbd2_journal_get_max_txn_bufs is available])
517 ]) # LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
520 # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
522 # Linux v5.14-rc2-19-g188c299e2a26
523 # ext4: Support for checksumming from journal triggers
525 AC_DEFUN([LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A], [
526 tmp_flags="$EXTRA_KCFLAGS"
527 EXTRA_KCFLAGS="-Werror"
528 LB_CHECK_COMPILE([if jbd2_journal_get_max_txn_bufs is available],
529 ext4_journal_get_write_access, [
530 #include <linux/fs.h>
531 #include "$EXT4_SRC_DIR/ext4.h"
532 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
534 int __ext4_journal_get_write_access(const char *where, unsigned int line,
536 struct super_block *sb,
537 struct buffer_head *bh,
538 enum ext4_journal_trigger_type trigger_type)
543 handle_t *handle = NULL;
544 struct super_block *sb = NULL;
545 struct buffer_head *bh = NULL;
546 enum ext4_journal_trigger_type trigger_type = EXT4_JTR_NONE;
547 int err = ext4_journal_get_write_access(handle, sb, bh, trigger_type);
551 AC_DEFINE(HAVE_EXT4_JOURNAL_GET_WRITE_ACCESS_4ARGS, 1,
552 [ext4_journal_get_write_access() has 4 arguments])
554 EXTRA_KCFLAGS="$tmp_flags"
555 ]) # LB_EXT4_JOURNAL_GET_WRITE_ACCESS_4A
558 # LB_HAVE_INODE_LOCK_SHARED
560 AC_DEFUN([LB_HAVE_INODE_LOCK_SHARED], [
561 LB_CHECK_COMPILE([if inode_lock_shared() defined],
563 #include <linux/fs.h>
567 inode_lock_shared(&i);
569 AC_DEFINE(HAVE_INODE_LOCK_SHARED, 1,
570 [inode_lock_shared() defined])
572 ]) # 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_BREAD_4ARGS
658 LB_SRC_EXT4_HAVE_INFO_DQUOT
659 LB_SRC_EXT4_HAVE_I_CRYPT_INFO
660 LB_SRC_LDISKFS_JOURNAL_ENSURE_CREDITS
661 LB_SRC_LDISKFS_IGET_HAS_FLAGS_ARG
662 LB_SRC_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
663 LB_SRC_LDISKFSFS_DIRHASH_WANTS_DIR
664 LB_SRC_JBD2_H_TOTAL_CREDITS
665 LB_SRC_JBD2_JOURNAL_GET_MAX_TXN_BUFS
666 LB2_SRC_CHECK_CONFIG_IM([FS_ENCRYPTION])
668 AC_DEFUN([LB_EXT4_SRC_DIR_RESULTS], [
669 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
671 LB_EXT4_HAVE_INFO_DQUOT
672 LB_EXT4_HAVE_I_CRYPT_INFO
673 LB_LDISKFS_JOURNAL_ENSURE_CREDITS
674 LB_LDISKFS_IGET_HAS_FLAGS_ARG
675 LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
676 LB_LDISKFSFS_DIRHASH_WANTS_DIR
677 LB_JBD2_H_TOTAL_CREDITS
678 LB_JBD2_JOURNAL_GET_MAX_TXN_BUFS
679 LB2_TEST_CHECK_CONFIG_IM([FS_ENCRYPTION], [
681 EXT4_CRYPTO='%/crypto.c'])
683 AC_SUBST(EXT4_CRYPTO)
687 # LB_VALIDATE_EXT4_SRC_DIR
689 # Spot check the existence of several source files common to ext4.
690 # Detecting this at configure time allows us to avoid a potential build
691 # failure and provide a useful error message to explain what is wrong.
693 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
694 enable_ldiskfs_build="no"
695 AS_IF([test -n "$EXT4_SRC_DIR"], [
696 enable_ldiskfs_build="yes"
697 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
698 enable_ldiskfs_build="no"
699 AC_MSG_WARN([ext4 must exist for ldiskfs build])
701 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
702 enable_ldiskfs_build="no"
703 AC_MSG_WARN([ext4 must exist for ldiskfs build])
705 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
706 enable_ldiskfs_build="no"
707 AC_MSG_WARN([ext4 must exist for ldiskfs build])
709 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
710 enable_ldiskfs_build="no"
711 AC_MSG_WARN([ext4 must exist for ldiskfs build])
715 AS_IF([test "x$enable_ldiskfs_build" = xno], [
720 Disabling ldiskfs support because complete ext4 source does not exist.
722 If you are building using kernel-devel packages and require ldiskfs
723 server support then ensure that the matching kernel-debuginfo-common
724 and kernel-debuginfo-common-<arch> packages are installed.
727 ]) # LB_VALIDATE_EXT4_SRC_DIR
732 # Determine the location of the ext4 source code. It it required
733 # for several configure tests and to build ldiskfs.
735 AC_DEFUN([LB_EXT4_SRC_DIR], [
736 AC_MSG_CHECKING([ext4 source directory])
737 # Kernel ext source located with devel headers
739 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
740 EXT4_SRC_DIR="$linux_src/fs/ext4"
742 # Kernel ext source provided by kernel-debuginfo-common package
743 # that extracted to $LINUX
744 linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
745 2>/dev/null | tail -1)
746 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
747 EXT4_SRC_DIR="$linux_src/fs/ext4"
749 # Kernel ext source provided by kernel-debuginfo-common package
750 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
751 2>/dev/null | tail -1)
752 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
753 EXT4_SRC_DIR="$linux_src/fs/ext4"
759 AC_MSG_RESULT([$EXT4_SRC_DIR])
760 AC_SUBST(EXT4_SRC_DIR)
762 LB_VALIDATE_EXT4_SRC_DIR
766 # LB_DEFINE_E2FSPROGS_NAMES
768 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
770 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
771 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
772 AC_ARG_WITH([ldiskfsprogs],
773 AS_HELP_STRING([--with-ldiskfsprogs],
774 [use alternate names for ldiskfs-enabled e2fsprogs]),
777 AS_IF([test "x$withval" = xyes], [
778 AC_MSG_RESULT([enabled])
779 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
780 E2FSPROGS="ldiskfsprogs"
781 MKE2FS="mkfs.ldiskfs"
782 DEBUGFS="debugfs.ldiskfs"
783 TUNE2FS="tunefs.ldiskfs"
784 E2LABEL="label.ldiskfs"
785 DUMPE2FS="dumpfs.ldiskfs"
786 E2FSCK="fsck.ldiskfs"
787 PFSCK="pfsck.ldiskfs"
789 AC_MSG_RESULT([disabled])
790 E2FSPROGS="e2fsprogs"
800 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
801 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
802 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
803 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
804 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
805 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
806 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
807 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
809 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
810 AC_SUBST([MKE2FS], [$MKE2FS])
811 AC_SUBST([DEBUGFS], [$DEBUGFS])
812 AC_SUBST([TUNE2FS], [$TUNE2FS])
813 AC_SUBST([E2LABEL], [$E2LABEL])
814 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
815 AC_SUBST([E2FSCK], [$E2FSCK])
816 AC_SUBST([PFSCK], [$PFSCK])
817 ]) # LB_DEFINE_E2FSPROGS_NAMES