]> git.ipfire.org Git - thirdparty/e2fsprogs.git/log
thirdparty/e2fsprogs.git
11 years agoAdd patches for 1.42.4-3 debian-squeeze
Theodore Ts'o [Wed, 13 Jun 2012 20:17:33 +0000 (16:17 -0400)] 
Add patches for 1.42.4-3

11 years agoMerge branch 'maint' into debian
Theodore Ts'o [Wed, 13 Jun 2012 20:07:50 +0000 (16:07 -0400)] 
Merge branch 'maint' into debian

11 years agoUpdate debian changelog for 1.42.4-3
Theodore Ts'o [Wed, 13 Jun 2012 20:05:30 +0000 (16:05 -0400)] 
Update debian changelog for 1.42.4-3

11 years agochattr: add the -C option to the usage message
Liu Bo [Wed, 13 Jun 2012 19:43:23 +0000 (15:43 -0400)] 
chattr: add the -C option to the usage message

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agoUpdate version.h using the proper abbreviation for June
Theodore Ts'o [Wed, 13 Jun 2012 19:36:56 +0000 (15:36 -0400)] 
Update version.h using the proper abbreviation for June

The configure script uses the date string in version.h to calculate a
version date code.  This only used for tagging prerelease tarball, so
it's not a big deal, but fix this for correctness' sake.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoFix blhc (Build Log Hardening Check) warnings
Theodore Ts'o [Wed, 13 Jun 2012 19:29:13 +0000 (15:29 -0400)] 
Fix blhc (Build Log Hardening Check) warnings

The Build Log Hardening Check is a debian tool which scans the output
of a package build making sure that the security hardening flags are
used when compiling and linking all of binaries in a package.

For the most part we were passing CFLAGS, CPPFLAGS, and LDFLAGS down
to the compiler and link commands, but there there were one or two
exceptions.  In addition, there where a few places in "make install"
where the V=1 option was not being honored, which triggered blhc
warnings since it couldn't analyze those commands.

The e2fsck.static was the only binary that was not getting built and
packaged with the hardening flags, but I've fixed all of the blhc
warnings so in the future it will be obvious if we regress.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoAdd patches for 1.42.4-2
Theodore Ts'o [Tue, 12 Jun 2012 22:50:01 +0000 (18:50 -0400)] 
Add patches for 1.42.4-2

11 years agolibquota: remove unneeded #include of <sys/quota.h>
Theodore Ts'o [Tue, 12 Jun 2012 22:25:34 +0000 (18:25 -0400)] 
libquota: remove unneeded #include of <sys/quota.h>

The attempted inclusion of sys/quota.h is causing failures in when
building on the hurd and freebsd platforms for Debian.  It's not
necessary any more, so just remove the #include.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoUpdate Release Notes, Changelogs, version.h, etc. for 1.42.4 release v1.42.4
Theodore Ts'o [Tue, 12 Jun 2012 21:21:38 +0000 (17:21 -0400)] 
Update Release Notes, Changelogs, version.h, etc. for 1.42.4 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolsattr, chattr: add support for btrfs's No_COW flag
Theodore Ts'o [Tue, 12 Jun 2012 21:09:39 +0000 (17:09 -0400)] 
lsattr, chattr: add support for btrfs's No_COW flag

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agotests: allow e2fsck tests to run on OS/X
Andreas Dilger [Tue, 12 Jun 2012 17:59:56 +0000 (13:59 -0400)] 
tests: allow e2fsck tests to run on OS/X

The "mktemp" program requires a template on OS/X.  Allow the test
TMPFILE to be created in the local /tmp directory for both OS/X
and Linux.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agotests: add two more tests of orphaned inode handling
Theodore Ts'o [Tue, 12 Jun 2012 05:38:57 +0000 (01:38 -0400)] 
tests: add two more tests of orphaned inode handling

Add two tests, f_orphan_indirect_inode, and f_orphan_extents_inode,
which tests the bug fixes in the two previous commits:

e2fsck: update global free blocks/inodes count when truncating orphan inodes
libext2fs: fix block iterator for extents when truncating inodes

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolibext2fs: fix block iterator for extents when truncating inodes
Theodore Ts'o [Tue, 12 Jun 2012 04:27:39 +0000 (00:27 -0400)] 
libext2fs: fix block iterator for extents when truncating inodes

When e2fsck uses the block iterator to release the blocks in an
extent-mapped inode, when the last block in an extent is removed, the
current extent has been removed and the extent cursor is now pointing
at the next inode.  But the block iterator code doesn't know that.  So
when it tries to go the next extent, it will end up skipping an
extent, and so the inode will be incompletely truncated.

The fix is to go to the next extent before calling the callback
function for the current extent.  This way, regardless of whether the
current extent gets removed, the extent cursor is still pointing at
the right place.

Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: update global free blocks/inodes count when truncating orphan inodes
Theodore Ts'o [Tue, 12 Jun 2012 02:18:25 +0000 (22:18 -0400)] 
e2fsck: update global free blocks/inodes count when truncating orphan inodes

By the time we start processing the orphan inode list, we have already
calculated the total expected number of free blocks and inodes in
ctx->free_{blocks,inodes}.  This is used to set the free blocks/inodes
count in the superblock in the case where we don't need to do a full
e2fsck.

We need to update these expected free block counts as we process the
orphan inode list so that superblock values are set correctly.
Otherwise we could have the following happen:

% e2fsck /tmp/test.img
e2fsck 1.42.3 (14-May-2012)
Truncating orphaned inode 12 (uid=0, gid=0, mode=0100644, size=0)
Setting free blocks count to 46 (was 79)
/tmp/test.img: clean, 12/16 files, 54/100 blocks

% e2fsck /tmp/test.img
e2fsck 1.42.3 (14-May-2012)
Setting free blocks count to 79 (was 46)
/tmp/test.img: clean, 12/16 files, 21/100 blocks

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agodebugfs: interpret date strings of the form @dddd
Theodore Ts'o [Tue, 12 Jun 2012 02:02:17 +0000 (22:02 -0400)] 
debugfs: interpret date strings of the form @dddd

Debugfs will now interpret date strings of the form @123 as 123
seconds after the start of the epoch.  This is handy when editing an
orphan inode linked list using the inode's deletion time field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agotests: add new test f_zero_extent_length
Tao Ma [Mon, 11 Jun 2012 03:56:30 +0000 (23:56 -0400)] 
tests: add new test f_zero_extent_length

If all of the extents in the last extent tree block (ETB) in a
non-trivial extent tree contain uninitialized extents which are after
the end of the file as defined by i_size, the hueristics will
incorrectly estimate the last entry (and hence the node's e_len field)
in the last entry of each level of the extent tree.

As Tao Ma has noted, since e2fsck was requiring that the length
(e_len) field of interior nodes be non-zero, this was causing false
failures where e2fsck would declare that the extent tree was
corrupted.

This was fixed in commit 9c40d14841: "e2fsck: only check for
zero-length leaf extents".  Add a regression test case to ensure that
this issue remains fixed.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agoe2fsck: only check for zero-length leaf extents
Theodore Ts'o [Mon, 11 Jun 2012 04:25:45 +0000 (00:25 -0400)] 
e2fsck: only check for zero-length leaf extents

The on-disk format for interior nodes in the extent tree does not
encode the length of each entry in the interior node; instead, it is
synthesized/simulated by the extent library code in libext2fs.
Unfortunately, this simulation is not perfect; in particular it does
not work for the last extent in the extent tree if there are
uninitialized blocks allocated using fallocate with
FALLOC_FL_KEEP_SIZE, and it leads to e2fsck incorrectly complaining
about an invalid zero-length extent.

We only need to worry about the extent length for the leaves of the
tree, since it is there were we are checking an on-disk value, as
opposed to a software-generated simulation.  So restrict the check of
extent length to leaf nodes in the extent tree.

Reported-by: Tao Ma <tm@tao.ma>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolibext2fs: fix i_blocks for extent leaf create/delete with bigalloc
Aditya Kali [Mon, 11 Jun 2012 03:52:11 +0000 (23:52 -0400)] 
libext2fs: fix i_blocks for extent leaf create/delete with bigalloc

When libext2fs allocates/deletes an extent leaf, the i_blocks
value is incremented/decremented by fs->blocksize / 512. This
is incorrect in case of bigalloc. The correct way here is to
use cluster_size / 512.

The problem is seen if we try to create a large inode using
libext2fs (say using ext2fs_block_iterate3()) on a bigalloc
filesystem. fsck catches this and complains.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agoe2fsck: correctly propagate error from journal to superblock
Theodore Ts'o [Mon, 11 Jun 2012 03:35:43 +0000 (23:35 -0400)] 
e2fsck: correctly propagate error from journal to superblock

If the file system is mounted read-only after a file system error has
been detected, the fact that an error occurred is written to the
journal.  This is important because while the journal is getting
replayed, the error indication in the superblock may very well get
overwritten.

Unfortunately, the code to propagate the error indication from the
journal to superblock was broken because this was being done before
the old file system handle is thrown away and the file system is
re-opened to ensure that no stale data is in the file system handle.
As a result, the error indication in the superblock was never written
out.

To fix this, we need to move the check if the journal's error
indicator has been set after the file system has been freed and
re-open.

Reported-by: Ken Sumrall <ksumrall@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolibquota: remove unnecessary definitions
Jan Kara [Mon, 4 Jun 2012 16:51:55 +0000 (12:51 -0400)] 
libquota: remove unnecessary definitions

Quite some definitions in quota library are not necessary. Remove them.
Also fold quota.h file into quotaio.h since it didn't contain that many
definitions.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agotests: fix the e2fsck test script to handle a missing test name
Theodore Ts'o [Fri, 1 Jun 2012 00:13:51 +0000 (20:13 -0400)] 
tests: fix the e2fsck test script to handle a missing test name

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agotests: add new test to validate errno handling in the journal superblock
Theodore Ts'o [Fri, 1 Jun 2012 00:12:35 +0000 (20:12 -0400)] 
tests: add new test to validate errno handling in the journal superblock

Add a new regression test f_jnl_errno

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: handle an already recovered journal with a non-zero s_error field
Theodore Ts'o [Thu, 31 May 2012 23:19:02 +0000 (19:19 -0400)] 
e2fsck: handle an already recovered journal with a non-zero s_error field

If a file system was remounted read-only after a file system
corruption is detected, and then that file system is mounted and
unmounted by the kernel, the journal would have been recovered, but
the kernel currently leaves the s_errno field still set.  This is
arguably a bug, since it has already propgated the non-zero s_errno
field to the file system superblock, where it will be retained until
e2fsck has been run.

However, e2fsck should handle this case for existing kernel by
checking the journal superblock's s_errno field even if journal
recovery is not required.

Without this commit, e2fsck would not notice anything wrong with the
file system, but a subsequent mount of the file system by the kernel
would mark the file system's superblock as needing checking (since the
journal's s_errno field would still be set), resulting an full e2fsck
run at the next reboot, which would find nothing wrong --- and then
when the file system was mounted, the whole cycle would repeat again.

I had seen reports of this in the past, but it wasn't until recently
that I realized exactly how this had come about, since normally e2fsck
would be run automatically before the file system is mounted again,
thus avoiding this problem.  However, a user using a rescue CD who
didn't run e2fsck before mounting the a file system in this condition
could trigger this situation, and unfortunately, with previous
versions of e2fsprogs and the kernel, there would be no way out no
matter what the user tried to do.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agodumpe2fs: print journal's s_errno field if it is non-zero
Theodore Ts'o [Thu, 31 May 2012 23:18:18 +0000 (19:18 -0400)] 
dumpe2fs: print journal's s_errno field if it is non-zero

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: allow checking on mounted root fs
Andreas Dilger [Thu, 31 May 2012 20:39:54 +0000 (16:39 -0400)] 
e2fsck: allow checking on mounted root fs

Commit 732e26b98e5c79a4298dbe341f43b54b354bb241 added checks to
prevent e2fsck from being run in filesystem-modifying mode against
a mounted or otherwise busy device, due to several bug reports of
users doing this even with the verbose warnings in check_mount().

However, it also prevented e2fsck from checking a mounted root
filesystem, which will prevent the node from booting.  Once again
allow e2fsck to run against the mounted root filesystem if it is
also mounted read-only at the time.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agotests: use make rules to run tests in parallel
Andreas Dilger [Mon, 28 May 2012 22:58:24 +0000 (16:58 -0600)] 
tests: use make rules to run tests in parallel

Change the e2fsck/mke2fs/tune2fs/e2image/debugfs regression tests to
be driven by Makefile rules instead of by a script loop.  This allows
the tests to be run in parallel like a build and reduces testing time
significantly.

One major change to the tests themselves is to printing the test name,
description, and status together after the test has passed or failed,
to avoid mixing lines from the tests.  The other major change is to
use unique temporary filenames for each test, which was mostly handled
already via b4db1e4c7461a50e18c9fd135b9f1ba6f27e4390, but in some
cases temporary files are changed to use $test_name.tmp to avoid any
collision between running tests.

On my old 2-CPU system it reduced the testing time from 160s to 40s.
Much of the savings is from the MMP test delays running in parallel.
It still takes the time of the slowest test, f_mmp_garbage, though
there will be ongoing benefit in the future as more tests are added
since the wallclock time will not increase linearly for each test.

Tests were run with various combinations of "make -j", and "make -j2"
through "make -j44" repeatedly without any test failures.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agolibext2fs: don't inline ext2fs_open_file() and ext2fs_stat()
Andreas Dilger [Mon, 28 May 2012 14:54:08 +0000 (10:54 -0400)] 
libext2fs: don't inline ext2fs_open_file() and ext2fs_stat()

The creation of inline wrappers ext2fs_open_file() and ext2fs_stat()
in commit c859cb1de0d624caa0779fb17d1a53766143136e in ext2fs.h caused
difficulties with the use of headers, since the headers for open64()
and stat64() may already be included (and skip the declaration of the
64-bit variants) before ext2fs.h is ever read.  There is no real way
to solve the missing prototypes and resulting compiler warnings inside
ext2fs.h.

Since ext2fs_open_file() and ext2fs_stat() are not performance
critical operations, they do not need to be inline functions at all,
and the needed function headers can be handled properly in one file.

Similarly, posix_memalloc() was having difficulties with headers, and
was being defined in ext2fs.h, but it is now only being used by a
single file, so move the required header there.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agolibquota: remove quota_is_on() which was the last user of quotactl()
Theodore Ts'o [Mon, 28 May 2012 14:38:06 +0000 (10:38 -0400)] 
libquota: remove quota_is_on() which was the last user of quotactl()

The quotactl() system call was being used without the use of a
function prototype.  On closer examination, it turns out the one user
of that system call was the quota_is_on() function, which is not used
by e2fsprogs at all.  Since libquota is an e2fsprogs-internal library,
and not one that we plan to export any time soon, the simplest thing
to do is to simply remove quota_is_on(), which in turn allows us to
remove all of the infrastructure around using the Linux-specific
quotactl() system call.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: fix checks done for mounted vs. read-only
Andreas Dilger [Thu, 24 May 2012 21:34:56 +0000 (15:34 -0600)] 
e2fsck: fix checks done for mounted vs. read-only

Currently, if e2fsck is run without the "-n" flag (i.e. it
might modify the filesystem), there is no guarantee that it will
open the filesystem with the EXCLUSIVE flag (i.e. O_EXCL) to
prevent the block device from being checked (in most cases this
means mounted, but it could also be an MD/LVM member device).

Conversely, if e2fsck is run with "-n" (i.e. read-only), and
/etc/mtab or /proc/mounts does not report the block device as
mounted then e2fsck thinks the filesystem is unmounted.  In this
case, e2fsck incorrectly sets the EXCLUSIVE flag, which causes
the check to fail, even though e2fsck is running read-only.

To fix this, do not open with EXCLUSIVE if it is a read-only check,
and always open with EXCLUSIVE if the filesystem might be changed.
This also prevents filesystem mounts while e2fsck is running.

Also refuse allow e2fsck to run at all if the filesystem is BUSY.
The e2fsck check_mount() was checking for MOUNTED, but not BUSY,
and it should refuse to run outright if the block device is BUSY.
The previous MOUNTED heuristics pre-date the O_EXCL reservation
by the kernel, so there could be uncertainty due to stale /etc/mtab
data, but with newer kernels a busy device should never be modified.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agolibquota: add missing time.h include
Mike Frysinger [Mon, 28 May 2012 14:21:19 +0000 (10:21 -0400)] 
libquota: add missing time.h include

This code uses time() but doesn't include time.h leading to:
quotaio.c:89:2: warning: implicit declaration of function 'time'

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agolibext2fs: fix rbtree backend for extent lengths greater than 2^32
Eric Sandeen [Mon, 28 May 2012 02:13:39 +0000 (22:13 -0400)] 
libext2fs: fix rbtree backend for extent lengths greater than 2^32

For a completely full filesystem with more than 2^32 blocks, the
rbtree bitmap backend can assemble an extent of used blocks which is
longer than 2^32.  If it does, it will overflow ->count, and corrupt
the rbtree for the bitmaps.

Discovered by completely filling a 32T filesystem using fallocate, and
then observing debugfs, dumpe2fs, and e2fsck all behaving badly.

(Note that filling with only 31 x 1T files did not show the problem,
because freespace was fragmented enough that there was no sufficiently
long range of used blocks.)

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agodebugfs: fix strtoblk for 64bit block numbers
Eric Sandeen [Mon, 28 May 2012 02:11:58 +0000 (22:11 -0400)] 
debugfs: fix strtoblk for 64bit block numbers

Affects icheck, freeb, setb, testb...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 years agoRemove unnecessary escape before tab in man pages
Theodore Ts'o [Mon, 28 May 2012 02:03:39 +0000 (22:03 -0400)] 
Remove unnecessary escape before tab in man pages

Also fixed a number of other minor nits in the resize2fs and e2image
man pages.

Addresses-Debian-Bug: #674453, #674694

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: fix precedence bug in built-in quota support
Theodore Ts'o [Tue, 22 May 2012 01:58:39 +0000 (21:58 -0400)] 
e2fsck: fix precedence bug in built-in quota support

The operator precedence bug means that we might pay atteion to
s_grp_quota_inum even if the RO_COMPAT_QUOTA feature flag is clear.
However, fortunately, this is unlikely to happen in practice.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoe2fsck: fix 64-bit journal support
Theodore Ts'o [Tue, 22 May 2012 01:30:45 +0000 (21:30 -0400)] 
e2fsck: fix 64-bit journal support

64-bit journal support was broken; we weren't using the high bits from
the journal descriptor blocks!  We were also using "unsigned long" for
the journal block numbers, which would be a problem on 32-bit systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agotests: fix f_jnl_64bit so that it actually has a 64-bit journal
Theodore Ts'o [Mon, 21 May 2012 15:03:16 +0000 (11:03 -0400)] 
tests: fix f_jnl_64bit so that it actually has a 64-bit journal

The previous image did not have a 64-bit journal so it wouldn't
properly test the 64-bit journal format.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolibe2p: teach e2p_jrnl_feature2string() about the 64-bit journal feature
Theodore Ts'o [Mon, 21 May 2012 14:59:01 +0000 (10:59 -0400)] 
libe2p: teach e2p_jrnl_feature2string() about the 64-bit journal feature

This will allow dumpe2fs to correctly display the 64-bit journal
feature, if it is enabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoUpdate Release Notes, Changelogs, version.h, etc. for 1.42.3 release v1.42.3
Theodore Ts'o [Mon, 14 May 2012 20:08:47 +0000 (16:08 -0400)] 
Update Release Notes, Changelogs, version.h, etc. for 1.42.3 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agoChange pkg-config files so that both <et/com_err.h> and <com_err.h> work
Theodore Ts'o [Mon, 14 May 2012 16:45:54 +0000 (12:45 -0400)] 
Change pkg-config files so that both <et/com_err.h> and <com_err.h> work

Change the include path in the Cflags field so that #include
<lib/foo.h> and <foo.h> will work.  We had originally used a C flags
which allowed <foo.h> to work, but many applications (especially those
not using pkg-config) had been using the <lob/foo.h> formulation which
didn't require an explicit -I{$includedir} option to the C compiler.

If those applications then converted over to pkg-config, and the
e2fsprogs libraries were installed with a prefix other than /usr, so
that the header files were in some directory such as
/usr/local/include, a program that used #include <lib/foo.h> would
fail to compile.

So change the pkg-config files to include both -I{$includedir} and
-I{$includir}/lib.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agolibext2fs: fix bug in unix_io corrupted > 16TB file systems on 32-bit systems
Theodore Ts'o [Mon, 14 May 2012 14:55:09 +0000 (10:55 -0400)] 
libext2fs: fix bug in unix_io corrupted > 16TB file systems on 32-bit systems

The code was assuming that "unsigned long" was 64-bit, which of course
it isn't on 32-bit systems.  This caused blocks to get written to the
wrong place.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 years agodumpe2fs: fix 64-bit block numbers on 32-bit systems
Theodore Ts'o [Mon, 14 May 2012 05:59:32 +0000 (01:59 -0400)] 
dumpe2fs: fix 64-bit block numbers on 32-bit systems

Fix bug which caused 64-bit block numbers to be incorrectly printed on
systems with 32-bit longs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoTeach build system to install relative symlinks if requested
Theodore Ts'o [Sun, 13 May 2012 03:13:24 +0000 (23:13 -0400)] 
Teach build system to install relative symlinks if requested

Add a configure option, --enable-relative-symlinks, which will use
relative symlinks for the ELF shared library files.

Addresses-Sourceforge-Bug: #3520767

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoInclude LDFLAGS when building BSD libraries
Theodore Ts'o [Sat, 12 May 2012 02:21:08 +0000 (22:21 -0400)] 
Include LDFLAGS when building BSD libraries

Addresses-Sourceforge-Bug: #3517272

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoFix parallel (make -j) build
Matthias Andree [Fri, 11 May 2012 23:14:30 +0000 (19:14 -0400)] 
Fix parallel (make -j) build

Add a few dependencies where needed, so that "make -j17 check" now
works.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoFix bashisms
Matthias Andree [Fri, 11 May 2012 23:14:30 +0000 (19:14 -0400)] 
Fix bashisms

These break the self-test suite on *BSD, and on some Linux distros
where /bin/sh is not implemented by bash.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoReserve the codepoints for the INCOMPAT features LARGEDATA and INLINEDATA
Theodore Ts'o [Fri, 11 May 2012 22:39:27 +0000 (18:39 -0400)] 
Reserve the codepoints for the INCOMPAT features LARGEDATA and INLINEDATA

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoSupport systems without posix_memalign() and memalign()
Theodore Ts'o [Wed, 2 May 2012 18:21:28 +0000 (14:21 -0400)] 
Support systems without posix_memalign() and memalign()

MacOS 10.5 doesn't have posix_memalign() nor memalign(), but it does
have valloc().  The Android SDK would like to be built on MacOS 10.5,
so I've added support for a good-enough emulation of memalign()'s
functionality using valloc(), with an explicit test to make sure
valloc() is returning a pointer which is sufficiently aligned given
the requested alignment.  This won't work if you try to operate on a
file system with a 16k blocksize using an e2fsprogs built on MacOS
10.5 system, but it is good enough for the common case of 4k
blocksize file systems, and we will let the memory allocation fail in
the alignment is not good enough.

I've also added a unit test for ext2fs_get_memalign() so we can be
sure it's working as expected.  I've tested the code paths with
HAVE_POSIX_MEMALIGN defined, HAVE_POSIX_MEMALIGN undefined, and
HAVE_POSIX_MEMALIGN and HAVE_MEMALIGN undefined on an x86 Linux
system, and so I know the valloc() code path works OK.  The simplistic
(and less safe) patch at:

https://trac.macports.org/attachment/ticket/33692/patch-lib-ext2fs-inline.c.diff

Shows that using valloc() apparently works OK for MacOS 10.5 (but if
it doesn't the unit test will catch a problem).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: factor out I/O buffer allocation
Theodore Ts'o [Mon, 7 May 2012 18:41:49 +0000 (14:41 -0400)] 
libext2fs: factor out I/O buffer allocation

Create a new function, io_channel_alloc_buf() which allocates I/O
buffers with appropriate alignment if we are using direct I/O.  The
original code was sometimes using a larger alignment factor than
necessary, and would always request an aligned memory buffer even when
it was not necessary since the block device was not opened with
O_DIRECT.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: make read_bitmaps() more efficient when using direct I/O
Theodore Ts'o [Mon, 7 May 2012 18:30:31 +0000 (14:30 -0400)] 
libext2fs: make read_bitmaps() more efficient when using direct I/O

Read in a full block for each allocation bitmap, to avoid using a
kernel bounce buffer when using direct I/O.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: refactor Direct I/O alignment requirement calculations
Theodore Ts'o [Mon, 7 May 2012 17:25:44 +0000 (13:25 -0400)] 
libext2fs: refactor Direct I/O alignment requirement calculations

Create a new function, ext2fs_get_dio_alignment(), which returns the
alignment requirements for direct I/O.  This way we can factor out the
code from MMP and the Unix I/O manager.  The two modules weren't
consistently calculating the alignment factors, and in particular MMP
would sometimes use a larger alignment factor than was strictly
necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: move the alignment field from unix_io to the io_manager
Theodore Ts'o [Mon, 7 May 2012 16:56:07 +0000 (12:56 -0400)] 
libext2fs: move the alignment field from unix_io to the io_manager

The align field which indicated the required data alignment of data
buffers was stored in a field specific to the unix_io manager.  Move
it to the top-level io_channel structure so it can be better
generalized.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotests: add new tests f_jnl_32bit and f_jnl_64bit
Theodore Ts'o [Wed, 2 May 2012 20:28:48 +0000 (16:28 -0400)] 
tests: add new tests f_jnl_32bit and f_jnl_64bit

Add regression tests which make sure e2fsprogs understands the current
32-bit and 64-bit journal format.  If a patch breaks the on-disk
format, these tests should warn us about that.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: quiet harmless inode/blocks errors
Andreas Dilger [Tue, 24 Apr 2012 20:22:48 +0000 (16:22 -0400)] 
e2fsck: quiet harmless inode/blocks errors

Don't consider only an error in the superblock summary as incorrect.
The kernel does not update this field except at unmount time, so
don't print errors during a "-n" run if there is nothing else wrong.
Any other unfixed errors will themselves mark the filesystem invalid.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck,libquota: Update quota only if its inconsistent
Aditya Kali [Tue, 24 Apr 2012 18:46:08 +0000 (14:46 -0400)] 
e2fsck,libquota: Update quota only if its inconsistent

Currently fsck recomputes quotas and overwrites quota files
whenever its run. This causes unnecessary modification of
filesystem even when quotas were never inconsistent. We also
lose the limits information because of this. With this patch,
e2fsck compares the computed quotas to the on-disk quotas
(while updating the in-memory limits) and writes out the
quota inode only if it is inconsistent.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: Fix check for hidden quota files
Aditya Kali [Tue, 24 Apr 2012 18:36:42 +0000 (14:36 -0400)] 
e2fsck: Fix check for hidden quota files

Currently e2fsck always incorrectly detects that quota inodes
need to be hidden (even if they are already hidden) and
modifies the superblock unnecessarily. This patch fixes the
check for hidden quota files and avoids modifying the
filesystem if quota inodes are already hidden.
Also, zero-out the old quota inode so that next fsck scan
doesn't complain.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agodebugfs: cleanup in do_show_debugfs_params
Zheng Liu [Tue, 24 Apr 2012 18:32:30 +0000 (14:32 -0400)] 
debugfs: cleanup in do_show_debugfs_params

Remove 'out' variable and replace fprintf with printf.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotune2fs: fix man page indentation
Aditya Kali [Tue, 24 Apr 2012 18:26:13 +0000 (14:26 -0400)] 
tune2fs: fix man page indentation

The indentation in tune2fs man page was wrong towards the
end. Also, there was extra '[' in the SYNOPSIS section.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -0400)] 
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -0400)] 
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -0400)] 
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -0400)] 
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -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 [Sun, 22 Apr 2012 19:38:42 +0000 (15:38 -0400)] 
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Sun, 22 Apr 2012 19:38:42 +0000 (15:38 -0400)] 
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotests: add new test f_eofblocks
Theodore Ts'o [Wed, 11 Apr 2012 03:50:37 +0000 (23:50 -0400)] 
tests: add new test f_eofblocks

Since we have changed the eofblocks handling in e2fsck (by removing
the need for the EOFBLOCKS_FL flag), we should have a test to check
out how we handle uninitialized and initialized blocks which are exist
beyond i_size, with files that have (and don't have) the EOFBLOCKS_FL.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'master' of https://github.com/danielnorberg/e2fsprogs into maint
Theodore Ts'o [Tue, 10 Apr 2012 17:10:44 +0000 (13:10 -0400)] 
Merge branch 'master' of https://github.com/danielnorberg/e2fsprogs into maint

(The single commit was missing a Signed-Off-By, but it was a trivial
change to a non-source file, so I've accepted it.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agocom_err.pc: correct include path
Daniel Norberg [Tue, 10 Apr 2012 13:24:53 +0000 (15:24 +0200)] 
com_err.pc: correct include path

compile_et puts #include <et/com_err.h> in
generated header files so pkg-config --cflags
com_err should provide the path to the directory
containing et/.

12 years agodebian: update debian-policy conformance to 3.9.3
Theodore Ts'o [Mon, 9 Apr 2012 19:26:53 +0000 (15:26 -0400)] 
debian: update debian-policy conformance to 3.9.3

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate for Debian 1.42.2-2 release
Theodore Ts'o [Mon, 9 Apr 2012 18:59:20 +0000 (14:59 -0400)] 
Update for Debian 1.42.2-2 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck.conf.5: add buggy_init_scripts to the man page
Theodore Ts'o [Mon, 9 Apr 2012 18:46:43 +0000 (14:46 -0400)] 
e2fsck.conf.5: add buggy_init_scripts to the man page

We have renamed buggy_init_scripts to accept_time_fudge.  Explain this
so that people who find buggy_init_scripts in older e2fsck.conf files
understand what is going on.

Addresses-Debian-Bug: #646963

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: improve testing coverage of tst_bitmaps
Theodore Ts'o [Fri, 6 Apr 2012 18:51:09 +0000 (11:51 -0700)] 
libext2fs: improve testing coverage of tst_bitmaps

Improve the test coverage of tst_bitmaps by:

   (a) adding the ability to test the legacy (32-bit) bitmap code
   (b) adding tests for ext2fs_find_first_zero_inode_bitmap2() and
       ext2fs_find_first_zero_block_bitmap2()

The recent regressions caused by the addition (and use) of
ext2fs_find_first_zero_inode_bitmap2() would have been caught if we
had added these tests first.  (Another object lesson in why unit tests
are critically important!)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: use correct types in ext2fs_find_first_zero_block_bitmap2()
Theodore Ts'o [Fri, 6 Apr 2012 18:49:22 +0000 (11:49 -0700)] 
libext2fs: use correct types in ext2fs_find_first_zero_block_bitmap2()

Fortunately nothing was using this inline function, so we'll just fix
the types in its function signature, which were nonsensical (this was
caused by a cut-and-paste error).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: add 32-bit compat code for ext2fs_find_first_zero_generic_bmap()
Theodore Ts'o [Fri, 6 Apr 2012 18:44:54 +0000 (11:44 -0700)] 
libext2fs: add 32-bit compat code for ext2fs_find_first_zero_generic_bmap()

The lack of 32-bit support was causing febootstrap to crash since it
wasn't passing EXT2_FLAG_64BITS when opening the file system, so we
were still using the legacy bitmaps.

Also add support for bigalloc bitmap into the ffz functions.

Addresses-Red-Hat-Bugzilla: #808421

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate config.guess and config.sub to the latest (2012-02-10) version
Theodore Ts'o [Thu, 5 Apr 2012 22:45:02 +0000 (15:45 -0700)] 
Update config.guess and config.sub to the latest (2012-02-10) version

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoDon't assume that the presence of mntent.h means that setmntent() exists
Theodore Ts'o [Thu, 5 Apr 2012 22:31:09 +0000 (15:31 -0700)] 
Don't assume that the presence of mntent.h means that setmntent() exists

Change autoconf to test for setmntent() and use that to decide whether
to use getmntent() and setmntent(), since some systems don't have
setmntent() but they do have the mntent.h header file.

Also, remove the includes of mntent.h from e2fsck and mke2fs and other
places where it is not needed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agofsck: don't include sys/signal.h for portability reasons
Theodore Ts'o [Thu, 5 Apr 2012 22:21:49 +0000 (15:21 -0700)] 
fsck: don't include sys/signal.h for portability reasons

It isn't necessary to include sys/signal.h, and it's not available on
all systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: add portability fallback in case getpwuid_r is not present
Theodore Ts'o [Thu, 5 Apr 2012 22:16:50 +0000 (15:16 -0700)] 
e2fsck: add portability fallback in case getpwuid_r is not present

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: don't fail creating the journal if /etc/mtab is missing
Theodore Ts'o [Thu, 5 Apr 2012 19:30:02 +0000 (12:30 -0700)] 
mke2fs: don't fail creating the journal if /etc/mtab is missing

The ext2fs_add_journal_inode() function calls
ext2fs_check_mount_point(), which can fail if /etc/mtab is missing.
This causes mke2fs to fail in the middle of the file system format
process; mke2fs calls ext2fs_check_mount_point() already (and has
appropriate fallbacks that calls fails), so add a flag so that mke2fs
can request ext2fs_add_journal_inode() to skip trying to call
e2fsck_check_mount_point().

Addresses-Sourceforge-Bug: #3509398

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoFix gcc -Wall nitpicks
Theodore Ts'o [Thu, 5 Apr 2012 19:13:05 +0000 (12:13 -0700)] 
Fix gcc -Wall nitpicks

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate Release Notes, Changelogs, version.h, etc. for 1.42.2 release v1.42.2
Theodore Ts'o [Tue, 27 Mar 2012 22:58:00 +0000 (15:58 -0700)] 
Update Release Notes, Changelogs, version.h, etc. for 1.42.2 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Tue, 27 Mar 2012 19:02:27 +0000 (12:02 -0700)] 
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agodebian: add pointer for e2fsprogs-udeb to libcomerr2.shlibs
Theodore Ts'o [Tue, 27 Mar 2012 18:48:18 +0000 (11:48 -0700)] 
debian: add pointer for e2fsprogs-udeb to libcomerr2.shlibs

The udeb for btrfs-tools need libcom_err.so.2, which is packaged as a
part of e2fsprogs-udeb since we don't have a separate libcomerr2 udeb.
So we need to make sure the shlibs file has an explicit pointer to
handle this case.

Addresses-Debian-Bug: #665885

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: add back support older systems w/o dpkg-buildflags
Theodore Ts'o [Tue, 27 Mar 2012 05:23:24 +0000 (22:23 -0700)] 
debian: add back support older systems w/o dpkg-buildflags

Commit 5d0e1f99 removed support for older systems such as Ubuntu
10.04, which don't have dpkg-buildflags.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: don't build BUILD-STATIC if SKIP_STATIC=yes
Theodore Ts'o [Tue, 27 Mar 2012 04:44:11 +0000 (21:44 -0700)] 
debian: don't build BUILD-STATIC if SKIP_STATIC=yes

Trade off build time for space by using e2fsck.static from BUILD-STD
and not building BUILD-STATIC if SKIP_STATIC=yes in the rules.custom
file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: don't build BUILD-BF if SKIP_BF=yes
Theodore Ts'o [Tue, 27 Mar 2012 04:41:47 +0000 (21:41 -0700)] 
debian: don't build BUILD-BF if SKIP_BF=yes

Trade off build time for space by using the binaries from BUILD-STD
and not building BUILD-BF if SKIP_BF=yes in the rules.custom file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: compile without using dietlibc if SKIP_DIETLIBC=yes
Theodore Ts'o [Mon, 26 Mar 2012 23:31:06 +0000 (16:31 -0700)] 
debian: compile without using dietlibc if SKIP_DIETLIBC=yes

Some distributions such as Ubuntu don't have dietlibc.  If
SKIP_DIETLIBC=yes appears in rules.custom, this will change the
control file and cause the build rules to skip using dietlibc when
building the BUILD-BF version of e2fsprogs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: try to include rules.custom if it exists
Theodore Ts'o [Tue, 27 Mar 2012 00:37:10 +0000 (17:37 -0700)] 
debian: try to include rules.custom if it exists

The rules.custom file will never exist upstream, but by trying to
include it if it exists, it will make it easier to people create
custom builds of e2fsprogs by overriding various configuration
parameters in the debian rules file, while minimizing the chance of
future merge conflicts.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs.conf: allow use of a custom mke2fs.conf file
Theodore Ts'o [Tue, 27 Mar 2012 00:57:58 +0000 (17:57 -0700)] 
mke2fs.conf: allow use of a custom mke2fs.conf file

Rename mke2fs.conf to mke2fs.conf.in, so that the makefile can choose
to use either mke2fs.conf.in or mke2fs.conf.custom.in (if it is
present).  If there is custom configuration file, it's likely that it
is very different from the upstream mke2fs.conf.in, so by having the
separate mke2fs.conf.custom.in file, it minimizes merge conflicts if
the upstream mke2fs.conf file changes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix ext2fs_get_memalign when posix_memalign() doesn't exist
Theodore Ts'o [Mon, 26 Mar 2012 22:37:28 +0000 (15:37 -0700)] 
libext2fs: fix ext2fs_get_memalign when posix_memalign() doesn't exist

Reported by: Gianluigi Tiesi <sherpya@netfarm.it>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoFix typo and missing .TP in the tune2fs and mke2fs.conf man pages
David Prévot [Mon, 26 Mar 2012 17:45:51 +0000 (10:45 -0700)] 
Fix typo and missing .TP in the tune2fs and mke2fs.conf man pages

Addresses-Debian-Bug: #665427

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: implement fast find_first_zero() for bitarray bitmaps.
Sami Liedes [Sat, 10 Mar 2012 21:38:40 +0000 (23:38 +0200)] 
libext2fs: implement fast find_first_zero() for bitarray bitmaps.

With this change the CPU time needed to shrink a 100G filesystem drops
to 0.8% of the original (17 CPU seconds instead of 2057).

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agodebugfs: teach seti and freei to free a block of inodes
Theodore Ts'o [Mon, 26 Mar 2012 02:26:30 +0000 (22:26 -0400)] 
debugfs: teach seti and freei to free a block of inodes

In order to the inode allocation functions, it's useful to set and
clear a range of inodes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: update dirty flags if the uninit flags are cleared
Theodore Ts'o [Mon, 26 Mar 2012 02:24:10 +0000 (22:24 -0400)] 
libext2fs: update dirty flags if the uninit flags are cleared

Update the block group descriptor checksum and mark the superblock and
allocation bitmaps as dirty in check_inode_uninit() and
check_block_uninit().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Implement ext2fs_find_first_zero_generic_bmap().
Sami Liedes [Sat, 10 Mar 2012 20:36:12 +0000 (22:36 +0200)] 
libext2fs: Implement ext2fs_find_first_zero_generic_bmap().

This function searches a bitmap for the first zero bit within a range.
It checks if there is a bitmap backend specific implementation
available (if the relevant field in bitmap_ops is non-NULL). If not,
it uses a generic and slow method by repeatedly calling test_bmap() in
a loop. Also change ext2fs_new_inode() to use this new function.

This change in itself does not result in a large speedup, rather it
refactors the code in preparation for the introduction of a faster
find_first_zero() for bitarray based bitmaps.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: document EXT2_FLAG_64BITS in ext2fs_open2()
Sami Liedes [Thu, 22 Mar 2012 23:48:10 +0000 (19:48 -0400)] 
libext2fs: document EXT2_FLAG_64BITS in ext2fs_open2()

From 5c7302de65d689ad84427649aab4d361b21270df Mon Sep 17 00:00:00 2001
From: Sami Liedes <sami.liedes@iki.fi>
Date: Sat, 10 Mar 2012 22:25:55 +0200
Subject: [PATCH] libext2fs: Document EXT2_FLAG_64BITS in ext2fs_open2().

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoresize2fs: use EXT2_FLAG_64BITS
Sami Liedes [Thu, 22 Mar 2012 23:46:56 +0000 (19:46 -0400)] 
resize2fs: use EXT2_FLAG_64BITS

By passing EXT2_FLAG_64BITS to ext2fs_open2() we can avoid some
unnecessary redirection in critical paths. While resize2fs does not
currently otherwise support so big filesystems that this would matter,
passing this flag is entirely harmless and only tells libext2fs that
the caller has been recompiled against current headers.

With this change the CPU time needed to shrink a 100G filesystem drops
by 20%.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: move a modulo operation out of a hot loop.
Sami Liedes [Thu, 22 Mar 2012 23:42:38 +0000 (19:42 -0400)] 
libext2fs: move a modulo operation out of a hot loop.

Filesystem shrinking in particular is a heavy user of this loop in
ext2fs_new_inode(). This change makes resize2fs use 24% less CPU time
for shrinking a 100G filesystem.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: remove EXT4_EOFBLOCKS_FL flag handling
Lukas Czerner [Thu, 22 Mar 2012 23:42:11 +0000 (18:42 -0500)] 
e2fsck: remove EXT4_EOFBLOCKS_FL flag handling

We've decided to remove EOFBLOCKS_FL from the ext4 file system entirely,
because it is not actually very useful and it is causing more problems
than it solves. We're going to remove it from e2fsprogs first and then
after the new e2fsprogs version is common enough we can remove the
kernel part as well.

This commit changes e2fsck to not check for EOFBLOCKS_FL. Instead we
simply search for initialized extents past the i_size as this should not
happen. Uninitialized extents can be past the i_size as we can do
fallocate with KEEP_SIZE flag.

Also remove the EXT4_EOFBLOCKS_FL from lib/ext2fs/ext2_fs.h since it is
no longer needed.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: add option to use direct I/O (mke2fs -D)
Theodore Ts'o [Thu, 22 Mar 2012 20:00:49 +0000 (16:00 -0400)] 
mke2fs: add option to use direct I/O (mke2fs -D)

This can be useful when using mke2fs on loaded servers, since
otherwise mke2fs can dirty a huge amount of memory very quickly,
leading to other applications not being happy at all.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: report ext2fs_open2() and ext2fs_check_desc() errors
Theodore Ts'o [Thu, 22 Mar 2012 03:40:24 +0000 (23:40 -0400)] 
e2fsck: report ext2fs_open2() and ext2fs_check_desc() errors

Print the actual errors returned by ext2fs_open2() and
ext2fs_check_desc() before we fall back to the backup block group
descriptors so that it's easier to see if there is some obscure
failure that is causing e2fsck to think that it should use the backup
block group descriptors.

Addresses-Google-Bug: #6208183

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>