]> git.ipfire.org Git - thirdparty/e2fsprogs.git/log
thirdparty/e2fsprogs.git
12 years agoUpdate for e2fsprogs 1.42-WIP-1005 release v1.42-WIP-1005
Theodore Ts'o [Wed, 5 Oct 2011 06:40:11 +0000 (02:40 -0400)] 
Update for e2fsprogs 1.42-WIP-1005 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate e2fsprogs.pot file for translators
Theodore Ts'o [Wed, 5 Oct 2011 06:08:10 +0000 (02:08 -0400)] 
Update e2fsprogs.pot file for translators

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Wed, 5 Oct 2011 06:04:08 +0000 (02:04 -0400)] 
po: update de.po (from translationproject.org)

Addresses-Debian-Bug: #520985

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: Fix up usage & error text for cluster size specification
Eric Sandeen [Tue, 4 Oct 2011 22:12:11 +0000 (17:12 -0500)] 
mke2fs: Fix up usage & error text for cluster size specification

Commit c6ed60cd removed "f" (fragment size) from the getopt string,
and re-used its spot in the getopt switch, but didn't update the
usage message or the error message during parsing.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoPass the gettext() function to libcom_err
Theodore Ts'o [Wed, 5 Oct 2011 05:00:30 +0000 (01:00 -0400)] 
Pass the gettext() function to libcom_err

For those e2fsprogs programs which use libcom_err and are
internationalized, pass the gettext() function to libcom_err during
program initialization.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibcom_err: add set_com_err_gettext()
Theodore Ts'o [Wed, 5 Oct 2011 04:58:40 +0000 (00:58 -0400)] 
libcom_err: add set_com_err_gettext()

This function allows programs to pass in a pointer to the gettext
function so that error table strings will can be internationalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: add prof_err.c, ext2_err.c and uuidd.c to POTFILES.in
Theodore Ts'o [Wed, 5 Oct 2011 04:46:29 +0000 (00:46 -0400)] 
po: add prof_err.c, ext2_err.c and uuidd.c to POTFILES.in

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocompile_et: generate *_err.c files that have strings marked for xgettext
Theodore Ts'o [Wed, 5 Oct 2011 04:39:40 +0000 (00:39 -0400)] 
compile_et: generate *_err.c files that have strings marked for xgettext

This allows error code strings to be internationalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: remove NLS support
Theodore Ts'o [Tue, 4 Oct 2011 15:57:53 +0000 (11:57 -0400)] 
libquota: remove NLS support

In general libraries should never (a) call exit() or (b) print output
directly to the stdout (they might be used by GUI programs.  From (b)
follows (c), should never call internationalization functions
directly.

Also, since po/POTFILES.in wasn't edited, these strings weren't
getting included in e2fsprogs.pot for translation, so the _()
indirection didn't actually buy us anything.

We eventually need to nuke all of the log_fatal() and log_err() from
libquota, so best thing to do for now is remove NLS support
completely; no point whipsawing the translators with strings to
translate that will be disappearing soon anyway!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: use ext2_loff_t instead of loff_t
Theodore Ts'o [Tue, 4 Oct 2011 15:46:21 +0000 (11:46 -0400)] 
libquota: use ext2_loff_t instead of loff_t

The type loff_t is not portable.  Use ext2_loff_t which handles this
for us.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: remove get_qf_name()
Theodore Ts'o [Tue, 4 Oct 2011 15:38:47 +0000 (11:38 -0400)] 
libquota: remove get_qf_name()

The get_qf_name() function used PATH_MAX, which is non-portable.
Worse, it blindly assumed that PATH_MAX was the size of the buffer
passed to it --- which in the one and only place where it was used in
libquota, was a buffer declared to a fixed size 256 bytes.

Fix this by simply getting rid of the function altogether.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: clean up some gcc -Wall warnings
Theodore Ts'o [Tue, 4 Oct 2011 15:20:50 +0000 (11:20 -0400)] 
libquota: clean up some gcc -Wall warnings

Remove unused variables, places where 'return' was used with no value
in a non-void function, missing function declarations, etc.  Don't
assume that all systems have quotactl(), and use <sys/quota.h> if it
exists to define the quotactl interfaces.

One of the unused variables also got rid of a non-portable use of
PATH_MAX.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: remove get_qf_path()
Theodore Ts'o [Tue, 4 Oct 2011 14:42:56 +0000 (10:42 -0400)] 
libquota: remove get_qf_path()

This function isn't used anywhere, so remove it.  It also uses
PATH_MAX which is not portable.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: make the signal catcher more portable, take 2
Theodore Ts'o [Tue, 4 Oct 2011 14:36:47 +0000 (10:36 -0400)] 
e2fsck: make the signal catcher more portable, take 2

One table got missed when adding #ifdef's so that e2fsck/sigcatcher.c
would compile on non-Linux systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate debian/changelog for an interim release
Theodore Ts'o [Tue, 4 Oct 2011 04:28:28 +0000 (00:28 -0400)] 
Update debian/changelog for an interim release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix bad cast which causes problems for file systems > 512EB
Theodore Ts'o [Tue, 4 Oct 2011 03:47:19 +0000 (23:47 -0400)] 
libext2fs: fix bad cast which causes problems for file systems > 512EB

If the number of block groups exceeds 2**32, a bad cast would lead to
a bogus "Not enough space to build proposed filesystem while setting
up superblock" failure.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoAdd "big" and "huge" types to mke2fs.conf
Theodore Ts'o [Tue, 4 Oct 2011 03:46:17 +0000 (23:46 -0400)] 
Add "big" and "huge" types to mke2fs.conf

mke2fs attempts to use the "big" and "huge" types, and now that mke2fs
will complain if there are file system types which are undefined,
let's add definitions for them.

Thanks to Richard Jones for reporting this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: rebuild the .gmo files if they are missing or out of date
Theodore Ts'o [Tue, 4 Oct 2011 03:18:10 +0000 (23:18 -0400)] 
po: rebuild the .gmo files if they are missing or out of date

This makes life easier to support patch updates for Debian when we are
getting lots of updates of .po files, since the .gmo files are binary
files that we don't really need to worry about.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsprogs: Fix thinko in ext2fs_initialize bigalloc case
Eric Sandeen [Tue, 4 Oct 2011 03:11:25 +0000 (23:11 -0400)] 
e2fsprogs: Fix thinko in ext2fs_initialize bigalloc case

Surely we should be setting s_clusters_per_group, not
s_blocks_per_group, to EXT2_MAX_CLUSTERS_PER_GROUP here.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: move #include "ext2fs.h" from crc32c_defs.h to crc32c.c
Theodore Ts'o [Tue, 4 Oct 2011 02:49:45 +0000 (22:49 -0400)] 
libext2fs: move #include "ext2fs.h" from crc32c_defs.h to crc32c.c

The byte swap functions which are defined in ext2fs.h are only needed
by crc32.c, and not by gen_crc32ctable.c.  The gen_crc32ctable program
needs to be compiled on the host OS, where ext2fs.h may not be
present.  So move the use of the header function to crc32c.c, to avoid
compilation problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: fix on-line resizing
Theodore Ts'o [Tue, 4 Oct 2011 00:35:19 +0000 (20:35 -0400)] 
resize2fs: fix on-line resizing

On-line resizing has been broken in the 1.42 series for two reasons:
(a) the call to the new EXT4_IOC_RESIZE_FS ioctl checked for ENOTTY to
indicate that the ioctl does not exist, when in fact EINVAL is what is
returned if the ioctl doesn't exist.  (b) resize2fs was passing in a
pointer to a 64-bit value, when the ioctl expected a 32-bit value.
This was OK on little-endian systems, but it wouldn't work at all on
big-endian systems.

Fix both problems.

Addresses-Debian-Bug: #451388

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs, libquota: fix some makefile dependency issues
Theodore Ts'o [Mon, 3 Oct 2011 18:57:51 +0000 (14:57 -0400)] 
libext2fs, libquota: fix some makefile dependency issues

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsprogs: include headers for open() in ext2fs.h
Eric Sandeen [Mon, 3 Oct 2011 17:16:48 +0000 (13:16 -0400)] 
e2fsprogs: include headers for open() in ext2fs.h

ext2fs.h now calls open() so it should include the headers needed
for this system call as well.

Addresses-Red-Hat-Bugzilla: #742147

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Mon, 3 Oct 2011 02:50:38 +0000 (22:50 -0400)] 
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Mon, 3 Oct 2011 02:50:38 +0000 (22:50 -0400)] 
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoUpdate for e2fsprogs 1.42-WIP-1001 release v1.42-WIP-1001
Theodore Ts'o [Sat, 1 Oct 2011 04:10:24 +0000 (00:10 -0400)] 
Update for e2fsprogs 1.42-WIP-1001 release

12 years agodebian: avoid installing source.lintian-overrides
Theodore Ts'o [Sat, 1 Oct 2011 04:08:12 +0000 (00:08 -0400)] 
debian: avoid installing source.lintian-overrides

This avoids lintian errors if we try to rebuild the package since
source.lintian-overrides ends up getting installed in
debian/source/usr/src/lintian/overrides/source, which then gets
dropped in the diff file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate e2fsprogs.pot file for translators
Theodore Ts'o [Sat, 1 Oct 2011 02:12:02 +0000 (22:12 -0400)] 
Update e2fsprogs.pot file for translators

12 years agoe2fsck: avoid unnecessary reboots in some cases when checking the root fs
Theodore Ts'o [Sat, 1 Oct 2011 00:59:17 +0000 (20:59 -0400)] 
e2fsck: avoid unnecessary reboots in some cases when checking the root fs

If e2fsck modifies certain superblock fields which the kernel doesn't
look at, mark the superblock as dirty without marking the file system
as changed.  This will avoid e2fsck signalling the init scripts that a
reboot is necessary.  This is safe, because the kernel doesn't
actually look at these superblock fields.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agofilefrag: fix an off by one error in when printing the next expected block
Theodore Ts'o [Fri, 30 Sep 2011 23:18:09 +0000 (19:18 -0400)] 
filefrag: fix an off by one error in when printing the next expected block

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agofilefrag: Display the number of contiguous, not physical, extents
Theodore Ts'o [Fri, 30 Sep 2011 22:43:39 +0000 (18:43 -0400)] 
filefrag: Display the number of contiguous, not physical, extents

From a bug report filed by Ibragimov Rinat:

   When filefrag uses FIEMAP ioctl its logic differs for ordinary and
   verbose (-v) modes. ext4 returns extent on every 32768 block so on
   large files it is possible that `filefrag large-file' tells about 4
   extents while `filefrag -v large-file' finds only one.

   Also when I tried to use generic_block_fiemap function to add
   FIEMAP for reiserfs, every block was reported as a new extent
   resulting in thousands "extents" for continuous files.

   I think filefrag should merge adjacent extents even when -v is not
   specified.

Addresses-Debian-Bug: #631498

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs.conf.5: clarify the man page regarding boolean relations
Theodore Ts'o [Fri, 30 Sep 2011 22:32:44 +0000 (18:32 -0400)] 
mke2fs.conf.5: clarify the man page regarding boolean relations

Explain more clearly how boolean relations in the mke2fs.conf file are
parsed, and which config parameters are in fact boolean relations.

Addresses-Debian-Bug: #634883

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Always swab the MMP block on big-endian systems machines
Darrick J. Wong [Fri, 30 Sep 2011 19:41:26 +0000 (12:41 -0700)] 
libext2fs: Always swab the MMP block on big-endian systems machines

The MMP code in libext2fs tries to gate MMP block swab'ing with this
test:

if (fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))

However, EXT2FS_ENABLE_SWAPFS never seems to be defined anywhere (all
possible existed, the field fs->super->s_magic is always in host
byteorder, so the test always fails.  So, we can change the #ifdef to
WORDS_BIGENDIAN (which is conditionally defined on BE platforms) and
get rid of the broken if test.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: zero ctx->fs after freeing fs when restarting due to MMP
Darrick J. Wong [Fri, 30 Sep 2011 19:40:05 +0000 (12:40 -0700)] 
e2fsck: zero ctx->fs after freeing fs when restarting due to MMP

If MMP is enabled and e2fsck determines that it needs to restart
itself on account of various MMP conditions, it will close the current
fs and jump back to the start of fs checking.  However, closing fs
also frees it, which means that we need to set ctx->fs to NULL to
prevent subsequent open code from accessing the old deleted pointer.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Fix various bugs from the metadata checksum integration
Darrick J. Wong [Fri, 30 Sep 2011 19:38:43 +0000 (12:38 -0700)] 
libext2fs: Fix various bugs from the metadata checksum integration

Fix several minor errors in structure definitions, the byteswap code,
and Makefiles that result from merging the crc32c and initial parts of
the metadata checksumming patchset.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: simplify binary search in ea_refcount.c
Theodore Ts'o [Fri, 30 Sep 2011 20:38:26 +0000 (16:38 -0400)] 
e2fsck: simplify binary search in ea_refcount.c

Remove the interpolation search in ea_refcount.  The added complexity
isn't worth the speed up.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: add hurd-specific mke2fs.conf file
Theodore Ts'o [Thu, 29 Sep 2011 03:12:45 +0000 (23:12 -0400)] 
debian: add hurd-specific mke2fs.conf file

Addresses-Debian-Bug: #629355

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: set s_max_mnt_count to -1 by default
Theodore Ts'o [Thu, 29 Sep 2011 02:45:12 +0000 (22:45 -0400)] 
mke2fs: set s_max_mnt_count to -1 by default

If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which
is also the default), s_max_mnt_count needs to be set to -1, instead
of 0.  Kernels newer than 3.0 will interpret 0 to disable periodic
checks, but older kernels will print a warning message on each mount,
which will annoy users.

Addresses-Debian-Bug: #632637

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: make the signal catcher more portable
Theodore Ts'o [Thu, 29 Sep 2011 02:09:14 +0000 (22:09 -0400)] 
e2fsck: make the signal catcher more portable

All of the signals which the signal catcher tries to interpret aren't
necessarily defined on all systems.  So add #ifdef's to protect
various signals to avoid compilation failures on non-x86 platforms.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: use ext2fs byte swap functions for portability
Theodore Ts'o [Thu, 29 Sep 2011 00:27:03 +0000 (20:27 -0400)] 
libext2fs: use ext2fs byte swap functions for portability

The functions htole32(), le32toh(), be32toh(), htobe32() aren't
defined in all environments.  Use the ext2fs byte swap functions for
portability.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: use ext2fs byte swapping functions for portability
Theodore Ts'o [Thu, 29 Sep 2011 00:08:37 +0000 (20:08 -0400)] 
libquota: use ext2fs byte swapping functions for portability

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: check for invalid bad block inode
Theodore Ts'o [Wed, 28 Sep 2011 19:12:55 +0000 (15:12 -0400)] 
e2fsck: check for invalid bad block inode

In some cases the bad block inode gets corrupted.  If it looks insane,
offer to clear it before trying to interpret it does more harm than
good.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: don't bomb out if DEB_BUILD_OPTIONS contains nostrip
Theodore Ts'o [Sun, 25 Sep 2011 19:40:24 +0000 (15:40 -0400)] 
debian: don't bomb out if DEB_BUILD_OPTIONS contains nostrip

The debugging packages will contain no debugging symbols (since they
are in the unstripped executables and libraries) but at least the
build won't crash.

Addresses-Debian-Bug: #627535

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate for e2fsprogs 1.42-WIP-0925 release v1.42-WIP-0925
Theodore Ts'o [Sun, 25 Sep 2011 05:52:03 +0000 (01:52 -0400)] 
Update for e2fsprogs 1.42-WIP-0925 release

12 years agoAdd spd_readdir.c to the contrib directory
Theodore Ts'o [Sun, 25 Sep 2011 06:10:28 +0000 (02:10 -0400)] 
Add spd_readdir.c to the contrib directory

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: update e2fslibs.symbols to include newly added symbols
Theodore Ts'o [Sun, 25 Sep 2011 05:23:41 +0000 (01:23 -0400)] 
debian: update e2fslibs.symbols to include newly added symbols

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian/copyright: update the debian copyright file
Theodore Ts'o [Sun, 25 Sep 2011 05:20:41 +0000 (01:20 -0400)] 
debian/copyright: update the debian copyright file

Fix up the debian/copyright file so it contains the full information
of the licenses used by all of the libraries.  Also use a single
copyright file for e2fsprogs and e2fslibs, to make sure they are kept
in sync.

Addresses-Debian-Bug: #614662

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: initialize inode to 0 in list_dir_proc() if no inode nr
Eric Sandeen [Sun, 25 Sep 2011 04:49:58 +0000 (00:49 -0400)] 
debugfs: initialize inode to 0 in list_dir_proc() if no inode nr

If (!ino), the inode will be uninitialized when we print it
in the PARSE_OPT case.

So do the same as the LONG_OPT case, and memset it to 0 if
(!ino).

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: regression tests for INCOMPAT_MMP feature
Andreas Dilger [Sat, 24 Sep 2011 18:13:27 +0000 (14:13 -0400)] 
e2fsck: regression tests for INCOMPAT_MMP feature

Add tests for the MMP feature - creating a filesystem with mke2fs
and MMP enabled, enable/disable MMP with tune2fs, disabling the
e2fsck MMP flag with tune2fs after a failed e2fsck, and e2fsck
checking and fixing a corrupt MMP block.

The MMP tests need to be run from a real disk, not tmpfs, because
tmpfs doesn't support O_DIRECT reads, which MMP uses to ensure
that reads from the MMP block are not filled from the page cache.
Using a local disk does not slow down the tests noticably, since
they wait to detect if the MMP block is being modified.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoext2fs: add multi-mount protection (INCOMPAT_MMP)
Andreas Dilger [Sat, 24 Sep 2011 17:48:55 +0000 (13:48 -0400)] 
ext2fs: add multi-mount protection (INCOMPAT_MMP)

Multi-mount protection is feature that allows mke2fs, e2fsck, and
others to detect if the filesystem is mounted on a remote node (on
SAN disks) and avoid corrupting the filesystem.  For e2fsprogs this
means that it checks the MMP block to see if the filesystem is in use,
and marks the filesystem busy while e2fsck is running on the system.

This is useful on SAN disks that are shared between high-availability
servers, or accessible by multiple nodes that aren't in HA pairs.  MMP
isn't intended to serve as a primary HA exclusion mechanism, but as a
failsafe to protect against user, software, or hardware errors.

There is no requirement that e2fsck updates the MMP block at regular
intervals, but e2fsck does this occasionally to provide useful
information to the sysadmin in case of a detected conflict.

For the kernel (since Linux 3.0) MMP adds a "heartbeat" mechanism to
periodically write to disk (every few seconds by default) to notify
other nodes that the filesystem is still in use and unsafe to modify.

Originally-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotune2fs: miscellaneous whitespace fixups
Andreas Dilger [Sat, 24 Sep 2011 17:25:34 +0000 (13:25 -0400)] 
tune2fs: miscellaneous whitespace fixups

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotune2fs: kill external journal if device not found
Andreas Dilger [Sat, 24 Sep 2011 17:17:05 +0000 (13:17 -0400)] 
tune2fs: kill external journal if device not found

Continue to remove the external journal device even if the device
cannot be found.

Add a test to verify that the journal device/UUID are actually removed
from the superblock.  It isn't possible to use a real journal device
for testing without loopback devices and such (it must be a block device)
and this would invite complexity and failures in the regression test.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomisc: quiet minor compiler errors
Andreas Dilger [Sat, 24 Sep 2011 16:59:31 +0000 (12:59 -0400)] 
misc: quiet minor compiler errors

Several compiler errors are quieted:
- zero-length gnu_printf format string
- unused variable
- uninitalized variable (though it isn't actually used for anything)
- fixed a bug in ext2fs_stat() if stat64() does not exist

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: add flag to ext2fs_flush() and ext2fs_close() to avoid fsync
Richard W.M. Jones [Sat, 24 Sep 2011 14:50:42 +0000 (10:50 -0400)] 
libext2fs: add flag to ext2fs_flush() and ext2fs_close() to avoid fsync

This adds new APIs: ext2fs_flush2 and ext2fs_close2 which take an
extra 'int flags' parameter.

This allows us to pass in an EXT2_FLAG_FLUSH_NO_SYNC flag which avoids
fsync'ing the filesystem when closing it.  For the case we have in
mind where we are just constructing a throwaway ext2 filesystem in a
file in order to boot a VM, this saves over 5 seconds during the boot
process and avoids many unnecessary disk writes.

Existing code using ext2fs_flush and ext2fs_close remains unaffected
by this change.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck.8: fix spelling mistake in man page
Theodore Ts'o [Tue, 20 Sep 2011 17:21:28 +0000 (13:21 -0400)] 
e2fsck.8: fix spelling mistake in man page

Addresses-Debian-Bug: #642193

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: only build a static library
Theodore Ts'o [Mon, 19 Sep 2011 17:39:38 +0000 (13:39 -0400)] 
libquota: only build a static library

Since the libquota library has namespace contamination issues, don't
build a shared library and link against it statically.  Don't include
it as part of the Debian packages.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: add support for multiarch
Theodore Ts'o [Mon, 19 Sep 2011 03:53:23 +0000 (23:53 -0400)] 
debian: add support for multiarch

Enhance the debian build rules so it will create multiarch compliant
packages on those distributions that have support for it.

Also remove e2initrd-helper from the e2fsprogs package since no one
uses it any more.

Also update the debian policy standards version to 3.9.2.

Addresses-Debian-Bug: #632169

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoShorten compile commands run by the build system
Theodore Ts'o [Sun, 18 Sep 2011 21:34:37 +0000 (17:34 -0400)] 
Shorten compile commands run by the build system

The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: free tdb_dir string if it came from the profile
Eric Sandeen [Fri, 16 Sep 2011 20:49:40 +0000 (15:49 -0500)] 
mke2fs: free tdb_dir string if it came from the profile

if tdb_dir points to a string allocated from profile_get_string,
it should be freed again before we exit.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe4defrag: Check error return of sysconf()
Eric Sandeen [Fri, 16 Sep 2011 20:49:39 +0000 (15:49 -0500)] 
e4defrag: Check error return of sysconf()

In theory sysconf() can fail, so check for an error return.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: Don't try to close an fd which is negative
Eric Sandeen [Fri, 16 Sep 2011 20:49:38 +0000 (15:49 -0500)] 
e2fsprogs: Don't try to close an fd which is negative

These reflect either file descriptors which aren't tested
for failure, or closures of fd's which may have failed.

In setup_tdb(), test for failure of mkstemp and return
without trying to open the file (again).

In reserve_stdio_fds, rather than closing the "extra"
fd == 3 due to the way the loop is written, just
don't go that far by using while (fd <= 2).

In logsave, it forks and retries forever if open fails,
but at least make coverity happy by explicitly not
trying to close a negative file descriptor.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotune2fs: handle inode and/or block bitmap read failures in resize_inode()
Eric Sandeen [Fri, 16 Sep 2011 20:49:37 +0000 (15:49 -0500)] 
tune2fs: handle inode and/or block bitmap read failures in resize_inode()

Handle these failures in resize_inode, and handle the propagated
error in the caller.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: Fix leaks in error paths
Eric Sandeen [Fri, 16 Sep 2011 20:49:36 +0000 (15:49 -0500)] 
e2fsck: Fix leaks in error paths

fn and/or array was not freed in some error paths.

[ Also make sure the array is NULL terminated before we free it in
  get_dirlist(). --tytso]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotest_icount: fclose() before exit
Eric Sandeen [Fri, 16 Sep 2011 20:49:35 +0000 (15:49 -0500)] 
test_icount: fclose() before exit

Just to be tidy.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2: Fix leaks in write_bitmaps on error returns
Eric Sandeen [Fri, 16 Sep 2011 20:49:34 +0000 (15:49 -0500)] 
libext2: Fix leaks in write_bitmaps on error returns

block_buf and/or inode_buf may not be properly freed on an error
return.

Create a new errout: target to free them as needed in error conditions.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2initrd_helper: Fix memory leak on error
Eric Sandeen [Fri, 16 Sep 2011 20:49:33 +0000 (15:49 -0500)] 
e2initrd_helper: Fix memory leak on error

Some error paths did not properly free "buf"

And the normal exit seemed to close e2_file twice (?)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: Do not let -t or -T be specified more than once
Eric Sandeen [Fri, 16 Sep 2011 20:49:32 +0000 (15:49 -0500)] 
mke2fs: Do not let -t or -T be specified more than once

In addition to not making sense, it causes a memory leak
when fs_type gets overwritten.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: remove extraneous memset
Eric Sandeen [Fri, 16 Sep 2011 20:49:31 +0000 (15:49 -0500)] 
e2fsck: remove extraneous memset

e2fsck_allocate_memory() already sets allocated memory to 0,
so remove the explicit memset.

Especially since it was setting the wrong size (iter not *iter)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agofilefrag: Fix uninitialized "expected" value
Eric Sandeen [Fri, 16 Sep 2011 20:49:30 +0000 (15:49 -0500)] 
filefrag: Fix uninitialized "expected" value

The "count" variable is only ever set if FIBMAP is used,
due to the -B switch, or a fiemap failure.  However,
we use it unconditionally to calculate "expected" for
extN files, so we can end up printing garbage.

Initialize count to 0, and unless we go through the FIBMAP
path, expected will be 0 as well, and in that case do not
print the message.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agosubst: Fix free of uninit pointers
Eric Sandeen [Fri, 16 Sep 2011 20:49:29 +0000 (15:49 -0500)] 
subst: Fix free of uninit pointers

in add_subst(), if the malloc of ent->name fails, we goto fail;
which will free ent->name (which is null, so OK) but also free
ent->value (which is uninitialized).  There is no case where
we must free ent->value on an error (it is allocated last, and
if it fails it of course doesn't need to be freed) so just
remove it.

Also "retval" is only assigned once to the constant ENOMEM,
so we can just return that explicitly in the failure case.

Signed-off-by: Eric Saneeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: Fix some error cleanup path bugs
Eric Sandeen [Fri, 16 Sep 2011 20:49:28 +0000 (15:49 -0500)] 
e2fsprogs: Fix some error cleanup path bugs

In inode_open(), if the allocation of &io fails, we go to cleanup
and dereference io to test io->name, which is a bug.

Similarly in undo_open()  if allocation of &data fails, we
go to cleanup and dereference data to test data->real.

In the test_open() case we explicitly set retval to the only
possible error return from ext2fs_get_mem(), so remove that
for tidiness.

The other changes just make make earlier returns go through
the error goto for consistency.

In many cases we returned directly from the first error, but
"goto cleanup" etc for every subsequent error.  In some
cases this leads to "impossible" tests such as:

if (ptr)
ext2fs_free_mem(&ptr)

on paths where ptr cannot be null because we would have
returned directly earlier, and Coverity flags this.

This isn't really indicative of an error in most cases, but
I think it can be clearer to always exit through the error goto
if it's used later in the function.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: Don't store old_op from ehandler_operation if we don't restore it.
Eric Sandeen [Fri, 16 Sep 2011 20:49:27 +0000 (15:49 -0500)] 
e2fsck: Don't store old_op from ehandler_operation if we don't restore it.

old_op is set but never used, because we restore "0"
not old_op.  So don't bother with it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibe2p: reach unreachable code
Eric Sandeen [Fri, 16 Sep 2011 20:49:26 +0000 (15:49 -0500)] 
libe2p: reach unreachable code

The EOPNOTSUPP case is unreachable, being outside a set of:
 #if
...
return;
 #else
...
return;
 #endif

Fix this up so that if neither HAVE_CHFLAGS nor
HAVE_EXT2_IOCTLS applies, we set EOPNOTSUPP.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agofreefrag: fix up getopt case statement
Eric Sandeen [Fri, 16 Sep 2011 20:49:25 +0000 (15:49 -0500)] 
freefrag: fix up getopt case statement

There is no need to print out a "bad option" message; getopt
does that for us, and in fact will change "c" to "?" so
it's not even useful.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agouuidd: Add missing break to option case statement
Eric Sandeen [Fri, 16 Sep 2011 20:49:24 +0000 (15:49 -0500)] 
uuidd: Add missing break to option case statement

Specifying the "-n" option to uuidd would incorrectly
fall through to the "-p" case, and assign that number to
the pidfile_path.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: annotate intentional fallthroughs in case statements
Eric Sandeen [Fri, 16 Sep 2011 20:49:23 +0000 (15:49 -0500)] 
e2fsprogs: annotate intentional fallthroughs in case statements

Using the /* fallthrough */ comment lets Coverity (and humans)
know that we really do want to fall through in these case statements.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: handle null fs in print_pathname()
Eric Sandeen [Fri, 16 Sep 2011 20:49:22 +0000 (15:49 -0500)] 
e2fsck: handle null fs in print_pathname()

testing fs for NULL in expand_percent_expression():

e2fsck_ctx = fs ? (e2fsck_t) fs->priv_data : NULL;

implies that fs could be NULL, but it's passed to print_pathname()
which defererences it without further testing.

So make this safe by returning "???" for a nul fs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: Potential null ptr deref in undo_err_handler_init
Eric Sandeen [Fri, 16 Sep 2011 20:49:21 +0000 (15:49 -0500)] 
libext2fs: Potential null ptr deref in undo_err_handler_init

In the !undo_io_backing_manager case, undo_err_handler_init
will be passed a null data->real, which will be dereferenced.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2: move buf variable completely under ifdef
Eric Sandeen [Fri, 16 Sep 2011 20:49:20 +0000 (15:49 -0500)] 
libext2: move buf variable completely under ifdef

If !WORDS_BIGENDIAN, it is pointless to test whether buf
is NULL, because it is initialized to NULL and never changed.
This makes Coverity complain, so we can just move all handling
of "buf" under the #ifdef.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: remove impossible tests for null usage_types
Eric Sandeen [Fri, 16 Sep 2011 20:49:19 +0000 (15:49 -0500)] 
mke2fs: remove impossible tests for null usage_types

parse_fs_type explicitly sets usage_types if it is null,
so there is no need to test for null later.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agofsck: fix -C option parsing
Eric Sandeen [Fri, 16 Sep 2011 20:49:18 +0000 (15:49 -0500)] 
fsck: fix -C option parsing

The i++; statement is unreachable; fix same as commit
f1c2eaac535bd9172a35ce39b6d8f392321f274d in util-linux

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: Remove impossible name_len tests.
Eric Sandeen [Fri, 16 Sep 2011 20:49:17 +0000 (15:49 -0500)] 
e2fsprogs: Remove impossible name_len tests.

The name_len field in ext2_dir_entry is actually comprised of
the name length in the lower 8 bytes, and the filetype in the
high 8 bytes.  So in places, we mask name_len with 0xFF to
get the actual length.

But once we have masked name_len with 0xFF, there is no point
in testing whether it is greater than EXT2_NAME_LEN, which
is 255 - or 0xFF.  So all of these tests are extraneous.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2: Fix EXT2_LIB_SOFTSUPP masking
Eric Sandeen [Fri, 16 Sep 2011 20:49:16 +0000 (15:49 -0500)] 
libext2: Fix EXT2_LIB_SOFTSUPP masking

EXT2_LIB_SOFTSUPP_INCOMPAT_* are supposed to be bitmasks
of features which can be opened even though they are
under development.  The intent is that these are masked
out of the features list, so that they will be ignored
on open.

However, the code does a logical not vs. a bitwise not:

features &= !EXT2_LIB_SOFTSUPP_INCOMPAT;

which will not have the desired effect...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2s: fix swapfs.c so it builds on big endian systems
Theodore Ts'o [Fri, 16 Sep 2011 21:51:03 +0000 (17:51 -0400)] 
libext2s: fix swapfs.c so it builds on big endian systems

Also cleaned up ext2_fs.h, and improved the byte swapping code so the
extra fields in the large inode are properly byte swapped.

Addresses-Debian-Bug: #641838

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: use 1.41.99 hack so that lintain doesn't complain
Theodore Ts'o [Fri, 16 Sep 2011 16:15:17 +0000 (12:15 -0400)] 
debian: use 1.41.99 hack so that lintain doesn't complain

We'll have to fix this up before 1.42 ships.  And the quota library
badly needs to be cleaned up...

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate for e2fsprogs 1.42-WIP-0916 release v1.42-WIP-0916
Theodore Ts'o [Fri, 16 Sep 2011 14:46:47 +0000 (10:46 -0400)] 
Update for e2fsprogs 1.42-WIP-0916 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: indicate in the ELF library image that it requires libext2fs
Theodore Ts'o [Fri, 16 Sep 2011 15:12:06 +0000 (11:12 -0400)] 
libquota: indicate in the ELF library image that it requires libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: add 64-bit support to the set_field commands
Theodore Ts'o [Thu, 15 Sep 2011 17:38:41 +0000 (13:38 -0400)] 
debugfs: add 64-bit support to the set_field commands

The set_fields commands (set_super_value, set_inode_field,
set_block_group) now handle fields which store in split fields on
ext4's on-disk format.  For example, the superblock fields
s_blocks_count and s_blocks_count_hi.

The user can either set the low or high part of the field via
"blocks_count_lo" or "blocks_count_hi", or both parts can be set via
"blocks_count".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: add metadata checksum and snapshot feature flags
Theodore Ts'o [Thu, 15 Sep 2011 14:38:55 +0000 (10:38 -0400)] 
libext2fs: add metadata checksum and snapshot feature flags

Reserve EXT4_FEATURE_RO_COMPAT_METADATA_CSUM and
EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP.  Also reserve fields in the
superblock and the inode for the checksums.  In the block group
descriptor, reserve the exclude bitmap field for the snapshot feature,
and checksums for the inode and block allocation bitmaps.

With this commit, the metadata checksum and exclude bitmap features
should have reserved all of the fields they need in ext4's on-disk
format.

This commit also fixes an a missing byte swap for s_overhead_blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Amir Goldstein <amir73il@gmail.com>
12 years agodumpe2fs: display "free blocks" as "free clusters" for bigalloc file systems
Theodore Ts'o [Fri, 16 Sep 2011 14:13:41 +0000 (10:13 -0400)] 
dumpe2fs: display "free blocks" as "free clusters" for bigalloc file systems

Change this for the equivalent function in debugfs as well.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: remove redundant last-group check in ext2fs_check_desc()
Eric Sandeen [Fri, 16 Sep 2011 13:31:49 +0000 (09:31 -0400)] 
libext2fs: remove redundant last-group check in ext2fs_check_desc()

ext2fs_group_last_block2() already properly calculates
the last block in the last group, so there is no need
to special-case this after the call.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: fix error in computing blocks of the ending group
Yongqiang Yang [Fri, 16 Sep 2011 13:25:51 +0000 (09:25 -0400)] 
e2fsck: fix error in computing blocks of the ending group

If the blocks of a filesystem is a multiple of blocks_per_group,
blocks of the ending group is computed wrongly.  Use the
new ext2fs_group_blocks_count() helper instead.

Eric Sandeen: Converted to use new blocks per group helper

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: add ext2fs_group_blocks_count helper
Eric Sandeen [Fri, 16 Sep 2011 13:21:53 +0000 (09:21 -0400)] 
e2fsprogs: add ext2fs_group_blocks_count helper

Code to count the number of blocks in the last partial
group is cut and pasted around the e2fsprogs codebase
a few times.

Making this a helper function should improve matters.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: fix size check in tst_inode_size
Theodore Ts'o [Fri, 16 Sep 2011 04:02:52 +0000 (00:02 -0400)] 
libext2fs: fix size check in tst_inode_size

Also add run tst_inode_size automaically from "make check"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 16 Sep 2011 04:00:04 +0000 (00:00 -0400)] 
Merge branch 'maint' into next

12 years agoe2fsck: do not attempt to discard if -n was specified
Lukas Czerner [Fri, 16 Sep 2011 03:55:23 +0000 (23:55 -0400)] 
e2fsck: do not attempt to discard if -n was specified

If '-n' option is specified there should be no changes made to the file
system hence we should not attempt to discard the file system. This
commit adds a check into the e2fsck_discard_blocks() condition so it skip
discard if E2F_OPT_NO flag is set.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotests: Print out list of failed tests
Lukas Czerner [Fri, 16 Sep 2011 03:54:49 +0000 (23:54 -0400)] 
tests: Print out list of failed tests

Currently we need to grep, list or just search for failed tests when
running 'make check' which is annoying. This commit simply prints out
the list of failed test names at the end of the output.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: Use punch hole as "discard" on regular files
Lukas Czerner [Fri, 16 Sep 2011 03:44:59 +0000 (23:44 -0400)] 
e2fsprogs: Use punch hole as "discard" on regular files

If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of
on block device, we can use punch hole instead of regular discard
command which would not work on regular file anyway. This gives us
several advantages. First of all when e2fsck is run with '-E discard'
parameter it will punch out all ununsed space from the image, hence
trimming down the file system image. And secondly, when creating an
file system on regular file (with '-E discard' which is default), we
can use punch hole to clear the file content, hence we can skip inode
table initialization, because reads from sparse area returns zeros. This
will result in faster file system creation (without the need to specify
lazy_itable_init) and smaller images.

This commit also fixes some tests that would fail due to mke2fs showing
discard progress, hence the output would differ.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: create open() and stat() helpers
Lukas Czerner [Fri, 16 Sep 2011 03:44:48 +0000 (23:44 -0400)] 
e2fsprogs: create open() and stat() helpers

In many places we are using #ifdef HAVE_OPEN64 to determine if we can
use open64() but that's ugly. This commit creates two new helpers
ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need
new typedef ext2fs_struct_stat for struct stat.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: Add crc32c implementation for metadata checksumming
Darrick J. Wong [Fri, 16 Sep 2011 03:46:37 +0000 (23:46 -0400)] 
libext2fs: Add crc32c implementation for metadata checksumming

Add a slicing-by-8 CRC32c implementation for metadata checksumming.
Adapted from Bob Pearson's kernel patch.

Also added a self-test mechanism so we can verify that the crc32c
implementation is working correctly.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>