From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 05/10] libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIR
Date: Sun, 18 Dec 2011 01:42:33 -0500 [thread overview]
Message-ID: <1324190558-7436-6-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1324190558-7436-1-git-send-email-tytso@mit.edu>
This backend type will automatically switch between the bitarray and
the rbtree backend based on the number of directories in the file
system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/Makefile.in | 3 +++
lib/ext2fs/ext2fs.h | 1 +
lib/ext2fs/gen_bitmap64.c | 8 ++++++++
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 4c5ebed..ef55494 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -400,6 +400,9 @@ check:: tst_bitops tst_badblocks tst_iscan tst_types tst_icount \
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) \
./tst_bitmaps -t 2 -f $(srcdir)/tst_bitmaps_cmds > tst_bitmaps_out
diff $(srcdir)/tst_bitmaps_exp tst_bitmaps_out
+ LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) \
+ ./tst_bitmaps -t 3 -f $(srcdir)/tst_bitmaps_cmds > tst_bitmaps_out
+ diff $(srcdir)/tst_bitmaps_exp tst_bitmaps_out
installdirs::
$(E) " MKINSTALLDIRS $(libdir) $(includedir)/ext2fs"
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 5ffb036..f2df66e 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -294,6 +294,7 @@ struct struct_ext2_filsys {
#define EXT2FS_BMAP64_BITARRAY 1
#define EXT2FS_BMAP64_RBTREE 2
+#define EXT2FS_BMAP64_AUTODIR 3
/*
* Return flags for the block iterator functions
diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
index c9b4051..7b066a2 100644
--- a/lib/ext2fs/gen_bitmap64.c
+++ b/lib/ext2fs/gen_bitmap64.c
@@ -86,6 +86,7 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
{
ext2fs_generic_bitmap bitmap;
struct ext2_bitmap_ops *ops;
+ ext2_ino_t num_dirs;
errcode_t retval;
if (!type)
@@ -98,6 +99,13 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
case EXT2FS_BMAP64_RBTREE:
ops = &ext2fs_blkmap64_rbtree;
break;
+ case EXT2FS_BMAP64_AUTODIR:
+ retval = ext2fs_get_num_dirs(fs, &num_dirs);
+ if (retval || num_dirs > (fs->super->s_inodes_count / 320))
+ ops = &ext2fs_blkmap64_bitarray;
+ else
+ ops = &ext2fs_blkmap64_rbtree;
+ break;
default:
return EINVAL;
}
--
1.7.8.11.gefc1f.dirty
next prev parent reply other threads:[~2011-12-18 6:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 6:42 [PATCH 00/10] extent-based bitmaps for e2fsprogs Theodore Ts'o
2011-12-18 6:42 ` [PATCH 01/10] libext2fs: add default_bitmap_type to the ext2_filsys structure Theodore Ts'o
2011-12-18 6:42 ` [PATCH 02/10] libext2fs: add tests for the bitmap functions Theodore Ts'o
2011-12-19 10:59 ` Lukas Czerner
2011-12-18 6:42 ` [PATCH 03/10] libext2fs: add rbtree library Theodore Ts'o
2011-12-18 6:42 ` [PATCH 04/10] libext2fs: add a bitmap implementation using rbtree's Theodore Ts'o
2011-12-18 6:42 ` Theodore Ts'o [this message]
2011-12-19 11:16 ` [PATCH 05/10] libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIR Lukas Czerner
2011-12-18 6:42 ` [PATCH 06/10] e2fsck: fix pass5 bug when using two different bitmap backends Theodore Ts'o
2011-12-18 6:42 ` [PATCH 07/10] libext2fs: use the rbtree bitmap by default when initializing a file system Theodore Ts'o
2011-12-19 14:15 ` Lukas Czerner
2011-12-19 14:17 ` Lukas Czerner
2011-12-18 6:42 ` [PATCH 08/10] e2fsck: use different bitmap types as appropriate Theodore Ts'o
2011-12-18 6:42 ` [PATCH 09/10] libext2fs: adjust the description when copying a bitmap Theodore Ts'o
2011-12-18 6:42 ` [PATCH 10/10] libext2fs: add bitmap statistics Theodore Ts'o
2011-12-19 11:43 ` Lukas Czerner
2011-12-19 8:50 ` [PATCH 00/10] extent-based bitmaps for e2fsprogs Lukas Czerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324190558-7436-6-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).