Add configure --disable-tdb which disables e2fsck's scratch_files feature

The scratch_files feature is not really needed except on 32-bit
platforms, since tdb's performance is pretty awful given how we are
using it.  Maybe SQLite would be faster, but for 64-bit platforms,
enabling swap works fairly well, especially using the rbtree for the
bitmap abstraction.

We leave tdb for Android since it's unlikely that someone will be
trying to connect petabyte+ sized file systems to a mobile handset.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o 2016-05-29 20:48:54 -04:00
parent a701823a31
commit 749f07121d
13 changed files with 198 additions and 90 deletions

34
configure vendored
View File

@ -731,6 +731,8 @@ SET_MAKE
VERSION
PACKAGE
GETTEXT_PACKAGE
TDB_MAN_COMMENT
TDB_CMT
UUIDD_CMT
E2INITRD_MAN
E2INITRD_PROG
@ -877,6 +879,7 @@ enable_e2initrd_helper
enable_tls
enable_uuidd
enable_mmp
enable_tdb
enable_bmap_stats
enable_bmap_stats_ops
enable_nls
@ -1550,6 +1553,7 @@ Optional Features:
--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
@ -5940,6 +5944,36 @@ $as_echo "#define CONFIG_MMP 1" >>confdefs.h
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"

View File

@ -777,6 +777,31 @@ AC_MSG_RESULT([Enabling mmp support by default])
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.])

View File

@ -21,13 +21,17 @@ struct dir_info_db {
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 {
@ -38,6 +42,7 @@ 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;
@ -79,6 +84,7 @@ static void setup_tdb(e2fsck_t ctx, ext2_ino_t num_dirs)
O_RDWR | O_CREAT | O_TRUNC, 0600);
close(fd);
}
#endif
static void setup_db(e2fsck_t ctx)
{
@ -98,6 +104,7 @@ static void setup_db(e2fsck_t ctx)
if (retval)
num_dirs = 1024; /* Guess */
#ifdef CONFIG_TDB
setup_tdb(ctx, num_dirs);
if (db->tdb) {
@ -106,6 +113,7 @@ static void setup_db(e2fsck_t ctx)
#endif
return;
}
#endif
db->size = num_dirs + 10;
db->array = (struct dir_info *)
@ -121,8 +129,7 @@ static void setup_db(e2fsck_t ctx)
*/
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;
@ -132,7 +139,6 @@ void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
#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);
@ -153,14 +159,17 @@ void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent)
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
@ -196,8 +205,6 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
{
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;
@ -206,8 +213,11 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
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);
@ -230,6 +240,7 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
free(data.dptr);
return &ret_dir_info;
}
#endif
if (db->last_lookup && db->last_lookup->ino == ino)
return db->last_lookup;
@ -273,17 +284,21 @@ static struct dir_info *e2fsck_get_dir_info(e2fsck_t ctx, ext2_ino_t ino)
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;
@ -298,7 +313,7 @@ static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
if (tdb_store(db->tdb, key, data, TDB_REPLACE) == -1) {
printf("store failed: %s\n", tdb_errorstr(db->tdb));
}
return;
#endif
}
/*
@ -307,12 +322,14 @@ static void e2fsck_put_dir_info(e2fsck_t ctx, struct dir_info *dir)
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;
@ -334,13 +351,14 @@ int e2fsck_get_num_dirinfo(e2fsck_t ctx)
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;
}
@ -348,7 +366,9 @@ struct dir_info_iter *e2fsck_dir_info_iter_begin(e2fsck_t ctx)
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);
}
@ -357,33 +377,34 @@ void e2fsck_dir_info_iter_end(e2fsck_t ctx EXT2FS_ATTR((unused)),
*/
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;

View File

@ -72,10 +72,10 @@ behavior.
.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]
@ -303,29 +303,33 @@ of 'should this problem be fixed?'. The
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

View File

@ -506,8 +506,9 @@ extern void set_up_logging(e2fsck_t ctx);
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);

View File

@ -697,10 +697,12 @@ isdir:
}
}
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;
@ -719,13 +721,18 @@ void e2fsck_setup_tdb_icount(e2fsck_t ctx, int flags,
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,
@ -1049,7 +1056,6 @@ void e2fsck_pass1(e2fsck_t ctx)
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);
@ -1145,15 +1151,8 @@ void e2fsck_pass1(e2fsck_t ctx)
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;

View File

@ -97,7 +97,6 @@ void e2fsck_pass2(e2fsck_t ctx)
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;
@ -116,19 +115,9 @@ void e2fsck_pass2(e2fsck_t ctx)
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;

View File

@ -15,6 +15,9 @@
/* 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
@ -657,6 +660,9 @@
/* 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

View File

@ -74,7 +74,6 @@ libext2fs_src_files := \
sha512.c \
swapfs.c \
symlink.c \
tdb.c \
undo_io.c \
unix_io.c \
unlink.c \

View File

@ -49,6 +49,8 @@ DEBUG_SRCS= debug_cmds.c extent_cmds.c tst_cmds.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 \
@ -119,7 +121,7 @@ OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) \
sha512.o \
swapfs.o \
symlink.o \
tdb.o \
$(TDB_OBJ) \
undo_io.o \
unix_io.o \
unlink.o \

View File

@ -18,6 +18,12 @@
#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

View File

@ -57,8 +57,10 @@ struct ext2_icount {
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
};
/*
@ -82,12 +84,14 @@ void ext2fs_free_icount(ext2_icount_t icount)
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);
}
@ -127,6 +131,7 @@ errout:
return(retval);
}
#ifdef CONFIG_TDB
struct uuid {
__u32 time_low;
__u16 time_mid;
@ -173,10 +178,14 @@ static void uuid_unparse(void *uu, char *out)
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];
@ -224,6 +233,9 @@ errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
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,
@ -401,6 +413,7 @@ static errcode_t set_inode_count(ext2_icount_t icount, ext2_ino_t ino,
__u32 count)
{
struct ext2_icount_el *el;
#ifdef CONFIG_TDB
TDB_DATA key, data;
if (icount->tdb) {
@ -419,7 +432,7 @@ static errcode_t set_inode_count(ext2_icount_t icount, ext2_ino_t ino,
}
return 0;
}
#endif
el = get_icount_el(icount, ino, 1);
if (!el)
return EXT2_ET_NO_MEMORY;
@ -432,6 +445,7 @@ static errcode_t get_inode_count(ext2_icount_t icount, ext2_ino_t ino,
__u32 *count)
{
struct ext2_icount_el *el;
#ifdef CONFIG_TDB
TDB_DATA key, data;
if (icount->tdb) {
@ -448,6 +462,7 @@ static errcode_t get_inode_count(ext2_icount_t icount, ext2_ino_t ino,
free(data.dptr);
return 0;
}
#endif
el = get_icount_el(icount, ino, 0);
if (!el) {
*count = 0;
@ -761,6 +776,7 @@ int run_test(int flags, int size, char *dir, struct test_program *prog)
int problem = 0;
if (dir) {
#ifdef CONFIG_TDB
retval = ext2fs_create_icount_tdb(test_fs, dir,
flags, &icount);
if (retval) {
@ -768,6 +784,10 @@ int run_test(int flags, int size, char *dir, struct test_program *prog)
"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);

View File

@ -18,3 +18,5 @@ $prefix @prefix@
# 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@