VERSION
PACKAGE
GETTEXT_PACKAGE
+TDB_MAN_COMMENT
+TDB_CMT
UUIDD_CMT
E2INITRD_MAN
E2INITRD_PROG
enable_tls
enable_uuidd
enable_mmp
+enable_tdb
enable_bmap_stats
enable_bmap_stats_ops
enable_nls
--disable-tls disable use of thread local support
--disable-uuidd disable building the uuid daemon
--disable-mmp disable support mmp, Multi Mount Protection
+ --disable-tdb disable tdb support
--disable-bmap-stats disable collection of bitmap stats.
--enable-bmap-stats-ops enable collection of additional bitmap stats
--disable-nls do not use Native Language Support
fi
+# Check whether --enable-tdb was given.
+if test "${enable_tdb+set}" = set; then :
+ enableval=$enable_tdb; if test "$enableval" = "no"
+then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling tdb support" >&5
+$as_echo "Disabling tdb support" >&6; }
+ TDB_CMT="#"
+ TDB_MAN_COMMENT='.\"'
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling tdb support" >&5
+$as_echo "Enabling tdb support" >&6; }
+ $as_echo "#define CONFIG_TDB 1" >>confdefs.h
+
+ TDB_CMT=""
+ TDB_MAN_COMMENT=""
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling mmp support by default" >&5
+$as_echo "Enabling mmp support by default" >&6; }
+$as_echo "#define CONFIG_TDB 1" >>confdefs.h
+
+TDB_CMT=""
+TDB_MAN_COMMENT=""
+
+fi
+
+
+
+
# Check whether --enable-bmap-stats was given.
if test "${enable_bmap_stats+set}" = set; then :
enableval=$enable_bmap_stats; if test "$enableval" = "no"
AC_DEFINE(CONFIG_MMP, 1)
)
dnl
+dnl handle --disable-tdb
+dnl
+AH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support])
+AC_ARG_ENABLE([tdb],
+[ --disable-tdb disable tdb support],
+if test "$enableval" = "no"
+then
+ AC_MSG_RESULT([Disabling tdb support])
+ TDB_CMT="#"
+ TDB_MAN_COMMENT='.\"'
+else
+ AC_MSG_RESULT([Enabling tdb support])
+ AC_DEFINE(CONFIG_TDB, 1)
+ TDB_CMT=""
+ TDB_MAN_COMMENT=""
+fi
+,
+AC_MSG_RESULT([Enabling mmp support by default])
+AC_DEFINE(CONFIG_TDB, 1)
+TDB_CMT=""
+TDB_MAN_COMMENT=""
+)
+AC_SUBST(TDB_CMT)
+AC_SUBST(TDB_MAN_COMMENT)
+dnl
dnl handle --disable-bmap-stats
dnl
AH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
int size;
struct dir_info *array;
struct dir_info *last_lookup;
+#ifdef CONFIG_TDB
char *tdb_fn;
TDB_CONTEXT *tdb;
+#endif
};
struct dir_info_iter {
int i;
+#ifdef CONFIG_TDB
TDB_DATA tdb_iter;
+#endif
};
struct dir_info_ent {
static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir);
+#ifdef CONFIG_TDB
static void setup_tdb(e2fsck_t ctx, ext2_ino_t num_dirs)
{
struct dir_info_db *db = ctx->dir_info;
O_RDWR | O_CREAT | O_TRUNC, 0600);
close(fd);
}
+#endif
static void setup_db(e2fsck_t ctx)
{
if (retval)
num_dirs = 1024; /* Guess */
+#ifdef CONFIG_TDB
setup_tdb(ctx, num_dirs);
if (db->tdb) {
#endif
return;
}
+#endif
db->size = num_dirs + 10;
db->array = (struct dir_info *)
*/
void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
{
- struct dir_info_db *db;
- struct dir_info *dir, ent, *old_array;
+ struct dir_info *dir, *old_array;
int i, j;
errcode_t retval;
unsigned long old_size;
#endif
if (!ctx->dir_info)
setup_db(ctx);
- db = ctx->dir_info;
if (ctx->dir_info->count >= ctx->dir_info->size) {
old_size = ctx->dir_info->size * sizeof(struct dir_info);
ctx->dir_info->last_lookup = NULL;
}
- ent.ino = ino;
- ent.parent = parent;
- ent.dotdot = parent;
+#ifdef CONFIG_TDB
+ if (ctx->dir_info->tdb) {
+ struct dir_info ent;
- if (db->tdb) {
+ ent.ino = ino;
+ ent.parent = parent;
+ ent.dotdot = parent;
e2fsck_put_dir_info(ctx, &ent);
return;
}
+#endif
/*
* Normally, add_dir_info is called with each inode in
{
struct dir_info_db *db = ctx->dir_info;
int low, high, mid;
- struct dir_info_ent *buf;
- static struct dir_info ret_dir_info;
if (!db)
return 0;
printf("e2fsck_get_dir_info %d...", ino);
#endif
+#ifdef CONFIG_TDB
if (db->tdb) {
+ static struct dir_info ret_dir_info;
TDB_DATA key, data;
+ struct dir_info_ent *buf;
key.dptr = (unsigned char *) &ino;
key.dsize = sizeof(ext2_ino_t);
free(data.dptr);
return &ret_dir_info;
}
+#endif
if (db->last_lookup && db->last_lookup->ino == ino)
return db->last_lookup;
return 0;
}
-static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
+static void e2fsck_put_dir_info(e2fsck_t ctx EXT2FS_NO_TDB_UNUSED,
+ struct dir_info *dir EXT2FS_NO_TDB_UNUSED)
{
+#ifdef CONFIG_TDB
struct dir_info_db *db = ctx->dir_info;
struct dir_info_ent buf;
TDB_DATA key, data;
+#endif
#ifdef DIRINFO_DEBUG
printf("e2fsck_put_dir_info (%d, %d, %d)...", dir->ino, dir->dotdot,
dir->parent);
#endif
+#ifdef CONFIG_TDB
if (!db->tdb)
return;
if (tdb_store(db->tdb, key, data, TDB_REPLACE) == -1) {
printf("store failed: %s\n", tdb_errorstr(db->tdb));
}
- return;
+#endif
}
/*
void e2fsck_free_dir_info(e2fsck_t ctx)
{
if (ctx->dir_info) {
+#ifdef CONFIG_TDB
if (ctx->dir_info->tdb)
tdb_close(ctx->dir_info->tdb);
if (ctx->dir_info->tdb_fn) {
unlink(ctx->dir_info->tdb_fn);
free(ctx->dir_info->tdb_fn);
}
+#endif
if (ctx->dir_info->array)
ext2fs_free_mem(&ctx->dir_info->array);
ctx->dir_info->array = 0;
struct dir_info_iter *e2fsck_dir_info_iter_begin(e2fsck_t ctx)
{
struct dir_info_iter *iter;
- struct dir_info_db *db = ctx->dir_info;
iter = e2fsck_allocate_memory(ctx, sizeof(struct dir_info_iter),
"dir_info iterator");
- if (db->tdb)
- iter->tdb_iter = tdb_firstkey(db->tdb);
+#ifdef CONFIG_TDB
+ if (ctx->dir_info->tdb)
+ iter->tdb_iter = tdb_firstkey(ctx->dir_info->tdb);
+#endif
return iter;
}
void e2fsck_dir_info_iter_end(e2fsck_t ctx EXT2FS_ATTR((unused)),
struct dir_info_iter *iter)
{
+#ifdef CONFIG_TDB
free(iter->tdb_iter.dptr);
+#endif
ext2fs_free_mem(&iter);
}
*/
struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, struct dir_info_iter *iter)
{
- TDB_DATA data, key;
- struct dir_info_db *db = ctx->dir_info;
- struct dir_info_ent *buf;
- static struct dir_info ret_dir_info;
-
if (!ctx->dir_info || !iter)
return 0;
- if (db->tdb) {
+#ifdef CONFIG_TDB
+ if (ctx->dir_info->tdb) {
+ static struct dir_info ret_dir_info;
+ struct dir_info_ent *buf;
+ TDB_DATA data, key;
+
if (iter->tdb_iter.dptr == 0)
return 0;
key = iter->tdb_iter;
- data = tdb_fetch(db->tdb, key);
+ data = tdb_fetch(ctx->dir_info->tdb, key);
if (!data.dptr) {
printf("iter fetch failed: %s\n",
- tdb_errorstr(db->tdb));
+ tdb_errorstr(ctx->dir_info->tdb));
return 0;
}
buf = (struct dir_info_ent *) data.dptr;
ret_dir_info.ino = *((ext2_ino_t *) iter->tdb_iter.dptr);
ret_dir_info.dotdot = buf->dotdot;
ret_dir_info.parent = buf->parent;
- iter->tdb_iter = tdb_nextkey(db->tdb, key);
+ iter->tdb_iter = tdb_nextkey(ctx->dir_info->tdb, key);
free(key.dptr);
free(data.dptr);
return &ret_dir_info;
}
+#endif
if (iter->i >= ctx->dir_info->count)
return 0;
.I [problems]
This stanza allows the administrator to reconfigure how e2fsck handles
various filesystem inconsistencies.
-.TP
-.I [scratch_files]
-This stanza controls when e2fsck will attempt to use scratch files to
-reduce the need for memory.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I [scratch_files]
+@TDB_MAN_COMMENT@This stanza controls when e2fsck will attempt to use
+@TDB_MAN_COMMENT@scratch files to reduce the need for memory.
.SH THE [options] STANZA
The following relations are defined in the
.I [options]
option even overrides the
.B -y
option given on the command-line (just for the specific problem, of course).
-.SH THE [scratch_files] STANZA
-The following relations are defined in the
-.I [scratch_files]
-stanza.
-.TP
-.I directory
-If the directory named by this relation exists and is writeable, then
-e2fsck will attempt to use this directory to store scratch files instead
-of using in-memory data structures.
-.TP
-.I numdirs_threshold
-If this relation is set, then in-memory data structures be used if the
-number of directories in the filesystem are fewer than amount specified.
-.TP
-.I dirinfo
-This relation controls whether or not the scratch file directory is used
-instead of an in-memory data structure for directory information. It
-defaults to true.
-.TP
-.I icount
-This relation controls whether or not the scratch file directory is used
-instead of an in-memory data structure when tracking inode counts. It
-defaults to true.
+@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA
+@TDB_MAN_COMMENT@The following relations are defined in the
+@TDB_MAN_COMMENT@.I [scratch_files]
+@TDB_MAN_COMMENT@stanza.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I directory
+@TDB_MAN_COMMENT@If the directory named by this relation exists and is
+@TDB_MAN_COMMENT@writeable, then e2fsck will attempt to use this
+@TDB_MAN_COMMENT@directory to store scratch files instead of using
+@TDB_MAN_COMMENT@in-memory data structures.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I numdirs_threshold
+@TDB_MAN_COMMENT@If this relation is set, then in-memory data structures
+@TDB_MAN_COMMENT@be used if the number of directories in the filesystem
+@TDB_MAN_COMMENT@are fewer than amount specified.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I dirinfo
+@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
+@TDB_MAN_COMMENT@directory is used instead of an in-memory data
+@TDB_MAN_COMMENT@structure for directory information. It defaults to
+@TDB_MAN_COMMENT@true.
+@TDB_MAN_COMMENT@.TP
+@TDB_MAN_COMMENT@.I icount
+@TDB_MAN_COMMENT@This relation controls whether or not the scratch file
+@TDB_MAN_COMMENT@directory is used instead of an in-memory data
+@TDB_MAN_COMMENT@structure when tracking inode counts. It defaults to
+@TDB_MAN_COMMENT@true.
.SH LOGGING
E2fsck has the facility to save the information from an e2fsck run in a
directory so that a system administrator can review its output at their
extern void e2fsck_hide_quota(e2fsck_t ctx);
/* pass1.c */
-extern void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
- ext2_icount_t *ret);
+extern errcode_t e2fsck_setup_icount(e2fsck_t ctx, const char *icount_name,
+ int flags, ext2_icount_t hint,
+ ext2_icount_t *ret);
extern void e2fsck_use_inode_shortcuts(e2fsck_t ctx, int use_shortcuts);
extern int e2fsck_pass1_check_device_inode(ext2_filsys fs,
struct ext2_inode *inode);
}
}
-void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
- ext2_icount_t *ret)
+extern errcode_t e2fsck_setup_icount(e2fsck_t ctx, const char *icount_name,
+ int flags, ext2_icount_t hint,
+ ext2_icount_t *ret)
{
unsigned int threshold;
+ unsigned int save_type;
ext2_ino_t num_dirs;
errcode_t retval;
char *tdb_dir;
if (retval)
num_dirs = 1024; /* Guess */
- if (!enable || !tdb_dir || access(tdb_dir, W_OK) ||
- (threshold && num_dirs <= threshold))
- return;
-
- retval = ext2fs_create_icount_tdb(ctx->fs, tdb_dir, flags, ret);
- if (retval)
- *ret = 0;
+ if (enable && tdb_dir && !access(tdb_dir, W_OK) &&
+ (!threshold || num_dirs > threshold)) {
+ retval = ext2fs_create_icount_tdb(ctx->fs, tdb_dir,
+ flags, ret);
+ if (retval == 0)
+ return 0;
+ }
+ e2fsck_set_bitmap_type(ctx->fs, EXT2FS_BMAP64_RBTREE, icount_name,
+ &save_type);
+ retval = ext2fs_create_icount2(ctx->fs, flags, 0, hint, ret);
+ ctx->fs->default_bitmap_type = save_type;
+ return retval;
}
static errcode_t recheck_bad_inode_checksum(ext2_filsys fs, ext2_ino_t ino,
struct scan_callback_struct scan_struct;
struct ext2_super_block *sb = ctx->fs->super;
const char *old_op;
- unsigned int save_type;
int imagic_fs, extent_fs, inlinedata_fs;
int low_dtime_check = 1;
int inode_size = EXT2_INODE_SIZE(fs->super);
ctx->flags |= E2F_FLAG_ABORT;
return;
}
- e2fsck_setup_tdb_icount(ctx, 0, &ctx->inode_link_info);
- if (!ctx->inode_link_info) {
- e2fsck_set_bitmap_type(fs, EXT2FS_BMAP64_RBTREE,
- "inode_link_info", &save_type);
- pctx.errcode = ext2fs_create_icount2(fs, 0, 0, 0,
- &ctx->inode_link_info);
- fs->default_bitmap_type = save_type;
- }
-
+ pctx.errcode = e2fsck_setup_icount(ctx, "inode_link_info", 0, NULL,
+ &ctx->inode_link_info);
if (pctx.errcode) {
fix_problem(ctx, PR_1_ALLOCATE_ICOUNT, &pctx);
ctx->flags |= E2F_FLAG_ABORT;
struct check_dir_struct cd;
struct dx_dir_info *dx_dir;
struct dx_dirblock_info *dx_db, *dx_parent;
- unsigned int save_type;
int b;
int i, depth;
problem_t code;
if (!(ctx->options & E2F_OPT_PREEN))
fix_problem(ctx, PR_2_PASS_HEADER, &cd.pctx);
- e2fsck_setup_tdb_icount(ctx, EXT2_ICOUNT_OPT_INCREMENT,
- &ctx->inode_count);
- if (ctx->inode_count)
- cd.pctx.errcode = 0;
- else {
- e2fsck_set_bitmap_type(fs, EXT2FS_BMAP64_RBTREE,
- "inode_count", &save_type);
- cd.pctx.errcode = ext2fs_create_icount2(fs,
- EXT2_ICOUNT_OPT_INCREMENT,
- 0, ctx->inode_link_info,
- &ctx->inode_count);
- fs->default_bitmap_type = save_type;
- }
+ cd.pctx.errcode = e2fsck_setup_icount(ctx, "inode_count",
+ EXT2_ICOUNT_OPT_INCREMENT,
+ ctx->inode_link_info, &ctx->inode_count);
if (cd.pctx.errcode) {
fix_problem(ctx, PR_2_ALLOCATE_ICOUNT, &cd.pctx);
ctx->flags |= E2F_FLAG_ABORT;
/* Define to 1 to enable mmp support */
#undef CONFIG_MMP
+/* Define to 1 to enable tdb support */
+#undef CONFIG_TDB
+
/* Define to 1 if the testio I/O manager should be enabled */
#undef CONFIG_TESTIO_DEBUG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
+/* The size of `time_t', as computed by sizeof. */
+#undef SIZEOF_TIME_T
+
/* Define as the maximum value of type 'size_t', if the system doesn't define
it. */
#ifndef SIZE_MAX
sha512.c \
swapfs.c \
symlink.c \
- tdb.c \
undo_io.c \
unix_io.c \
unlink.c \
$(top_srcdir)/e2fsck/recovery.c \
$(top_srcdir)/debugfs/do_journal.c
+@TDB_CMT@TDB_OBJ= tdb.o
+
OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \
$(TEST_IO_LIB_OBJS) \
ext2_err.o \
sha512.o \
swapfs.o \
symlink.o \
- tdb.o \
+ $(TDB_OBJ) \
undo_io.o \
unix_io.o \
unlink.o \
#define EXT2FS_ATTR(x)
#endif
+#ifdef CONFIG_TDB
+#define EXT2FS_NO_TDB_UNUSED
+#else
+#define EXT2FS_NO_TDB_UNUSED EXT2FS_ATTR((unused))
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
ext2_ino_t cursor;
struct ext2_icount_el *list;
struct ext2_icount_el *last_lookup;
+#ifdef CONFIG_TDB
char *tdb_fn;
TDB_CONTEXT *tdb;
+#endif
};
/*
ext2fs_free_inode_bitmap(icount->single);
if (icount->multiple)
ext2fs_free_inode_bitmap(icount->multiple);
+#ifdef CONFIG_TDB
if (icount->tdb)
tdb_close(icount->tdb);
if (icount->tdb_fn) {
unlink(icount->tdb_fn);
free(icount->tdb_fn);
}
+#endif
ext2fs_free_mem(&icount);
}
return(retval);
}
+#ifdef CONFIG_TDB
struct uuid {
__u32 time_low;
__u16 time_mid;
uuid.node[0], uuid.node[1], uuid.node[2],
uuid.node[3], uuid.node[4], uuid.node[5]);
}
+#endif
-errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
- int flags, ext2_icount_t *ret)
+errcode_t ext2fs_create_icount_tdb(ext2_filsys fs EXT2FS_NO_TDB_UNUSED,
+ char *tdb_dir EXT2FS_NO_TDB_UNUSED,
+ int flags EXT2FS_NO_TDB_UNUSED,
+ ext2_icount_t *ret EXT2FS_NO_TDB_UNUSED)
{
+#ifdef CONFIG_TDB
ext2_icount_t icount;
errcode_t retval;
char *fn, uuid[40];
errout:
ext2fs_free_icount(icount);
return(retval);
+#else
+ return EXT2_ET_UNIMPLEMENTED;
+#endif
}
errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
__u32 count)
{
struct ext2_icount_el *el;
+#ifdef CONFIG_TDB
TDB_DATA key, data;
if (icount->tdb) {
}
return 0;
}
-
+#endif
el = get_icount_el(icount, ino, 1);
if (!el)
return EXT2_ET_NO_MEMORY;
__u32 *count)
{
struct ext2_icount_el *el;
+#ifdef CONFIG_TDB
TDB_DATA key, data;
if (icount->tdb) {
free(data.dptr);
return 0;
}
+#endif
el = get_icount_el(icount, ino, 0);
if (!el) {
*count = 0;
int problem = 0;
if (dir) {
+#ifdef CONFIG_TDB
retval = ext2fs_create_icount_tdb(test_fs, dir,
flags, &icount);
if (retval) {
"while creating icount using tdb");
exit(1);
}
+#else
+ printf("Skipped\n");
+ return 0;
+#endif
} else {
retval = ext2fs_create_icount2(test_fs, flags, size, 0,
&icount);
# Enable the documentation for the journal device mke2fs, tune2fs, and
# e2fsck's man page
JDEV
+# Enable the documentation for the tdb profile in e2fsck.conf's man page
+TDB_MAN_COMMENT @TDB_MAN_COMMENT@