OSDN Git Service
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Theodore Ts'o [Thu, 22 Mar 2012 03:18:49 +0000 (23:18 -0400)]
e2fsck: avoid unnecessary close/reopen for non-MMP filesystems
For file systems that do not use MMP, there's no reason to close the
file system and then re-open the file system a second time, since
EXT2_FLAG_SKIP_MMP has no meaning for non-MMP file systems anyway.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger@whamcloud.com>
Theodore Ts'o [Thu, 22 Mar 2012 02:49:04 +0000 (22:49 -0400)]
e2fsck: abort if ext2fs_check_desc() returns a memory failure
We were checking for ENOMEM, but in fact if the malloc() fails,
ext2fs_check_desc() will return EXT2_ET_NO_MEMORY.
Addresses-Google-Bug: #
6208183
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Tue, 20 Mar 2012 03:54:03 +0000 (23:54 -0400)]
tests: add field sizes to inode/super struct tests
In addition to validating the ordering of fields within the inode
and superblock structures, also validate the field sizes. Otherwise
it is possible to incorrectly change the size of one of these fields
without getting any kind of error from these tests. Failures would
only show up later in the test image checks if the field that is
changed is before another in-use field.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 19 Mar 2012 03:48:45 +0000 (23:48 -0400)]
tests: have "make testnew" target use local mke2fs
The "make testnew" target in the tests/ subdirectory (used to
help create new test cases) should use the locally-built mke2fs
binary instead of the installed system binary, to avoid cases
where the system binary does not support some new functionality
being tested.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 18 Mar 2012 03:21:00 +0000 (23:21 -0400)]
e2fsck: add logging capability
Add the ability to log messages about a file system to a specified
directory, using a file name templace that can be specified in
/etc/e2fsck.conf. This allows us to suppress the output of overly
verbose e2fsck outputs while still allowing the full logging output to
go to an appropriate file.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 16 Mar 2012 16:13:31 +0000 (12:13 -0400)]
e2fsck: add the max_count_problems setting in e2fsck.conf
Also add appropriate documentation for options/max_count_problems and
problems/0xXXXXXX/max_count settings in /etc/e2fsck.conf
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 16 Mar 2012 15:55:24 +0000 (11:55 -0400)]
e2fsck: print a notice when we've started suppressing a problem code
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 15 Mar 2012 23:29:19 +0000 (19:29 -0400)]
e2fsck: print the current and expected block group checksums
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 15 Mar 2012 22:24:42 +0000 (18:24 -0400)]
e2fsck: add support for field widths in messages using %-expansion
This will come in handy when printing checksums, some of which are
32-bit and some of which are 16-bit.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 15 Mar 2012 20:39:56 +0000 (16:39 -0400)]
Use rbtree bitmaps for dumpe2fs, debugfs, and tune2fs
For large file systems, using the rbtree bitmap can save a lot of
memory.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 15 Mar 2012 16:13:25 +0000 (12:13 -0400)]
dumpe2fs: print the expected block group checksum if it is incorrect
This helps to diagnose problems caused by incorrect block group
checksums.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 14 Mar 2012 21:44:54 +0000 (17:44 -0400)]
e2fsck: add ability to limit the # of problems of a particular type
This throttles the output of a particular problem type, to avoid a
bottleneck caused by (for example) printing a large number of
characters over a rate-limited a serial console.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 11 Mar 2012 20:19:10 +0000 (16:19 -0400)]
e2fsck: check for zero length extent
If an extent has e_len set to zero, the kernel will oops with a
BUG_ON. Unfortunately, e2fsck wasn't catching this case. The kernel
needs to be fixed to notice this case and call ext4_error() instead of
failing an assertion check, but e2fsck should catch this case and
repair it (by deleting the errant extent).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Sun, 11 Mar 2012 19:36:45 +0000 (15:36 -0400)]
e2fsck: do not discard itable if discard doen't zero data
We do not want to discard inode table if the underlying device does not
return zeros when reading non-provisioned blocks. The reason is that if
the inode table is not zeroed yet, then discard would not help us since
we would have to zero it anyway. In the case that inode table was
already zeroed, then the discard would cause subsequent reads to contain
non-deterministic data so we would not be able to assume that the inode
table was zeroed and we would need to zero it again, which does not
really make sense.
This commit adds check to prevent inode table from being discarded if
the discard does not zero data.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Sun, 11 Mar 2012 19:35:06 +0000 (15:35 -0400)]
e2fsck: do not discard when in read only mode
When argument '-n' was specified and should run in read-only mode, we
should not attempt to discard anything. In order to do that we have to
check for E2F_OPT_NO flag and clear E2F_OPT_DISCARD flag if E2F_OPT_NO
is set.
This commit fixes the problem when we would mark inode tables as zeroed
(EXT2_BG_INODE_ZEROED) even when e2fsck is running in read-only mode. We
also move the check for E2F_OPT_NO so we can clear E2F_OPT_DISCARD as
early as possible.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 11 Mar 2012 18:15:19 +0000 (14:15 -0400)]
e2fsck: optimize CPU usage in check_{block,inode}_bitmaps()
The boolean expression (!skip_group || csum_flag) is always true,
since if csum_flag is FALSE, skip_group must also be FALSE. Hence, we
can just remove the expression from the conditional altogether, thus
simplifying the code and making it easier to read/understand.
Also, in the case where the bit is set in the bitmap, there's no point
repeatedly setting first_free to be ext2fs_block_count(fs->super).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Mon, 5 Mar 2012 07:49:34 +0000 (08:49 +0100)]
e2fsck: do not forget to discard last block group
Previously when running e2fsck with '-E discard' argument the end of
the last group has not been discarded. This patch fixes it so we
always discard the end of the last group if needed.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Sun, 11 Mar 2012 17:39:45 +0000 (13:39 -0400)]
e2fsck: remove last argument from e2fsck_discard_blocks()
Simple code cleanup.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Sun, 11 Mar 2012 16:55:45 +0000 (12:55 -0400)]
e2fsck: discard only unused parts of inode table
When calling e2fsck with '-E discard' option it might happen that
valid inodes are discarded accidentally. This is because we just
discard the part of inode table which lies past the free inode count.
This is terribly wrong (sorry!).
This patch fixes it so only the free parts of an inode table
is discarded, leaving used inodes intact. This was tested with highly
fragmented inode tables with block size 4k and 1k.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Phillip Susi <psusi@ubuntu.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mike Frysinger [Wed, 7 Mar 2012 01:21:36 +0000 (20:21 -0500)]
libext2fs: check for fallocate symbol before using it
If we have newer kernel headers which define FALLOC_FL_PUNCH_HOLE, but we
are on an older glibc which lacks fallocate, we end up trying to use the
func anyways. Check the ifdef that autoconf already set up for us.
Reported-by: Ortwin Glueck <odi@odi.ch>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Mike Frysinger [Wed, 7 Mar 2012 01:13:54 +0000 (20:13 -0500)]
configure: sort the lists for AC_CHECK_FUNCS and AC_CHECK_HEADERS
By using m4_flatten, should be easier to maintain these lists.
Regen configure and config.h.in after doing this.
(Modified by tytso to use m4_flatten for the list of header files
checked by AC_CHECK_HEADERS)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Fri, 24 Feb 2012 07:48:57 +0000 (00:48 -0700)]
build: fix compile warnings on OSX
Clean up some compile warnings related to fstat64(), which is
verbosely deprecated on OSX.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Fri, 24 Feb 2012 07:43:52 +0000 (00:43 -0700)]
libquota: don't include system quota.h header
Don't use the system <sys/quota.h> header in mkquota.c, since there
is a local e2fsprogs version of quota.h that is already included and
has the desired quota constants, and avoids symbol conflicts with the
system <sys/quota.h> on other platforms (in particular OSX).
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mike Frysinger [Mon, 27 Feb 2012 06:12:53 +0000 (01:12 -0500)]
libext2fs: include config.h for HAVE_xxx defines
We check HAVE_UNISTD_H but haven't included config.h yet, so we end up
hitting warnings about missing prototypes for close/read/etc... funcs.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mike Frysinger [Mon, 27 Feb 2012 06:12:53 +0000 (01:12 -0500)]
libext2fs: include sys/time.h for gettimeofday()
Building on my glibc-2.15 system hits a warning:
gen_bitmap64.c: In function 'ext2fs_alloc_generic_bmap':
gen_bitmap64.c:127:2: warning: implicit declaration of function
'gettimeofday' [-Wimplicit-function-declaration]
Include sys/time.h if it's available for the prototype.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Phillip Susi [Mon, 27 Feb 2012 05:56:49 +0000 (00:56 -0500)]
e2image: skip uninitialized bitmaps and inode tables
When the block bitmap is uninitialized, skip copying it.
When the inode bitmap is uninitialized, skip copying it,
as well as the inode table. When there are unused inodes
towards the end of the table, skip those blocks too.
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 27 Feb 2012 05:51:39 +0000 (00:51 -0500)]
mke2fs: make sure bg 0's unused inode count field is zero'ed for mke2fs -S
There was a bug/typo in commit
ba9e0afc5 which caused the first block
group (bg #0) to not have its unused inode count field to get set to
zero in the case of mke2fs -S. This caused inodes in the first block
group to not be recoverable via mke2fs -S. Oops.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Feb 2012 01:45:52 +0000 (20:45 -0500)]
libext2fs: support O_DIRECT functionality for Mac OS X
Darwin uses fcntl(fd, F_NOCACHE, 1) instead of the O_DIRECT flag.
Addresses-SourceForge-Bug: #
3140289
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Feb 2012 01:27:58 +0000 (20:27 -0500)]
libext2fs: don't mark the superblock as dirty if the fs was opened r/o
If the file system is read/only opened with a backup superblock, and
the file system has uninit_bg enabled, the super block must not be
marked as dirty; otherwise, ext2fs_close() will call ext2fs_flush(),
which will fail, since the file descriptor for the block device was
opened read/only, and then the file descriptor won't actually be
closed.
This is normally not a problem since most of the time the program will
exit shortly after calling ext2fs_close(), and many programs don't
bother checking the error return from ext2fs_close(), especially if
the file system was opened read/only.
A big exception to this is e2fsck, since it opens and close the file
systems during its startup, and to make matters worse, registers an
error handler which will noisly complain about the failed writes
caused by ext2fs_flush().
Fix this by not marking the superblock as dirty if the file system was
opened read/only. The changes to the block group descriptors to clear
the uninit bits will still happen, so that e2fsck -n will properly
scan the whole file system. However, those changes will get dropped
when the file system handle is closed.
Addresses-SourceForge-Bug: #
3444351
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Feb 2012 00:41:17 +0000 (19:41 -0500)]
Update for Debian 1.42.1-2 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Feb 2012 00:10:19 +0000 (19:10 -0500)]
e2fsck: check new sysfs interface to determine if we are on battery
...since the old way is deprecated.
Addresses-SourceForge-Bug: #
3439277
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 20 Feb 2012 23:24:31 +0000 (18:24 -0500)]
libquota: fix invalid return in non-void function
quota_inode_truncate() returns an errcode_t, not void.
Addresses-SourceForge-Bug: #
3468423
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 20 Feb 2012 23:18:13 +0000 (18:18 -0500)]
debian: fix dpkg-buildflags so it works when the shell is dash
The buildd's use dash as the shell, so we can't use >& in the rules
file. This was causing the buildd-built e2fsprogs binary packages to
be built without the hardening flags.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 20 Feb 2012 23:17:37 +0000 (18:17 -0500)]
debian: build with V=1 for more information in buildd logs
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 18 Feb 2012 03:58:30 +0000 (22:58 -0500)]
Fix missing version.h update
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 20:51:43 +0000 (15:51 -0500)]
Update for e2fsprogs 1.42.1 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 20:22:46 +0000 (15:22 -0500)]
Update e2fsprogs.pot file for translators
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Göran Uddeborg [Fri, 17 Feb 2012 20:16:34 +0000 (15:16 -0500)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jakub Bogusz [Fri, 17 Feb 2012 20:16:34 +0000 (15:16 -0500)]
po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Fri, 17 Feb 2012 20:16:34 +0000 (15:16 -0500)]
po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Fri, 17 Feb 2012 20:16:33 +0000 (15:16 -0500)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Fri, 17 Feb 2012 20:16:33 +0000 (15:16 -0500)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 19:28:39 +0000 (14:28 -0500)]
badblocks: honor the -s option when in read-only -t mode
Addresses-Debian-Bug: #646629
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 18:54:47 +0000 (13:54 -0500)]
libext2fs, libe2p: Reserve RO_COMPAT_REPLICA feature
The replica is a feature which stores multiple copies of the key
metadata blocks so a single block failure in failure-prone media
(read: certain types of flash storage) doesn't take out the entire
file system.
Discussion on the upstream list proved not to be very positive on this
feature; the arguments were that it added complexity that wasn't
warrented, since common practice in industry is to insist on reliable
media, and if media is unreliable, you're kind of toast anyway (unless
the file system is being used as the back-end store of a cluster file
system where checksuming and data replication is happening above the
local disk file system level). So, this feature is being developed
out of tree.
We reserve the code points so that other people won't accidentally
step on them. Since it's not upstream, it's a soft reservation, but
it's not like we have any shortage of RO_COMPAT features. We are a
bit more tight on reserved inodes, but EXT2_BOOT_LOADER_INO and
EXT2_UNDEL_DIR_INO are not currently used anywhere, and
EXT2_EXCLUDE_INO is a reservation for another out-of-tree feature.
There are no features currently being discussed which require a
reserved inode, but if a need were to arise, we can claw back code
point reservations that were never used or not in tree, as those will
always be considered lower priority than in-tree features.
Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 17 Feb 2012 14:56:33 +0000 (09:56 -0500)]
libext2fs: Add ext2fs_file_get_inode_num call (for fuse2fs)
Add a function to return the inode number of an open file.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 14:23:12 +0000 (09:23 -0500)]
e2image: attempt to use ftruncate64 to set i_size for raw images
If ftruncate64() exists, try to use it to set i_size. This isn't
guaranteed to work, per SuSv3, but if it doesn't work, it's guaranteed
to return an error. So for file systems and/or operating systems that
don't support extending i_size via ftruncate64(), fall back to writing
the trailing null.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 14:19:33 +0000 (09:19 -0500)]
e2image: fix logic bug which could cause a raw image not to be extended
If the size of the last "hole" in the raw file was an exact multiple
of a megabyte, then we wouldn't write a null at the end of the file in
order to extend the size of the raw image to correspond with the file
system size. Thanks to Lukas Czerner for suggesting the fix, and
Phillip Susi for pointing out the problem.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 17 Feb 2012 04:16:34 +0000 (23:16 -0500)]
mke2fs: allow file systems w/ uninit_bg to be recovered with mke2fs -S
The command mke2fs -S is used as a last ditch recovery command to
write new superblock and block group descriptors, but _not_ to destroy
the inode table in hopes of recovering from a badly corrupted file
system. If the uninit_bg feature is enabled, we need to make sure to
clear the unused inodes count field in the block group descriptors or
else e2fsck -fy will leave the file system completely empty.
Thanks to Akira Fujita for reporting this problem.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 16 Feb 2012 19:33:14 +0000 (14:33 -0500)]
util: add build.profiled to list of files/directories to ignore
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jan Kara [Wed, 15 Feb 2012 23:41:33 +0000 (18:41 -0500)]
resize2fs: take s_first_data_block into account for resize2fs -M
calculate_minimum_resize_size() forgot to account s_first_data_block
into minimum filesystem size. Thus in case the size of filesystem was
such that the last group had the minimal size (50 blocks + metadata
overhead), the code in adjust_fs_info() decided the group is unneeded,
removed it, and in some cases the resizing then failed with ENOSPC.
Fix the issue by properly accounting for s_first_data_block in
calculate_minimum_resize_size().
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 15 Feb 2012 23:29:37 +0000 (18:29 -0500)]
debian: enable use of dpkg-buildflags if present
On newer Debian-based distributions, dpkg-buildflags should be called
by the debian rules file to get the appropriate values for CFLAGS,
LDFLAGS, etc. This will also allow Debian to build with security
hardened build flags, which is a release goal for Debian Wheezy.
If dpkg-buildflags is not present, then use some safe defaults (what
is currently being set by dpkg-buildpackage in Ubuntu 10.04 LTS, which
is a common enough ancient distribution that many people might still
care about).
Addresses-Debian-Bug: #654457
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 15 Feb 2012 22:25:32 +0000 (17:25 -0500)]
libext2fs: fix BLOCK_ABORT handling in the block iterator for extents
When processing files that contain extents, the block iterator
functions were not properly handling the BLOCK_ABORT bit. This could
cause problems such as ext2fs_link() adding a directory entry multiple
times.
Thanks to Darrick Wong <djwong@us.ibm.com> for reporting this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Wed, 15 Feb 2012 20:11:46 +0000 (15:11 -0500)]
libext2fs: when truncating file, punch out blocks at end
Currently, ext2fs_file_set_size2 punches out data blocks between the
end of the file and infinity when truncate_block <= old_truncate
(i.e. when you've made the file longer). This is not a useful
behavior, particularly since it *fails* to punch out the data blocks
when the file is shortened (i.e. truncate_block < old_truncate). This
seems to be the result of the test being backwards, so fix the code to
punch only when the file is getting shorter.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Wed, 15 Feb 2012 20:11:35 +0000 (15:11 -0500)]
mke2fs: recognize mke4fs program name
We shipped "mke4fs" alongside mke2fs in RHEL5, so that ext4-capable
utilities could be installed without disturbing the venerable e2fsprogs-1.39
shipped in RHEL5 from the beginning. But it surprised some users that
"mke4fs" created ext2 filesystems by default rather than ext4.
While it was my intent to have the renamed binaries behave exactly
like the stock ones, it seems that there is some precedence for
handling "mkeNfs" in the code, so seems reasonable to add
mke4fs -> ext4 as well.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 14 Feb 2012 22:01:48 +0000 (17:01 -0500)]
debugfs: use ss_safe_getenv() instead of getenv()
In the case where debugfs (or rdebugfs) is installed setgid disk, or
some such, we need to disable the use of environment variables for the
obvious reasons.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Wed, 8 Feb 2012 02:11:21 +0000 (21:11 -0500)]
libext2fs: quiet spurious group checksum errors
If we have to read the backup group descriptor checksums, the UNINIT
flags are cleared to ensure that all of the inodes in the filesystem
are scanned. However, the code that reset the UNINIT flags did not
reset the group checksum, and this produced many spurious error
messages in e2fsck.
Group descriptor 0 checksum is invalid. FIXED.
Group descriptor 1 checksum is invalid. FIXED.
:
:
Recompute checksums after modifying group descriptors to avoid these
error messages. Remove expected error messages in f_illitable_flexbg.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 6 Feb 2012 18:47:48 +0000 (13:47 -0500)]
e2fsck: allow the block bitmap to be uninit when the inode bitmap is in use
Removing this check will allow us to eventually eliminate code from
the kernel which forcibly initialized the block bitmap when the inode
bitmap is first used. This would eliminate a required journal credit
and extra disk write.
Addresses-Google-Bug: #
5944440
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Yongqiang Yang [Mon, 23 Jan 2012 16:46:43 +0000 (11:46 -0500)]
mke2fs: correct help text for option -G of mke2fs
The option '-G' is used to pass number of groups in a flex_bg, the
previous help text - 'meta-group-size' - could confuse users with
meta_bg.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 23 Jan 2012 16:33:33 +0000 (11:33 -0500)]
debugfs: fix spelling typo in ncheck
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Jan 2012 22:08:39 +0000 (17:08 -0500)]
debugfs: add ncheck -c option
Add a -c option to ncheck will verifies the file type information in
the directory entry.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Jan 2012 20:38:31 +0000 (15:38 -0500)]
libext2fs: display partial path if fs corrupted in ext2fs_get_pathname()
The function ext2fs_get_pathname() used to return EXT2_ET_NO_DIRECTORY
if one of the directories in an inode's pathname is not a directory.
This is not very useful in an emergency, when the file system is
corrupted. This commit will cause ext2fs_get_pathname() to return a
partial pathname, which should help system administrators trying to
use debugfs to investigate a corrupted file system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 16 Jan 2012 22:49:46 +0000 (17:49 -0500)]
debugfs: optimize ncheck and improve its error checking
Don't call ext2fs_get_pathname() for every single directory; instead,
only call it if we find a matching directory entry. In addition, if
ext2fs_get_pathname() fails, print the number of the parent directory
in angle parents so the user gets some additional information.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Mike Frysinger [Tue, 10 Jan 2012 02:19:48 +0000 (21:19 -0500)]
libext2fs: change getpagesize to sysconf
Newer versions of glibc no longer export the getpagesize() prototype when
using recent versions of POSIX (_XOPEN_SOURCE). So building tdb.c gives
use implicit function declaration warnings. Fix the issue by using the
portable sysconf() function which returns the same answer.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mike Frysinger [Tue, 10 Jan 2012 02:17:57 +0000 (21:17 -0500)]
mke2fs: fix -T/-t usage output
There is a slight desync between the mke2fs(8) man page and the mke2fs
help output when it comes to the -t/-T options. Since the man page is
correct, update the mke2fs usage string to match.
Reported-by: Ben Kohler <bkohler@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Fri, 16 Dec 2011 22:31:07 +0000 (17:31 -0500)]
libext2fs: add bitmap statistics
This feature is especially useful for better understanding how e2fsprogs
tools (mainly e2fsck) treats bitmaps and what bitmap backend can be most
suitable for particular bitmap. Backend itself (if implemented) can
provide statistics of its own as well.
[ Changed to provide basic statistics when enabled with the
E2FSPROGS_BITMAPS_STATS environment variable -- tytso]
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 17 Dec 2011 19:01:15 +0000 (14:01 -0500)]
libext2fs: adjust the description when copying a bitmap
Label the copy of a bitmap as "copy of ..." so that the bitmap's
description is more descriptive.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 16 Dec 2011 19:55:50 +0000 (14:55 -0500)]
e2fsck: use different bitmap types as appropriate
Now that we have multiple backend implementations of the bitmap code,
this commit teaches e2fsck to use either the most appropriate backend
for each use case.
Since we don't know for sure if we will get it all right, the default
choices can be overridden via e2fsck.conf. The various definitions
are shown here, with the current defaults (which may change as we add
more bitmap implementations and as learn what works better).
; EXT2FS_BAMP64_BITARRAY is 1
; EXT2FS_BMAP64_RBTREE is 2
; EXT2FS_BMAP64_AUTODIR is 3
[bitmaps]
inode_used_map = 2 ; pass1
inode_dir_map = 3 ; pass1
inode_reg_map = 2 ; pass1
block_found_map = 2 ; pass1
inode_bad_map = 2 ; pass1
inode_imagic_map = 2 ; pass1
block_dup_map = 2 ; pass1
block_ea_map = 2 ; pass1
inode_link_info = 2 ; pass1
inode_dup_map = 2 ; pass1b
inode_done_map = 3 ; pass3
inode_loop_detect = 3 ; pass3
fs_bitmaps = 2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 16 Dec 2011 16:26:00 +0000 (11:26 -0500)]
libext2fs: use the rbtree bitmap by default when initializing a file system
This change causes the max resident memory of mke2fs, as reported by
/usr/bin/time, to drop from 9296k to 5328k when formatting a 25
gig volume.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 17 Dec 2011 16:56:35 +0000 (11:56 -0500)]
e2fsck: fix pass5 bug when using two different bitmap backends
The pass5 checks would fail if the expected and current {inode,block}
bitmaps used different back ends that returned different non-zero
values from the test_*_bitmap() functions. Fix this by changing
"(actual == bitmap)" to "(!actual == !bitmap)".
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 18 Dec 2011 05:31:27 +0000 (00:31 -0500)]
libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIR
This backend type will automatically switch between the bitarray and
the rbtree backend based on the number of directories in the file
system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Sun, 18 Dec 2011 05:29:33 +0000 (00:29 -0500)]
libext2fs: add a bitmap implementation using rbtree's
For a long time we had a bitarray backend for storing filesystem
metadata bitmaps, however today this approach might hit its limits with
todays huge data storage devices, because of its memory utilization.
Bitarrays stores bitmaps as ..well, as bitmaps. But this is in most
cases highly unefficient because we need to allocate memory even for the
big parts of bitmaps we will never use, resulting in high memory
utilization especially for huge filesystem, when bitmaps might occupy
gigabytes of space.
This commit adds another backend to store bitmaps. It is based on
rbtrees and it stores just used extents of bitmaps. It means that it can
be more memory efficient in most cases.
I have done some limited benchmarking and it shows that rbtree backend
consumes approx 65% less memory that bitarray on 312GB filesystem aged
with Impression (default config). This number may grow significantly
with the filesystem size, but also it may be a lot lower (even negative)
if the inodes are very fragmented (need more benchmarking).
This commit itself does not enable the use of rbtree backend.
[ Simplified the code by avoiding unneeded memory allocation and
deallocation of del_ext. In addition, fixed a bug discovered by the
tst_bitmaps tests: rb_unamrk_bmap() must return true if the bit was
previously set in bitmap, and zero otherwise -- tytso ]
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Fri, 16 Dec 2011 01:56:27 +0000 (20:56 -0500)]
libext2fs: add rbtree library
This commit adds rbtree library into e2fsprogs so it can be used for
various internal data structures. The rbtree implementation is ripped of
kernel rbtree implementation with small changes needed for it to work
outside kernel.
[ I prefixed the exported symbols and interface with ext2fs_ to keep
avoid pulluting the namespace exported by the libext2fs shared
library. -- tytso ]
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 18 Dec 2011 04:53:47 +0000 (23:53 -0500)]
libext2fs: add tests for the bitmap functions
These tests allow us to be sure that the new bitmap backends are
correctly implemented.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>