===================================================================
--- e2fsprogs.orig/configure.in
+++ e2fsprogs/configure.in
-@@ -212,6 +212,54 @@ Q=@
+@@ -212,6 +212,62 @@ Q=@
AC_SUBST(E)
AC_SUBST(Q)
dnl
+then
+ LFSCK_CMT=#
+ LFSCK_MAN=.\"
++ ENABLE_LFSCK="--disable-lfsck"
+ echo "Disabling Lustre lfsck support"
+else
+ LFSCK_CMT=
+ LFSCK_MAN=
-+ AC_DEFINE(ENABLE_LFSCK)
++ ENABLE_LFSCK="--enable-lfsck"
++ AC_DEFINE(HAVE_LFSCK)
+ echo "Enabling Lustre lfsck support"
+fi
+,
+LFSCK_CMT=
+LFSCK_MAN=
-+AC_DEFINE(ENABLE_LFSCK)
++ENABLE_LFSCK=
++AC_DEFINE(HAVE_LFSCK)
+echo "Enabling Lustre lfsck support by default"
+)
+AC_SUBST(LFSCK_CMT)
+AC_SUBST(LFSCK_MAN)
++AC_SUBST(ENABLE_LFSCK)
+dnl
+dnl set lustre include path and build lfsck
+dnl
+AC_ARG_WITH([lustre],
+[ --with-lustre=LUSTRE path to Lustre sources for lfsck (default=/usr for RPM)],
-+AC_MSG_RESULT(LUSTRE is $withval)
-+LUSTRE="$withval",
-+LUSTRE="/usr")dnl
++AC_MSG_RESULT(LUSTRE is in $withval)
++ LUSTRE="$withval"
++ WITH_LUSTRE="--with-lustre=$withval",
++ LUSTRE="/usr"
++ WITH_LUSTRE=
++)dnl
+AC_SUBST(LUSTRE)
++AC_SUBST(WITH_LUSTRE)
+dnl
+AS_IF([test "x$enable_lfsck" != "xno"],
+[
+ AC_MSG_ERROR([No lustre includes found.]))
+ )
+dnl # Disable for old autoconf that doesn't check header usability.
-+dnl # Supposed to check if lustre_idl.h is usable from userspace.
++dnl # Supposed to check if lustre_idl.h is buildable from userspace.
+dnl AC_CHECK_HEADER($LUSTRE/lustre/include/lustre/lustre_idl.h,
+dnl AC_DEFINE(HAVE_LUSTRE_LUSTRE_IDL_H),
+dnl AC_CHECK_HEADER($LUSTRE/include/lustre/lustre_idl.h,
- e2fsck_pass1, e2fsck_pass2, e2fsck_pass3, e2fsck_pass4,
- e2fsck_pass5, 0 };
+ e2fsck_pass1, e2fsck_pass2, e2fsck_pass3, e2fsck_pass4, e2fsck_pass5,
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ e2fsck_pass6,
+#endif
+ 0 };
* it seems like a corruption. it's very unlikely we could repair
@@ -1005,6 +1015,12 @@ void e2fsck_pass1(e2fsck_t ctx)
ext2fs_mark_block_bitmap2(ctx->block_found_map,
- fs->super->s_mmp_block);
+ fs->super->s_mmp_block);
+ if (!(ctx->options & E2F_OPT_READONLY) &&
+ (ctx->lustre_devtype & LUSTRE_TYPE) == LUSTRE_MDS) {
+
while (1) {
if (ino % EXT2_MMP_INODE_INTERVAL == 0) {
- errcode_t error;
+ if (e2fsck_mmp_update(fs))
@@ -1513,6 +1529,9 @@ void e2fsck_pass1(e2fsck_t ctx)
}
e2fsck_pass1_dupblocks(ctx, block_buf);
+#include "ext2fs/lfsck.h"
+
+static struct option long_options[] = {
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ { "mdsdb", 1, NULL, 1 },
+ { "mdtdb", 1, NULL, 1 },
+ { "ostdb", 1, NULL, 2 },
fs->super->s_checkinterval*2))
reason = 0;
}
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ if (ctx->lustre_devtype & LUSTRE_TYPE) {
+ if (!reason || ctx->options & E2F_OPT_READONLY)
+ ctx->lustre_devtype |= LUSTRE_ONLY;
skip:
ext2fs_close(fs);
ctx->fs = NULL;
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ if (ctx->lustre_mdsdb)
+ free(ctx->lustre_mdsdb);
+ if (ctx->lustre_ostdb)
+ free(ctx->lustre_ostdb);
+ if (ctx->lfsck_oinfo)
+ e2fsck_lfsck_cleanupdb(ctx);
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
+
e2fsck_free_context(ctx);
exit(FSCK_OK);
+ "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDk",
+ long_options, &option_index)) != EOF)
switch (c) {
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ case 1: {
+ char *dbpath, *tmp;
+
+ free(tmp);
+ break;
+ }
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
case 'C':
ctx->progress = e2fsck_update_progress;
res = sscanf(optarg, "%d", &ctx->progress_fd);
default:
usage(ctx);
}
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ if (ctx->lustre_devtype) {
+ if ((ctx->lustre_devtype != LUSTRE_MDS) &&
+ ctx->lustre_devtype != (LUSTRE_MDS | LUSTRE_OST)) {
+ usage(ctx);
+ }
+ }
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
if (show_version_only)
return 0;
if (optind != argc - 1)
ext2fs_close(fs);
ctx->fs = NULL;
free(ctx->journal_name);
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+ if (ctx->lfsck_oinfo)
+ e2fsck_lfsck_cleanupdb(ctx);
+ if (ctx->lustre_mdsdb)
+ free(ctx->lustre_mdsdb);
+ if (ctx->lustre_ostdb)
+ free(ctx->lustre_ostdb);
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
e2fsck_free_context(ctx);
remove_error_table(&et_ext2_error_table);
%build
%configure --enable-elf-shlibs --enable-nls --disable-defrag \
- %{?extra_config_flags:%extra_config_flags}
-+ %{?extra_config_flags:%extra_config_flags} \
-+ --with-lustre=@LUSTRE@ @LFSCK_CMT@ --enable-lfsck
++ @WITH_LUSTRE@ @ENABLE_LFSCK@ \
++ %{?extra_config_flags:%extra_config_flags}
make
make check
+#ifndef LFSCK_H
+#define LFSCK_H
+
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+/* These are unfortunately needed for lustre_user.h to be usable */
+#define CLASSERT(cond) ({ switch(42) { case (cond): case 0: break; } })
+#define LASSERT(cond) do { } while (0)
+
+#define OST_START_OFFSET sizeof(struct lfsck_ost_hdr)
+
-+#else /* !ENABLE_LFSCK */
++#else /* !HAVE_LFSCK */
+#define e2fsck_lfsck_find_ea(ctx, inode, entry, value, lmm, lma) (0)
+#define e2fsck_lfsck_save_ea(ctx, ino, generation, lmm, lma) do {} while(0)
+#define e2fsck_lfsck_flush_ea(ctx) (0)
+#define e2fsck_lfsck_cleanupdb(ctx) (0)
+#define e2fsck_lfsck_remove_pending(ctx, block_buf) (0)
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
+
+#endif /* LFSCK_H */
Index: e2fsprogs/e2fsck/lfsck_common.c
===================================================================
--- /dev/null
+++ e2fsprogs/e2fsck/lfsck_common.c
-@@ -0,0 +1,429 @@
+@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Co.
++ * Copyright (c) 2011 Whamcloud, Inc
+ */
+/*****************************************************************************
+ * e2fsck extentions: code for gathering data from the OST & MDT filesystems
+
+#include "ext2fs/lfsck.h"
+
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+char *my_dirname(char *path)
+{
+
+#include "ext2fs/ext2_fs.h"
+#include "ext2fs/ext2fs.h"
+
-+#ifdef ENABLE_LFSCK
++#ifdef HAVE_LFSCK
+#include "e2fsck.h"
+#include "ext2fs/lfsck.h"
+#include "problem.h"
+
+ return;
+}
-+#endif /* ENABLE_LFSCK */
++#endif /* HAVE_LFSCK */
===================================================================
--- /dev/null
+++ e2fsprogs/e2fsprogs-RHEL-6.spec.in
-@@ -0,0 +1,785 @@
+@@ -0,0 +1,787 @@
+%define _root_sbindir /sbin
+%define _root_libdir /%{_lib}
+
+%build
+%configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \
+ --disable-e2initrd-helper --disable-libblkid --disable-libuuid \
-+ --disable-defrag --with-lustre=@LUSTRE@ @LFSCK_CMT@ --enable-lfsck
++ --disable-defrag \
++ @WITH_LUSTRE@ @ENABLE_LFSCK@ \
++ %{?extra_config_flags:%extra_config_flags}
+make %{?_smp_mflags}
+
+%install
===================================================================
--- e2fsprogs.orig/configure.in
+++ e2fsprogs/configure.in
-@@ -1233,6 +1233,7 @@ test -d lib || mkdir lib
+@@ -1234,6 +1234,7 @@ test -d include || mkdir include
test -d include/linux || mkdir include/linux
test -d include/asm || mkdir include/asm
for i in MCONFIG Makefile e2fsprogs.spec \
===================================================================
--- e2fsprogs.orig/contrib/build-rpm
+++ e2fsprogs/contrib/build-rpm
-@@ -34,11 +34,46 @@ EXCLUDE="--exclude .hg* --exclude .pc*"
+@@ -34,11 +34,46 @@ EXCLUDE="--exclude .hg* --exclude .pc*
[ "`rpmbuild --version 2> /dev/null`" ] && RPM=rpmbuild || RPM=rpm
===================================================================
--- /dev/null
+++ e2fsprogs/lib/ext2fs/ext2_types-wrapper.h
-@@ -0,0 +1,28 @@ EXCLUDE="--exclude .hg* --exclude .pc*"
+@@ -0,0 +1,28 @@
+/* This file is here to prevent a file conflict on multiarch systems. A
+ * conflict will occur because ext2_types.h has arch-specific definitions.
+ *
+#endif
Index: e2fsprogs/lib/ext2fs/Makefile.in
===================================================================
---- /dev/null
+--- e2fsprogs.orig/lib/ext2fs/Makefile.in
+++ e2fsprogs/lib/ext2fs/Makefile.in
-@@ -159,7 +159,7 @@
+@@ -162,7 +162,7 @@ SRCS= ext2_err.c \
HFILES= bitops.h ext2fs.h ext2_io.h ext2_fs.h ext2_ext_attr.h ext3_extents.h \
tdb.h
+ --disable-libuuid \
+ --disable-uuidd \
+ --disable-fsck \
-+ %{?extra_config_flags:%extra_config_flags} CFLAGS="$RPM_OPT_FLAGS" \
+ --disable-defrag \
-+ --with-lustre=@LUSTRE@ \
-+ @LFSCK_CMT@ --enable-lfsck
++ @WITH_LUSTRE@ \
++ @ENABLE_LFSCK@ \
++ %{?extra_config_flags:%extra_config_flags} CFLAGS="$RPM_OPT_FLAGS"
+make V=1
+
+%install
===================================================================
--- e2fsprogs.orig/configure.in
+++ e2fsprogs/configure.in
-@@ -1234,6 +1234,7 @@ test -d lib || mkdir lib
+@@ -1235,6 +1243,7 @@ test -d include/linux || mkdir include/l
test -d include/asm || mkdir include/asm
for i in MCONFIG Makefile e2fsprogs.spec \
e2fsprogs-RHEL-6.spec \
===================================================================
--- e2fsprogs.orig/contrib/build-rpm
+++ e2fsprogs/contrib/build-rpm
-@@ -43,6 +43,9 @@ EXCLUDE="--exclude .hg* --exclude .pc*"
+@@ -43,6 +43,9 @@ if [ -z "$DISTRO" ]; then
if grep "Fedora " /etc/issue; then
DISTRO="Fedora"
fi
fi
if [ -z "$DISTRO" ]; then
echo "Could not determine the distribution. Please install the lsb_release binary"
-@@ -54,6 +59,9 @@ EXCLUDE="--exclude .hg* --exclude .pc*"
+@@ -54,6 +57,9 @@ if [ -z "$RELEASE" ]; then
Fedora)
RELEASE=$(grep Fedora /etc/issue | sed -e 's/Fedora release //' -e 's/ .*//')
;;