===================================================================
--- /dev/null
+++ e2fsprogs/e2fsck/lfsck.c
-@@ -0,0 +1,2096 @@
+@@ -0,0 +1,2098 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim:shiftwidth=8:tabstop=8:
+ *
+ * Copyright (c) 2004 Hewlett-Packard Co.
+ * Copyright 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
++ * Copyright (c) 2011 Whamcloud, Inc.
+ */
+/***********************************************************************
+ * This program takes as input files generated by running e2fsck on
+
+ sprintf(dbname, "%s.%d", MDS_OSTDB, ost_idx);
+ if ((rc = lfsck_opendb(mds_file, dbname, &mds_db, 1, 0, 0)) != 0) {
-+ log_write("failed to open mds db file %s\n", mds_file);
++ log_write("%s: failed to open mds db file %s: rc %d\n",
++ progname, mds_file, rc);
+ rc = -EINVAL;
+ goto out;
+ }
+
+ rc = lfsck_opendb(mds_file, dbname, &mds_ostdb, 1, 0, 0);
+ if (rc != 0) {
-+ log_write("failed to open mds db file %s: %s\n",
-+ mds_file, db_strerror(rc));
++ log_write("%s: failed to open mds db file %s: rc %d\n",
++ progname, mds_file, rc);
+ goto out;
+ }
+
+ VERBOSE(2, "checking file %s\n", ost_files[i]);
+ rc = lfsck_opendb(ost_files[i], OST_HDR, &ost_db, 0, 0, 0);
+ if (rc != 0) {
-+ log_write("Error opening ost_data_file %s: rc %d\n",
-+ ost_files[i], rc);
++ log_write("%s: error opening ost_data_file %s: rc %d\n",
++ progname, ost_files[i], rc);
+ goto out;
+ }
+ memset(&key, 0, sizeof(key));
+ }
+ rc = lfsck_opendb(ost_files[i], OST_OSTDB, &ost_db, 0, 0, 0);
+ if (rc != 0) {
-+ log_write("error opening ost_data_file %s: rc %d\n",
-+ ost_files[i], rc);
++ log_write("%s: error opening ost_data_file %s: rc %d\n",
++ progname, ost_files[i], rc);
+ goto out;
+ }
+
+
+ rc = lfsck_opendb(mds_file, MDS_DIRINFO, &mds_direntdb, 0, 0, 0);
+ if (rc != 0) {
-+ log_write("%s: error opening dirinfo db %s\n",
-+ progname, mds_file);
++ log_write("%s: error opening dirinfo db %s: rc %d\n",
++ progname, mds_file, rc);
+ goto out;
+ }
+
+ rc = lfsck_opendb(mds_file, MDS_SIZEINFO, &mds_sizeinfodb, 0, 0, 0);
+ if (rc != 0) {
-+ log_write("%s: error opening sizeinfo db %s\n",
-+ progname, mds_file);
++ log_write("%s: error opening sizeinfo db %s: rc %d\n",
++ progname, mds_file, rc);
+ goto out;
+ }
+
===================================================================
--- /dev/null
+++ e2fsprogs/e2fsck/lfsck_common.c
-@@ -0,0 +1,434 @@
+@@ -0,0 +1,429 @@
+/*
+ * Copyright (c) 2004 Hewlett-Packard Co.
+ */
+ }
+ }
+
-+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) || (DB_VERSION_MAJOR > 4)
+ if ((rc = dbp->open(dbp, NULL, fname, dbname, DB_HASH,
-+ DB_CREATE | DB_INIT_LOCK | DB_THREAD, 0664)) != 0)
-+#else
-+ if ((rc = dbp->open(dbp, fname, dbname, DB_HASH,
-+ DB_CREATE | DB_INIT_LOCK | DB_THREAD, 0664)) != 0)
-+#endif
++ DB_CREATE | DB_THREAD, 0664)) != 0)
+ {
+ dbp->err(dbp, rc, "%s:%s\n", fname, dbname);
+ dbp->close(dbp, 0);