]> git.ipfire.org Git - thirdparty/e2fsprogs.git/log
thirdparty/e2fsprogs.git
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>
12 years agomke2fs: check that auto-detected blocksize <= sys_page_size
Yury V. Zaytsev [Fri, 16 Sep 2011 03:08:52 +0000 (23:08 -0400)] 
mke2fs: check that auto-detected blocksize <= sys_page_size

Block size can be specified manually via the -b option or deduced
automatically. Unfortunately, the check that it is still smaller than
the system page size is only performed right after the command line
options are parsed.

Therefore, if buggy or inappropriately installed/configured hardware
hints that larger block sizes have to be used, mkfs will silently create
a file system which can not be mounted on the system in question.

By moving the check beyond the last assignment to blocksize it is now
ensured, that mkfs will issue a warning even if inappropriate blocksize
was auto-detected.

The new behavior can be easily tested, by exporting the following
variables before running mkfs:

    export MKE2FS_DEVICE_SECTSIZE=8192
    export MKE2FS_DEVICE_PHYS_SECTSIZE=8192

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs.8: Fix the documentation of maximum journal size
Surbhi Palande [Wed, 31 Aug 2011 13:35:57 +0000 (16:35 +0300)] 
mke2fs.8: Fix the documentation of maximum journal size

Fix the max journal size in mke2fs man page.

Signed-off-by: Surbhi Palande <csurbhi@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: fix the range validation in bitmap_range2 funcs
Amir Goldstein [Fri, 16 Sep 2011 02:23:24 +0000 (22:23 -0400)] 
libext2fs: fix the range validation in bitmap_range2 funcs

The condition ((start+num) & ~0xffffffffULL) in bitmap_range2
and generic_bmap_range funcs in get_bitmap64.c was wrong and
inconsistent with the condition (start+num-1 > bmap->real_end)
in generic_bitmap_range funcs in get_bitmap.c.

I got the following error from tune2fs on a 16TB fs:
Illegal block number passed to ext2fs_unmark_block_bitmap #4294967295
for block bitmap for 16TB.img
tune2fs: Invalid argument while reading bitmaps

Fix to condition to ((start+num-1) & ~0xffffffffULL), because
the bit (start+num) is not going to be changed by the funcs.

Signed-off-by: Amir Goldstein <amir73il@users.sf.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agobadblocks: update man page's description of the -v option
Theodore Ts'o [Thu, 15 Sep 2011 23:33:34 +0000 (19:33 -0400)] 
badblocks: update man page's description of the -v option

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebian: update the e2fslibs and e2fslibs-dev files for the quota library
Theodore Ts'o [Thu, 15 Sep 2011 23:12:30 +0000 (19:12 -0400)] 
debian: update the e2fslibs and e2fslibs-dev files for the quota library

We will include the quota library in e2fslibs for now.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix binary and source compatibility with the dump program
Theodore Ts'o [Thu, 15 Sep 2011 19:44:56 +0000 (15:44 -0400)] 
libext2fs: fix binary and source compatibility with the dump program

The dump program relies on fs->frag_size and the
EXT2_FRAGS_PER_BLOCK() macro.  Kind of silly for it to do so, but it's
part of the kludgy way the dump program (which was originally written
for the BSD FFS was ported over to support ext2/3.)  Given how it
makes assumptions about the ext2/3/4 file system being similar to the
BSD FFS, it's a bit of a miracle it works for ext4 --- or at least
appears to work...

Addresses-Debian-Bug: #636418

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: use "extent" consistently as a feature name in the man page
Theodore Ts'o [Thu, 15 Sep 2011 18:24:37 +0000 (14:24 -0400)] 
mke2fs: use "extent" consistently as a feature name in the man page

Addresses-Debian-Bug: #639411

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibe2p: fix bug so that MNTOPT_ options can be successfully parsed
Theodore Ts'o [Thu, 15 Sep 2011 18:21:45 +0000 (14:21 -0400)] 
libe2p: fix bug so that MNTOPT_ options can be successfully parsed

Thanks to Israel G. Lugo for pointing this out.

Addresses-Debian-Bug: #641667

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2image: fix invalid lseek error detection
Lukas Czerner [Wed, 14 Sep 2011 17:27:44 +0000 (13:27 -0400)] 
e2image: fix invalid lseek error detection

In flush_l2_cache() we are using ext2fs_llseek() however we do not
properly detect the error code returned from the function, because we
are assigning it into ULL variable, hence we will not see negative
values.

Fix this by changing the type of the variable to ext2_loff_t which is
signed and hence will store negative values.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibquota: fix "make install" so it works in with a VPATH build directory
Theodore Ts'o [Wed, 14 Sep 2011 17:13:44 +0000 (13:13 -0400)] 
libquota: fix "make install" so it works in with a VPATH build directory

Also fix up the name of the header file which we are installing so it
is correct.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: add new test: tst_inode_size
Theodore Ts'o [Wed, 14 Sep 2011 17:13:07 +0000 (13:13 -0400)] 
libext2fs: add new test: tst_inode_size

This test makes sure the size of the ext2_inode is what we expect

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoresize2fs: add support for new in-kernel online resize ioctl
Yongqiang Yang [Wed, 14 Sep 2011 15:55:59 +0000 (11:55 -0400)] 
resize2fs: add support for new in-kernel online resize ioctl

This is needed to support online resizing for > 32-bit file systems

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs.static: change library ordering to avoid a link error
Theodore Ts'o [Wed, 14 Sep 2011 03:03:17 +0000 (23:03 -0400)] 
mke2fs.static: change library ordering to avoid a link error

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: Use ext2fs_flush() only once
Lukas Czerner [Wed, 14 Sep 2011 02:24:11 +0000 (22:24 -0400)] 
mke2fs: Use ext2fs_flush() only once

We are doing ext2fs_flush() twice right now at the end of the mke2fs.
First by directly calling ext2fs_flush() which is intended to write
superblock and fs accounting information. And then it is invoked again
when we are calling ext2fs_close(), only this time, because the fs is
not dirty, we are writing out only superblock.

I think it is bad to call it twice because even when writing only super
block it takes some time on bigger file systems and moreover
ext2fs_close() can fail without any reasonable explanation for the user.
Also ext2fs_flush() is printing out progress and it is confusing for the
users.

Fix all this by removing the ext2fs_flush() and leaving it all to
ext2fs_close(). However we need to introduce new variables to store
check interval and max mount count, because fs structure is freed on
ext2fs_close() and we really want to print those information as the last
info for the user.

[ Fixed type mismatch in a printf format statement -tytso]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotests: skip tests that require debugfs if debugfs has not been built
Theodore Ts'o [Sat, 3 Sep 2011 14:04:37 +0000 (10:04 -0400)] 
tests: skip tests that require debugfs if debugfs has not been built

Avoid lots of tests failing if e2fsprogs is compiled with
--disable-debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotests: fix i_e2image so it works with valgrind
Theodore Ts'o [Sat, 3 Sep 2011 13:44:42 +0000 (09:44 -0400)] 
tests: fix i_e2image so it works with valgrind

Since e2image can be optionally compiled out, we tested to see if
e2image was built; but using "test -x $E2IMAGE" fails if e2image is
something like "valgrind --simhints=lax-ioctls ../misc/e2image".
Define and use $E2IMAGE_EXE, much like we have done with e2undo and
resize2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: fix valgrind commit in sigcatcher
Theodore Ts'o [Sat, 3 Sep 2011 13:43:50 +0000 (09:43 -0400)] 
e2fsck: fix valgrind commit in sigcatcher

Thanks to Andreas Dilger for catching this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotune2fs: Add support for turning on quota feature
Aditya Kali [Wed, 20 Jul 2011 18:40:05 +0000 (11:40 -0700)] 
tune2fs: Add support for turning on quota feature

This patch adds support for setting the quota feature in superblock
and allows selectively creating quota inodes (user or group or both)
in the superblock. Currently, modifying the quota feature is only
supported when the filesystem is unmounted.
Also, when setting the quota feature, tune2fs will use aquota.user or
aquota.group file inode number in superblock if these files exist.
Otherwise it will initialize empty quota inodes #3 and #4 and use them.

Here is how it works:
 # Set quota feature and initialize both (user and group) quota inodes
 $ tune2fs -O quota /dev/ram1

 # Enable only one type of quota
 $ tune2fs -Q usrquota /dev/ram1

 # Enable grpquota, disable usrquota
 $ tune2fs -Q ^usrquota,grpquota /dev/ram1

 # Clear quota feature and remove quota inodes
 $ tune2fs -O ^quota /dev/ram1

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: support creation of filesystem with quota feature
Aditya Kali [Wed, 20 Jul 2011 18:40:04 +0000 (11:40 -0700)] 
mke2fs: support creation of filesystem with quota feature

mke2fs also creates quota inodes (userquota: inode# 3 and
groupquota: inode #4) inodes while creating a filesystem when 'quota'
feature is set.
 # To set quota feature and initialize quota inodes during mke2fs:
 $mke2fs -t ext4 -O quota /dev/ram1

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: add support for checking the built-in quota files
Aditya Kali [Wed, 20 Jul 2011 18:40:06 +0000 (11:40 -0700)] 
e2fsck: add support for checking the built-in quota files

This patch adds support for doing quota accounting during full
e2fsck scan if the 'quota' feature was set on the superblock.
If user-visible quota inodes are in use, they will be hidden
and converted to the reserved quota inodes.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsprogs: add quota library to e2fsprogs
Aditya Kali [Wed, 20 Jul 2011 18:40:02 +0000 (11:40 -0700)] 
e2fsprogs: add quota library to e2fsprogs

This patch adds the quota library (ported form Jan Kara's quota-tools) in
e2fsprogs in order to make quotas as a first class supported feature in Ext4.
This patch also provides interface in lib/quota/mkquota.h that will be used by
mke2fs, tune2fs, e2fsck, etc. to initialize and update quota files.
This first version of the quota library does not support reading existing quota
files. This support will be added in the near future.
Thanks to Jan Kara for his work on quota-tools. Most of the files in this patch
are taken as-is from quota tools and were simply modified to work with
libext2fs in e2fsprogs.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: fix binary search for the icount and badblocks stores
Theodore Ts'o [Wed, 31 Aug 2011 18:27:21 +0000 (14:27 -0400)] 
libext2fs: fix binary search for the icount and badblocks stores

Remove the interpolation because there is a bug in icount which can
cause a core dump if calculated range gets turned into a NaN and then
do an out-of-bounds array access.  We could fix this with some more
tests, but the complexity is such that nuking all of the interpolation
code will be faster than fixing the interpolation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: catch termination signals and print information about them
Theodore Ts'o [Thu, 11 Aug 2011 18:56:49 +0000 (14:56 -0400)] 
e2fsck: catch termination signals and print information about them

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: copy cluster_bits in ext2fs_copy_generic_bmap
Eric Sandeen [Wed, 10 Aug 2011 19:07:41 +0000 (14:07 -0500)] 
libext2fs: copy cluster_bits in ext2fs_copy_generic_bmap

The f_lotsbad regression test was failing on some systems
with:

 Restarting e2fsck from the beginning...
 Pass 1: Checking inodes, blocks, and sizes
+Illegal block number passed to ext2fs_test_block_bitmap #0 for in-use block map
 Pass 2: Checking directory structure
 Entry 'termcap' in / (2) has deleted/unused inode 12.  Clear? yes

Running with valgrind (./test_script --valgrind f_lotsbad) we
see:

+==31409== Conditional jump or move depends on uninitialised value(s)
+==31409==    at 0x42927A: ext2fs_test_generic_bmap (gen_bitmap64.c:378)

among others.

Looking at gen_bitmap64.c:
376:        arg >>= bitmap->cluster_bits;
377:
378:        if ((arg < bitmap->start) || (arg > bitmap->end)) {

A little more debugging showed that it was actually
bitmap->cluster_bits which was uninitialized, because it never
gets copied over in ext2fs_copy_generic_bmap()

Patch below resolves the issue.

Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: document stripe_width, not stripe-width
Andreas Dilger [Mon, 18 Jul 2011 03:13:47 +0000 (23:13 -0400)] 
mke2fs: document stripe_width, not stripe-width

For consistency with other multi-word options, document the extended
option stripe_width instead of stripe-width.  This also avoids the
complexity of parsing options that have an embedded '-'.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotests: add missing m_mkfs_overhead/expect
Theodore Ts'o [Tue, 12 Jul 2011 19:22:14 +0000 (15:22 -0400)] 
tests: add missing m_mkfs_overhead/expect

This file was accidentally dropped during the recent tests /tmp
overhual.  Re-adding.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: teach e2fsck how to deal with bigalloc in non-extent-mapped inodes
Theodore Ts'o [Sun, 10 Jul 2011 20:25:55 +0000 (16:25 -0400)] 
e2fsck: teach e2fsck how to deal with bigalloc in non-extent-mapped inodes

Currently the bigalloc implementation in the kernel requires extents,
but this restriction might get relaxed in the future.  Also, old
versions of mke2fs that supported bigalloc during early testing
created the root and lost+found directories without using
extent-mapped inodes.  This makes it possible for e2fsck to better
support these old legacy file systems if it comes across them.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: fix pass1b handling for bigalloc file systems
Theodore Ts'o [Sun, 10 Jul 2011 02:56:22 +0000 (22:56 -0400)] 
e2fsck: fix pass1b handling for bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix block iterator when the callback function modifies an extent
Theodore Ts'o [Sun, 10 Jul 2011 02:25:52 +0000 (22:25 -0400)] 
libext2fs: fix block iterator when the callback function modifies an extent

If the callback interator modifies a block in the middle of an extent
during a call to the block iterator, causing the extent to be split,
ext2_block_iterate3() will end up calling the callback function twice
for some number of blocks.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agodebugfs: add a new debugfs command 'blocks'
Theodore Ts'o [Sat, 9 Jul 2011 16:13:40 +0000 (12:13 -0400)] 
debugfs: add a new debugfs command 'blocks'

The blocks command prints out the blocks used by a particular inode,
in a format which is useful for test suite automation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotests: use /tmp for scratch files
Theodore Ts'o [Sat, 9 Jul 2011 16:08:10 +0000 (12:08 -0400)] 
tests: use /tmp for scratch files

The /tmp directory is often a memory based file system, and using this
can speed up running the regression test suite.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomisc: use EXT2_I_SIZE() consistently to get size
Andreas Dilger [Fri, 8 Jul 2011 23:54:57 +0000 (17:54 -0600)] 
misc: use EXT2_I_SIZE() consistently to get size

Use the EXT2_I_SIZE() macro consistently to access the inode size.
The i_size/i_size_high combination is open coded in several places.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agolibext2fs: don't hang in ext2fs_new_block2() on a full bigalloc file system
Theodore Ts'o [Fri, 8 Jul 2011 02:29:00 +0000 (22:29 -0400)] 
libext2fs: don't hang in ext2fs_new_block2() on a full bigalloc file system

Prevent ext2fs_new_block2() from looping forever when a bigalloc file
system is full.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: teach ext2fs_bmap2() about bigalloc
Theodore Ts'o [Fri, 8 Jul 2011 02:27:42 +0000 (22:27 -0400)] 
libext2fs: teach ext2fs_bmap2() about bigalloc

This allows debugfs's write command to work correctly on bigalloc file
systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: move ext2fs_bmap2()'s the extent handling to a separate function
Theodore Ts'o [Thu, 7 Jul 2011 18:02:29 +0000 (14:02 -0400)] 
libext2fs: move ext2fs_bmap2()'s the extent handling to a separate function

Separate the extent handling to a separate function to make BMAP_ALLOC
processing more efficient.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: teach ext2fs_block_alloc_stats2() about bigalloc
Theodore Ts'o [Thu, 7 Jul 2011 17:54:39 +0000 (13:54 -0400)] 
libext2fs: teach ext2fs_block_alloc_stats2() about bigalloc

Change ext2fs_block_alloc_stats2() so that when a cluster is
allocated, the free blocks counter in the superblock is appropriately
decremented by the cluster size.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: replace missing flexbg initialization in flexbg_offset
Theodore Ts'o [Thu, 7 Jul 2011 17:50:49 +0000 (13:50 -0400)] 
libext2fs: replace missing flexbg initialization in flexbg_offset

Commit 25567a7b0fa9 accidentally removed the initialization for flexbg
and flexbg_size, which affected ext2fs_allocate_group_table() and
ext2fs_allocate_tables().   Replace them.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Fix gcc -Wall warnings
Theodore Ts'o [Thu, 7 Jul 2011 17:50:22 +0000 (13:50 -0400)] 
libext2fs: Fix gcc -Wall warnings

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix 64-bit support in ext2fs_bmap2()
Theodore Ts'o [Wed, 6 Jul 2011 00:35:46 +0000 (20:35 -0400)] 
libext2fs: fix 64-bit support in ext2fs_bmap2()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix 64-bit support in ext2fs_{read,write}_inode_full()
Theodore Ts'o [Wed, 6 Jul 2011 00:02:27 +0000 (20:02 -0400)] 
libext2fs: fix 64-bit support in ext2fs_{read,write}_inode_full()

This fixes a problem where reading or writing inodes located after the
4GB boundary would fail.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck, libext2fs: support for bigalloc file systems with a blocksize of 1024
Theodore Ts'o [Tue, 5 Jul 2011 17:42:07 +0000 (13:42 -0400)] 
e2fsck, libext2fs: support for bigalloc file systems with a blocksize of 1024

Filesystems with a blocksize of 1024 have the superblock starting at
block #1.  However, the first data block in the superblock is 0 to
simplify the cluster calculations.  So we must compensate for this in
a number of places, mostly in the ext2fs library, but also in e2fsck.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 5 Jul 2011 00:51:19 +0000 (20:51 -0400)] 
Merge branch 'maint' into next

Conflicts:
misc/tune2fs.c

12 years agomke2fs: allow setting the stride and stripe width to zero
Theodore Ts'o [Tue, 5 Jul 2011 00:22:19 +0000 (20:22 -0400)] 
mke2fs: allow setting the stride and stripe width to zero

Mke2fs previously would give an error if the user tried setting the
stride and stripe-width parameters to zero; but this is necessary to
override the stride and stripe-width settings which get automatically
set from the block device's geometry information in sysfs.  So allow
setting these parameters to zero.

Addresses-Google-Bug: #4988555

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotune2fs: Fix mount_opts handling
Theodore Ts'o [Tue, 5 Jul 2011 00:14:35 +0000 (20:14 -0400)] 
tune2fs: Fix mount_opts handling

The extended options parsing for mount_opts was horribly buggy.
Invalid mount options that had an argument would get interpreted as an
extended mount options.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agotune2fs: allow setting the stride and stripe width to zero
Theodore Ts'o [Mon, 4 Jul 2011 23:37:11 +0000 (19:37 -0400)] 
tune2fs: allow setting the stride and stripe width to zero

Tune2fs previously would give an error if the user tried setting the
stride and stripe-width parameters to zero; but this is necessary to
disable the stride and stripe-width settings.  So allow setting these
superblock fields to zero.

Addresses-Google-Bug: #4988557

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoUpdate for e2fsprogs 1.42-WIP-0702 release v1.42-WIP-0702
Theodore Ts'o [Sun, 3 Jul 2011 03:26:20 +0000 (23:26 -0400)] 
Update for e2fsprogs 1.42-WIP-0702 release

12 years agodebian: disable compression
Theodore Ts'o [Sun, 3 Jul 2011 04:02:17 +0000 (00:02 -0400)] 
debian: disable compression

Disable the compression flag, and enable symlinks for the install
(this is the same as previous debian packages; debian recommends
against using hard links across different directories)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix makefile dependency problem
Theodore Ts'o [Mon, 20 Jun 2011 01:58:20 +0000 (21:58 -0400)] 
libext2fs: fix makefile dependency problem

lib/ext2fs/Makefile.in had a buggy entry for blkmap64_ba.c in $(SRCS),
which caused this source file to not have a valid Makefile dependency
entry, so blkmap64_ba.o would not get rebuilt when it needed to be.

Also updated the Makefile dependency for the misc directory while
we're at it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs, e2fsck: fix i_blocks handling for bigalloc file systems
Theodore Ts'o [Thu, 16 Jun 2011 14:12:43 +0000 (10:12 -0400)] 
mke2fs, e2fsck: fix i_blocks handling for bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: change bigalloc default cluster size to 16*blocksize
Theodore Ts'o [Thu, 16 Jun 2011 14:11:06 +0000 (10:11 -0400)] 
mke2fs: change bigalloc default cluster size to 16*blocksize

This was the original default, but it accidentally got changed to
4*blocksize in commit 4c2b28ab67.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoFix superblock field s_blocks_count for bigalloc file systems
Theodore Ts'o [Thu, 16 Jun 2011 05:38:43 +0000 (01:38 -0400)] 
Fix superblock field s_blocks_count for bigalloc file systems

Treat the s_blocks_count field in the superblock as a free block count
(instead of the number of free clusters) for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoe2fsck: fix mysterious "FILE SYSTEM WAS MODIFIED" with no changes
Theodore Ts'o [Thu, 16 Jun 2011 05:13:42 +0000 (01:13 -0400)] 
e2fsck: fix mysterious "FILE SYSTEM WAS MODIFIED" with no changes

Commit 2a77a784a3 (firest released in e2fsprogs 1.33) compared
superblock summary free blocks and inode counts with the allocation
bitmap counts before starting the file system check proper, and if
they differed, set the superblock and marked it as dirty.  If no other
file systme changes were required, this would cause a "*** FILE SYSTEM
WAS MODIFIED ***" message without any explanation of what e2fsck had
changed.

We fix this by only setting the superblock summary free block/inodes
counts if we are skipping a full check, and in non-preen mode, e2fsck
will now print an explicit message stating how the superblock had been
updated.

In a full check, any updates to the superblock free blocks/inodes
fields will be noted in pass5.

This change requires changing a few test results (essentially
reversing the changes made in commit 2a77a784a3).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomisc: quiet "unused variable" compiler warnings
Andreas Dilger [Thu, 16 Jun 2011 02:17:38 +0000 (22:17 -0400)] 
misc: quiet "unused variable" compiler warnings

Some of the newly-merged patches added "unused variable" compiler
warnings.  Delete unused variables.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agocheck: build all dependencies before "make check"
Andreas Dilger [Thu, 16 Jun 2011 02:17:38 +0000 (22:17 -0400)] 
check: build all dependencies before "make check"

If "make check" is run on a clean repository, it fails due to missing
dependencies for building the test programs.  Have "make check" build
all dependencies before starting the tests to ensure that it can finish
without error.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: Fix pass5 handling for bigalloc && uninit_bg file systems
Theodore Ts'o [Thu, 16 Jun 2011 02:15:34 +0000 (22:15 -0400)] 
e2fsck: Fix pass5 handling for bigalloc && uninit_bg file systems

The code which simulated handling uninitialized block bitmaps didn't
take bigalloc file systems into account correctly.  Fix it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systems
Theodore Ts'o [Thu, 16 Jun 2011 02:11:59 +0000 (22:11 -0400)] 
libext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systems

Commit b0ecb787ef introduced a bug in check_block_uninit(), which is
used by ext2fs_new_block2().  This bug resulted in the block bitmap
for the block group in question not having space reserved for the file
system metadata blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: add support for cluster size in mke2fs.conf
Theodore Ts'o [Tue, 14 Jun 2011 18:30:22 +0000 (14:30 -0400)] 
mke2fs: add support for cluster size in mke2fs.conf

Add support for specifying the cluster size in mke2fs.conf

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: Add support for [devices] stanza in mke2fs.conf
Theodore Ts'o [Tue, 14 Jun 2011 18:17:56 +0000 (14:17 -0400)] 
mke2fs: Add support for [devices] stanza in mke2fs.conf

Add the [devices] stanza which allows device-specific defaults to be
specified in the mke2fs.conf file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'maint' into next
Theodore Ts'o [Sat, 11 Jun 2011 16:54:50 +0000 (12:54 -0400)] 
Merge branch 'maint' into next

12 years agoe2fsprogs: ignore generated files for "git status"
Andreas Dilger [Sat, 11 Jun 2011 16:51:44 +0000 (12:51 -0400)] 
e2fsprogs: ignore generated files for "git status"

Ignore files generated by "make" or "make check" in "git status".
Ignore backup files from editing files and generated tags files.
Delete a temporary file in tests/d_loaddump/script at test cleanup.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoext2fs: fix error handling in ext2fs_add_dir_block
Andreas Dilger [Sat, 11 Jun 2011 16:51:21 +0000 (12:51 -0400)] 
ext2fs: fix error handling in ext2fs_add_dir_block

In ext2fs_add_dir_block() the dblist allocation size was changed to
grow as the number of items in the dblist increases.  However, the
error handling in case of allocation failure wasn't changed to match.

Fix the error case to revert to the old allocation size on failure.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: add extent-mapped journal regression test
Andreas Dilger [Sat, 11 Jun 2011 16:22:36 +0000 (12:22 -0400)] 
mke2fs: add extent-mapped journal regression test

All of the regression tests in e2fsprogs still use a block-mapped
journal (if any journal at all).  Add a simple regression test that
tests extent-mapped journals for both mke2fs and e2fsck.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: add test for large journal with lazy init
Andreas Dilger [Sat, 11 Jun 2011 16:17:29 +0000 (12:17 -0400)] 
mke2fs: add test for large journal with lazy init

Add test for internal journal over 4GB in size, using the
lazy_journal_init and lazy_itable_init features.  Otherwise
the filesystem metadata would be too large to reliably run on
test systems, and take too long to create/check the filesystem.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomke2fs: skip zeroing journal blocks
Andreas Dilger [Sat, 11 Jun 2011 16:17:29 +0000 (12:17 -0400)] 
mke2fs: skip zeroing journal blocks

Add the ability to skip zeroing journal blocks on disk.  This can
significantly speed up mke2fs with large journals.  At worst the
uninitialized journal is only a very short-term risk (if at all),
because the journal will be overwritten on any new filesystem as
soon as any significant amount of data is written to disk, and
the new journal TID would need to match the offset/TID of an old
commit block still left on disk.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoext2fs: Handle internal journal over 2^32 bytes
Andreas Dilger [Sat, 11 Jun 2011 16:17:29 +0000 (12:17 -0400)] 
ext2fs: Handle internal journal over 2^32 bytes

The write_journal_inode() code is only setting the low 32-bit i_size
for the journal size, even though it is possible to specify a journal
up to 10M blocks in size.  Trying to create a journal larger than 2GB
will succeed, but an immediate e2fsck would fail.  Store i_size_high
for the journal inode when creating it, and load it upon access.

Use s_jnl_blocks[15] to store the journal i_size_high backup.  This
field is currently unused, as EXT2_N_BLOCKS is 15, so it is using
s_jnl_blocks[0..14], and i_size is in s_jnl_blocks[16].

Rename the "size" argument "num_blocks" for the journal creation functions
to clarify this parameter is in units of filesystem blocks and not bytes.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoext2fs: don't use O_DIRECT if not available
Andreas Dilger [Sat, 11 Jun 2011 15:50:01 +0000 (11:50 -0400)] 
ext2fs: don't use O_DIRECT if not available

O_DIRECT is not defined on OSX.  Since direct IO is only a new
optimization and not needed for correct functionality, disable
it if O_DIRECT is unavailable.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomisc: fix compile warnings on OSX
Andreas Dilger [Sat, 11 Jun 2011 15:50:01 +0000 (11:50 -0400)] 
misc: fix compile warnings on OSX

The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not
really have anything to do with __GNUC__ (which is also used on
OS/X and Solaris).  Only print these warnings on Linux systems.

statfs64() is deprecated on OSX and generates a deliberate warning.
Fix some other warnings that show up on OSX builds.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoext2fs: fix ext2fs_warn_bitmap32() return warning
Andreas Dilger [Sat, 11 Jun 2011 15:33:02 +0000 (11:33 -0400)] 
ext2fs: fix ext2fs_warn_bitmap32() return warning

This was reported as "control reaches end of non-void function",
but comparing to other similar functions it should be a void
function.  Since it is only declared in the "private" ext2fsP.h
header, it should be OK to change the function prototype.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agodebugfs: fix icheck finding blocks used for xattrs
Andreas Dilger [Sat, 11 Jun 2011 15:29:54 +0000 (11:29 -0400)] 
debugfs: fix icheck finding blocks used for xattrs

This was an "uninitialized variable" warning, but it turns out to be
a real bug.  Without this change, it is not possible to use "icheck"
to find blocks that are used for the i_file_acl (xattr) block.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agotune2fs: add dir_index feature to tune2fs man page
Andreas Dilger [Sat, 11 Jun 2011 15:29:54 +0000 (11:29 -0400)] 
tune2fs: add dir_index feature to tune2fs man page

Add description of missing dir_index feature to tune2fs(8) man page.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoext2fs: fix undeclared posix_memalign() warning
Andreas Dilger [Sat, 11 Jun 2011 15:04:42 +0000 (11:04 -0400)] 
ext2fs: fix undeclared posix_memalign() warning

Older distros do not define posix_memalign() by default in the
headers.  If ext2fs.h is included early in the headers, it is
possible to "#define _XOPEN_SOURCE 600" so that the stdlib.h
header will define it, but if ext2fs.h is included after stdlib.h
there is no posix_memalign() declaration.

Add a posix_memalign() declaration if stdlib.h didn't do it.  This
is a bit of a hack for GNU headers, but it works on Linux and OS/X
without problems.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agomisc: clean up compiler warnings
Andreas Dilger [Sat, 11 Jun 2011 14:58:25 +0000 (10:58 -0400)] 
misc: clean up compiler warnings

Fix several types of compiler warnings (unused variables/labels),
uninitialized variables, etc that are hit with gcc -Wall.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoe2fsck: add basic bigalloc support to check (but not yet repair) file systems
Theodore Ts'o [Fri, 10 Jun 2011 22:58:16 +0000 (18:58 -0400)] 
e2fsck: add basic bigalloc support to check (but not yet repair) file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agomke2fs: support creating bigalloc file systems
Theodore Ts'o [Fri, 10 Jun 2011 22:57:22 +0000 (18:57 -0400)] 
mke2fs: support creating bigalloc file systems

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: allocate clusters to files in expand_dir.c and mkjournal.c
Theodore Ts'o [Fri, 10 Jun 2011 22:54:53 +0000 (18:54 -0400)] 
libext2fs: allocate clusters to files in expand_dir.c and mkjournal.c

Teach ext2fs_expand_dir() and ext2fs_add_journal_inode() about
allocating blocks when clustered allocation is enabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: teach block allocation functions about bigalloc/clusters
Theodore Ts'o [Fri, 10 Jun 2011 22:51:58 +0000 (18:51 -0400)] 
libext2fs: teach block allocation functions about bigalloc/clusters

Optimize ext2fs_new_block2() and ext2fs_get_free_blocks2() when
bigalloc is enabled.  Also fix the uninitialized block bitmap code so
that it correctly deals clustered allocation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: teach bitmap functions about bigalloc/cluster
Theodore Ts'o [Fri, 10 Jun 2011 21:55:09 +0000 (17:55 -0400)] 
libext2fs: teach bitmap functions about bigalloc/cluster

This patch makes the following changes:

* ext2fs_allocate_block_bitmap() now allocates a bitmap with cluster
  granularity for bigalloc file systems.  For mke2fs and e2fsck, a
  newly added function, ext2fs_allocate_subcluster_bitmap() allocates
  a bitmap with block granularity (even for bigalloc file systems).
  The newly added function ext2fs_get_bitmap_granularity() will return
  the number of bits (log2) of the granularity used by the bitmap.

* The ext2fs_{mark,unmark,test}_block_bitmap2() functions will shift
  their passed-in argument by log2(cluster_ganularity) bits right.
  This means that the arguments for the single-argument bitmap
  functions will be interpreted with block granluarity, since this
  minimizes code changes in the rest of the code base.

* The ext2fs_{get,set}_block_bitmap_range() functions will interpret
  their arguments in cluster granularity.  This is a bit inconsistent,
  but the caller of those functions will need to be taught about the
  subtleties of clusters for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: create extent-based directories if the extents feature is enabled
Theodore Ts'o [Fri, 10 Jun 2011 17:58:18 +0000 (13:58 -0400)] 
libext2fs: create extent-based directories if the extents feature is enabled

This allows mke2fs to create the root and lost+found directories using
extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 7 Jun 2011 17:38:38 +0000 (13:38 -0400)] 
Merge branch 'maint' into next

Conflicts:
misc/mke2fs.c

12 years agomke2fs: Don't erase flash device if "-n" is given
Andreas Dilger [Tue, 7 Jun 2011 16:22:29 +0000 (10:22 -0600)] 
mke2fs: Don't erase flash device if "-n" is given

If "mke2fs -n" is used, there should be no changes to the underlying
device.  Unfortunately, when the "discard" option was added in commit
c7cd908be59f48c66b4f3ac9a631ffe3dde4f1ab, it did not check for the "-n"
flag, and will discard all data on a flash device even if "-n" is given.

Check for the "noaction" flag before discarding any filesystem data.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 5 Jun 2011 00:24:36 +0000 (20:24 -0400)] 
Merge branch 'maint' into next

Conflicts:
lib/ext2fs/bitmaps.c
lib/ext2fs/rw_bitmaps.c
misc/dumpe2fs.c

12 years agodumpe2fs: teach dumpe2fs to be cluster aware
Theodore Ts'o [Sun, 5 Jun 2011 00:06:32 +0000 (20:06 -0400)] 
dumpe2fs: teach dumpe2fs to be cluster aware

Add support to dumpe2fs so it can display the block bitmaps correctly
for bigalloc file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: Teach block bitmap read, write, and allocation funcs about clusters
Theodore Ts'o [Sun, 5 Jun 2011 00:05:22 +0000 (20:05 -0400)] 
libext2fs: Teach block bitmap read, write, and allocation funcs about clusters

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: change fs->clustersize to fs->cluster_ratio_bits
Theodore Ts'o [Sat, 4 Jun 2011 14:20:47 +0000 (10:20 -0400)] 
libext2fs: change fs->clustersize to fs->cluster_ratio_bits

The log2 of the ratio of cluster size to block size is far more useful
than just storing the cluster size.  So make this change, and then
define basic utility macros: EXT2FS_CLUSTER_RATIO(),
EXT2FS_CLUSTER_MASK(), EXT2FS_B2C(), EXT2FS_C2B(), and
EXT2FS_NUM_B2C().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agolibext2fs: change EXT2_MAX_BLOCKS_PER_GROUP() to be cluster size aware
Theodore Ts'o [Sat, 4 Jun 2011 20:40:26 +0000 (16:40 -0400)] 
libext2fs: change EXT2_MAX_BLOCKS_PER_GROUP() to be cluster size aware

Change the EXT2_MAX_BLOCKS_PER_GROUP so that it takes the cluster size
into account.  This way we can open bigalloc file systems without
ext2fs_open() thinking that they are corrupt.

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