Many files:

unix.c (main): If compression is enabled on the filesystem, print a
  	warning message (for now).
  message.c: Add new compression shortcut: @c == compress
  problem.c, problem.h (PR_1_COMPR_SET): Add new error code.
  pass1.c (check_blocks): If the inode has EXT2_COMPRBLK_FL flag set,
  	check to see if the filesystem supports compression.  If it does pass
  	this information down to process_block() so it can treat the
  	compressed block flag words correctly.  If not, offer to clear the
  	flag, since it shouldn't be set.
  	(process_block): If an inode has the compressed inode flag set, allow
  	EXT2FS_COMPRESSED_BLKADDR.
  pass1b.c (process_pass1b_block, delete_file_block, clone_file_block):
  pass2.c (deallocate_inode_block): Use HOLE_BLKADDR to check to see if
  	the block can be skipped.
ChangeLog, Makefile.in:
  Makefile.in: Exclude the internationalization files from being
  	distributed.
ChangeLog, configure, configure.in:
  configure.in: Add support for --enable-compression.  This is
  	experimental code only for now, which is why it's under --enable test.
  	Once it's stable, it will always be compiled in.
TODO:
  Commit additional TODO items.
bitmap-optimize
Theodore Ts'o 2000-02-11 15:55:07 +00:00
parent 5a63dd28f2
commit 1917875fcd
13 changed files with 341 additions and 193 deletions

View File

@ -1,3 +1,13 @@
2000-02-11 <tytso@snap.thunk.org>
* Makefile.in: Exclude the internationalization files from being
distributed.
* configure.in: Add support for --enable-compression. This is
experimental code only for now, which is why it's under
--enable test. Once it's stable, it will always be
compiled in.
2000-02-11 Theodore Ts'o <tytso@valinux.com>
* configure.in: Define HAVE_EXT2_IOCTLS based solely on the OS

View File

@ -121,7 +121,7 @@ $(srcdir)/.exclude-file:
a=$(SRCROOT); \
(cd $(srcdir)/.. ; find e2fsprogs \( -name \*~ -o -name \*.orig \
-o -name CVS -o -name \*.rej -o -name Makefile.pq \
-o -name TAGS -o -name \*.old \
-o -name TAGS -o -name \*.old -o -name \*.gmo \
-o -name TODO -o -name changed-files -o -name .#\* \) \
-print) | sed -e "s/e2fsprogs/$$a/" > $(srcdir)/.exclude-file
echo "$(SRCROOT)/build" >> $(srcdir)/.exclude-file
@ -129,6 +129,8 @@ $(srcdir)/.exclude-file:
echo "$(SRCROOT)/resize" >> $(srcdir)/.exclude-file
echo "$(SRCROOT)/powerquest" >> $(srcdir)/.exclude-file
echo "$(SRCROOT)/.exclude-file" >> $(srcdir)/.exclude-file
echo "$(SRCROOT)/po/stamp-cat-id" >> $(srcdir)/.exclude-file
echo "$(SRCROOT)/po/cat-id-tbl.c" >> $(srcdir)/.exclude-file
echo $(SRCROOT)/e2fsprogs-@E2FSPROGS_VERSION@.tar.gz \
>> $(srcdir)/.exclude-file

17
TODO
View File

@ -102,3 +102,20 @@ test.
b) An option to mkfs to zero the partition. Yes, it can be done with
dd, but it would be a nicer way of doing it.
------------------------------------------------------------------
Add support for in ext2fs_block_iterate() for a returning the
compressed flag blocks to block_iterate. Change default to not return
EXT2_COMPRESSED_BLKADDR. Change e2fsck to pass this flag in.
(The old compression patches did this by default all the time, which
is bad, since it meant e2fsck never saw the EXT2_COMPRESSED_BLKADDR
flagword.
------------------------------------------------------------
E2fsck should offer to clear all the blocks in an indirect block, not
the entire inode, so there's better recovery for when an indirect
block gets trashed.

390
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -111,6 +111,22 @@ AC_ARG_WITH([root-prefix],
root_prefix=$withval,
root_prefix=NONE)dnl
dnl
dnl handle --enable-compression
dnl
AC_ARG_ENABLE([compression],
[ --enable-compression enable EXPERIMENTAL compression support],
if test "$enableval" = "no"
then
echo "Disabling compression support"
else
AC_DEFINE(ENABLE_COMPRESSION)
echo "Enabling compression support"
echo "WARNING: Compression support is experimental"
fi
,
echo "Disabling compression support by default"
)
dnl
dnl handle --enable-dll-shlibs
dnl
AC_ARG_ENABLE([dll-shlibs],
@ -191,7 +207,7 @@ AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
ALL_LINGUAS="it"
ALL_LINGUAS="it nyc"
AM_GNU_GETTEXT
dnl
dnl handle --enable-profile

View File

@ -1,3 +1,26 @@
2000-02-11 <tytso@snap.thunk.org>
* unix.c (main): If compression is enabled on the filesystem,
print a warning message (for now).
* message.c: Add new compression shortcut: @c == compress
* problem.c, problem.h (PR_1_COMPR_SET): Add new error code.
* pass1.c (check_blocks): If the inode has EXT2_COMPRBLK_FL flag
set, check to see if the filesystem supports compression.
If it does pass this information down to process_block()
so it can treat the compressed block flag words
correctly. If not, offer to clear the flag, since it
shouldn't be set.
(process_block): If an inode has the compressed inode flag
set, allow EXT2FS_COMPRESSED_BLKADDR.
* pass1b.c (process_pass1b_block, delete_file_block,
clone_file_block):
* pass2.c (deallocate_inode_block): Use HOLE_BLKADDR to check to
see if the block can be skipped.
2000-02-08 <tytso@snap.thunk.org>
* util.c: Make resource tracking message more concise.

View File

@ -50,6 +50,7 @@
* @A error allocating
* @b block
* @B bitmap
* @c compress
* @C conflicts with some other fs block
* @i inode
* @I illegal
@ -95,6 +96,7 @@ static const char *abbrevs[] = {
N_("Aerror allocating"),
N_("bblock"),
N_("Bbitmap"),
N_("ccompress"),
N_("Cconflicts with some other fs @b"),
N_("iinode"),
N_("Iillegal"),

View File

@ -72,7 +72,8 @@ static errcode_t scan_callback(ext2_filsys fs, ext2_inode_scan scan,
struct process_block_struct {
ino_t ino;
int is_dir:1, clear:1, suppress:1, fragmented:1;
int is_dir:1, clear:1, suppress:1,
fragmented:1, compressed:1;
blk_t num_blocks;
e2_blkcnt_t last_block;
int num_illegal_blocks;
@ -773,12 +774,27 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
pb.num_illegal_blocks = 0;
pb.suppress = 0; pb.clear = 0;
pb.fragmented = 0;
pb.compressed = 0;
pb.previous_block = 0;
pb.is_dir = LINUX_S_ISDIR(pctx->inode->i_mode);
pb.inode = inode;
pb.pctx = pctx;
pb.ctx = ctx;
pctx->ino = ino;
if (inode->i_flags & EXT2_COMPRBLK_FL) {
if (EXT2_HAS_INCOMPAT_FEATURE(fs->super,
EXT2_FEATURE_INCOMPAT_COMPRESSION))
pb.compressed = 1;
else {
if (fix_problem(ctx, PR_1_COMPR_SET, pctx)) {
inode->i_flags &= ~EXT2_COMPRBLK_FL;
e2fsck_write_inode(ctx, ino, inode,
"check_blocks");
}
}
}
pctx->errcode = ext2fs_block_iterate2(fs, ino,
pb.is_dir ? BLOCK_FLAG_HOLE : 0,
block_buf, process_block, &pb);
@ -941,6 +957,28 @@ int process_block(ext2_filsys fs,
pctx = p->pctx;
ctx = p->ctx;
if (p->compressed && (blk == EXT2FS_COMPRESSED_BLKADDR)) {
/* todo: Check that the comprblk_fl is high, that the
blkaddr pattern looks right (all non-holes up to
first EXT2FS_COMPRESSED_BLKADDR, then all
EXT2FS_COMPRESSED_BLKADDR up to end of cluster),
that the feature_incompat bit is high, and that the
inode is a regular file. If we're doing a "full
check" (a concept introduced to e2fsck by e2compr,
meaning that we look at data blocks as well as
metadata) then call some library routine that
checks the compressed data. I'll have to think
about this, because one particularly important
problem to be able to fix is to recalculate the
cluster size if necessary. I think that perhaps
we'd better do most/all e2compr-specific checks
separately, after the non-e2compr checks. If not
doing a full check, it may be useful to test that
the personality is linux; e.g. if it isn't then
perhaps this really is just an illegal block. */
return 0;
}
if (blk == 0) {
if (p->is_dir == 0) {
/*
@ -976,7 +1014,7 @@ int process_block(ext2_filsys fs,
* file be contiguous. (Which can never be true for really
* big files that are greater than a block group.)
*/
if (p->previous_block) {
if (!HOLE_BLKADDR(p->previous_block)) {
if (p->previous_block+1 != blk)
p->fragmented = 1;
}
@ -1057,6 +1095,11 @@ int process_bad_block(ext2_filsys fs,
struct problem_context *pctx;
e2fsck_t ctx;
/*
* Note: This function processes blocks for the bad blocks
* inode, which is never compressed. So we don't use HOLE_BLKADDR().
*/
if (!blk)
return 0;

View File

@ -241,7 +241,7 @@ int process_pass1b_block(ext2_filsys fs,
int i;
e2fsck_t ctx;
if (!*block_nr)
if (HOLE_BLKADDR(*block_nr))
return 0;
p = (struct process_block_struct *) priv_data;
ctx = p->ctx;
@ -493,7 +493,7 @@ static int delete_file_block(ext2_filsys fs,
pb = (struct process_block_struct *) priv_data;
ctx = pb->ctx;
if (!*block_nr)
if (HOLE_BLKADDR(*block_nr))
return 0;
if (ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr)) {
@ -567,7 +567,7 @@ static int clone_file_block(ext2_filsys fs,
ctx = cs->ctx;
if (!*block_nr)
if (HOLE_BLKADDR(*block_nr))
return 0;
if (ext2fs_test_block_bitmap(ctx->block_dup_map, *block_nr)) {

View File

@ -605,7 +605,7 @@ static int deallocate_inode_block(ext2_filsys fs,
{
e2fsck_t ctx = (e2fsck_t) priv_data;
if (!*block_nr)
if (HOLE_BLKADDR(*block_nr))
return 0;
ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr);
ext2fs_unmark_block_bitmap(fs->block_map, *block_nr);

View File

@ -423,6 +423,11 @@ static const struct e2fsck_problem problem_table[] = {
N_("Special (device/socket/fifo) @i %i has immutable flag set. "),
PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
/* Imagic flag set on an inode when filesystem doesn't support it */
{ PR_1_COMPR_SET,
N_("@i %i has @cion flag set on @f without @cion support. "),
PROMPT_CLEAR, 0 },
/* Pass 1b errors */
/* Pass 1B: Rescan for duplicate/bad blocks */

View File

@ -241,7 +241,10 @@ struct problem_context {
/* Immutable flag set on a device or socket inode */
#define PR_1_SET_IMMUTABLE 0x010030
/* Compression flag set on a non-compressed filesystem */
#define PR_1_COMPR_SET 0x010031
/*
* Pass 1b errors
*/

View File

@ -757,6 +757,11 @@ restart:
"(%s)", ctx->filesystem_name);
goto get_newer;
}
#ifdef ENABLE_COMPRESSION
if (s->s_feature_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION)
com_err(ctx->program_name, 0,
_("Warning: compression support is experimental.\n"));
#endif
if (ctx->device_name == 0 &&
(s->s_volume_name[0] != 0)) {
char *cp = malloc(sizeof(s->s_volume_name)+1);