Whamcloud - gitweb
tools/e2fsprogs.git
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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

13 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>
13 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>
13 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>
13 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

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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

13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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

13 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>
13 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

13 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>
13 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>
13 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>
13 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>
13 years agolibext2fs: require cluster size == block_size when opening a !bigalloc fs
Theodore Ts'o [Sat, 4 Jun 2011 20:36:19 +0000 (16:36 -0400)]
libext2fs: require cluster size == block_size when opening a !bigalloc fs

In ext2fs_open() check to make sure the cluster size superblock field
is the same as the block size field when the bigalloc feature is not
set.  This is necessary since we will start introducing calculations
based on the cluster size field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agolibcom_err: Fix install rule if installing with hard links
Theodore Ts'o [Sat, 4 Jun 2011 15:24:18 +0000 (11:24 -0400)]
libcom_err: Fix install rule if installing with hard links

If $(LINK_INSTALL_FLAGS) is -f instead of -sf, the Makefile's install
rule would not work correctly while installing com_err.h

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agoe2fsck: don't check/clone duplicate xattr blocks in fs without xattr feature
Eric Sandeen [Tue, 31 May 2011 23:59:56 +0000 (19:59 -0400)]
e2fsck: don't check/clone duplicate xattr blocks in fs without xattr feature

I had an extremely corrupted customer filesystem which, after thousands
of lines of e2fsck output, found one more problem on an immediately
subsequent e2fsck.  In short, a file had had its i_file_acl block
cloned due to being a duplicate.  That ultimately got cleared
because the fs did not have the xattr feature, and the inode
was subsequently removed due to invalid mode.

The 2nd e2fsck pass found the cloned xattr block as in use, but
not owned by any file, and had to fix up the block bitmaps.

Simply skipping the processing of duplicate xattr blocks on a
non-xattr filesystem seems reasonable, since they will be cleared
later in any case.

(also fix existing brace misalignment)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 1 Jun 2011 00:08:58 +0000 (20:08 -0400)]
Merge branch 'maint' into next

Conflicts:
misc/tune2fs.c

13 years agotune2fs: Fix overflow of interval check
Kazuya Mio [Mon, 18 Apr 2011 20:11:39 +0000 (20:11 +0000)]
tune2fs: Fix overflow of interval check

Add the check of maximum check interval.
s_checkinterval is 32bit variable, so it cannot be set more than 2^32.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: Unify the upper limit of reserved blocks count
Kazuya Mio [Mon, 18 Apr 2011 20:11:34 +0000 (20:11 +0000)]
e2fsprogs: Unify the upper limit of reserved blocks count

In e2fsprogs, the upper limit of reserved blocks count is a half of
filesystem's blocks count. This patch fixes the incorrect checks of
reserved blocks count.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agomke2fs: don't set stripe/stride to 1 block
Eric Sandeen [Mon, 4 Apr 2011 19:11:52 +0000 (15:11 -0400)]
mke2fs: don't set stripe/stride to 1 block

Block devices may set minimum or optimal IO hints equal to
blocksize; in this case there is really nothing for ext4
to do with this information (i.e. search for a block-aligned
allocation?) so don't set fs geometry with single-block
values.

Zeev also reported that with a block-sized stripe, the
ext4 allocator spends time spinning in ext4_mb_scan_aligned(),
oddly enough.

Reported-by: Zeev Tarantov <zeev.tarantov@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agotests: New i_e2image test to validate image creation/conversion
Lukas Czerner [Wed, 18 May 2011 11:36:55 +0000 (13:36 +0200)]
tests: New i_e2image test to validate image creation/conversion

This commit adds new regression test called i_e2image which should
validate expected behaviour of e2image raw and qcow2 image creation
and qcow2 -> raw image conversion. You can run it with "make check" as
the rest of regression tests.

Testing is performed on three filesystem images with different block
sizes (1024, 2048, 4096). It creates raw and qcow2 images from the
original and then convert qcow2 image back to raw image. The results are
checksummed and compared with pre-prepared results. All md5sums should
stay the same and raw image created from original and qcow2 image should
be the same as well (just for the record).

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2image: Support for conversion QCOW2 image into raw
Lukas Czerner [Wed, 18 May 2011 12:20:47 +0000 (14:20 +0200)]
e2image: Support for conversion QCOW2 image into raw

This commit adds support for converting QCOW2 image created previously
with e2image into raw image. The QCOW2 image is detected automatically,
so there is not new option. Just use following command:

  e2image -r image.qcow image.raw

No that this tool is aimed to quickly convert qcow2 image created with
e2image into raw image. In order to improve speed we are doing some
assumption I believe might not be true for regular qcow2 images. So it
was not tested with regular QCOW2 images and it might not work with
them. The intention of this tool is only convert images previously
created by e2image.

Note that there is nothing special with QCOW2 images created by e2images
and it can be used with tools like qemu-img, or qemu-nbd without any
problems.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2image: Add support for qcow2 format
Lukas Czerner [Wed, 18 May 2011 11:36:53 +0000 (13:36 +0200)]
e2image: Add support for qcow2 format

This commit adds support for exporting filesystem into QCOW2 image
format. Like sparse format this saves space, by writing only necessary
(metadata blocks) into image. Unlike sparse image, QCOW2 image is NOT
sparse, hence does not change its size by copying with not-sparse-aware
tools.

New options '-Q' has been added to tell the e2image to use QCOW2 as an
output image format. QCOW2 supports encryption and compression, however
e2image so far does no support such features, however you can still
scramble filenames with '-s' option.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: Add memory allocation and zero-out helpers
Lukas Czerner [Wed, 18 May 2011 12:19:52 +0000 (14:19 +0200)]
e2fsprogs: Add memory allocation and zero-out helpers

Add functions ext2fs_get_memzero() which will malloc() the memory
using ext2fs_get_mem(), but it will zero the allocated memory afterwards
with memset().

Add function ext2fs_get_arrayzero() which will use calloc() for
allocating and zero-out the array.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agodebugfs: document htree-related commands in man page
Eric Sandeen [Wed, 11 May 2011 16:49:07 +0000 (11:49 -0500)]
debugfs: document htree-related commands in man page

The debugfs commands dirsearch, dx_hash, and htree_dump were
never documented in the man page.  Do so.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agodebugfs: remove unused htree_dump "-l" argument
Eric Sandeen [Wed, 11 May 2011 16:46:19 +0000 (11:46 -0500)]
debugfs: remove unused htree_dump "-l" argument

The long_opt / -l argument was apparently never implemented,
so remove it and associated argument parsing.

This slightly changes the (undocumented) behavior because it
no longer defaults to cwd if no filespec is specified...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agomke2fs: Allow specifying reserved_ratio via mke2fs.conf
Aditya Kali [Tue, 10 May 2011 21:51:31 +0000 (14:51 -0700)]
mke2fs: Allow specifying reserved_ratio via mke2fs.conf

This patch adds support for specifying 'reserved_ratio' (percent blocks
reserved for super user, same as '-m' command line option) in mke2fs.conf.
It adds profile_get_double function in profile.c that allows reading
floating point values from profile files.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agomke2fs: make s_inodes_per_group >= 8 in ext2fs_initialize
Tao Ma [Mon, 9 May 2011 15:38:42 +0000 (23:38 +0800)]
mke2fs: make s_inodes_per_group >= 8 in ext2fs_initialize

current mkfs.ext4 fails if we tried with the following parameters:

mkfs.ext4  -m 0 -N 16 -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg -b 1024 /dev/sdb3

It will cause segfault, but it is caused by another issue.  See my
patch "mke2fs: Avoid segmentation fault in
ext2fs_alloc_generic_bmap". And with that patch, the mkfs.ext4 will
fail with the error: /dev/sdb3: Memory allocation failed while setting
up superblock

The reason is that in ext2fs_initialize, we align s_inodes_per_group
to 8, but fails to consider the case that s_inodes_per_group < 8.
So make at least 8 inodes for s_inodes_per_group.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: fix memory leak in ext2fs_free_generic_bmap()
Lukas Czerner [Mon, 21 Mar 2011 10:14:00 +0000 (11:14 +0100)]
e2fsprogs: fix memory leak in ext2fs_free_generic_bmap()

In ext2fs_free_generic_bmap() when we are freeing 64-bit bitmap, we do
call free_bmap() to free backend specific bitmap structures, however we
should also free ext2fs_generic_bitmap structure as well.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: fix freeing bitmap in allocation error path
Lukas Czerner [Mon, 21 Mar 2011 10:13:41 +0000 (11:13 +0100)]
e2fsprogs: fix freeing bitmap in allocation error path

In ext2fs_alloc_generic_bmap() error path, when new bitmap allocation
fails ext2fs_generic_bitmap should be freed, however in current state it
first frees ext2fs_generic_bitmap and then
ext2fs_generic_bitmap->description which is wrong. This commit fix the
free ordering.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 8 May 2011 03:24:55 +0000 (23:24 -0400)]
Merge branch 'maint' into next

13 years agoe2fsck: make the "fs is mounted; continue?" prompt more paranoid
Theodore Ts'o [Sun, 8 May 2011 03:14:06 +0000 (23:14 -0400)]
e2fsck: make the "fs is mounted; continue?" prompt more paranoid

A user received the "file system is mounted; do you really want to
continue" prompt, and then instead of typing "n" for no, forgot that
he hadn't declined to continuation question, and typed the up-arrow
key, which in his locale, the 'A' in "^[[A" was interpreted as "yes",
and he lost data.

This was clearly the user's fault, but to make e2fsck a bit safer
against user stupidity/carelessness, we will change the "fs is
mounted; continue?" prompt to default to no, and treat the escape
character (along with the return and space characters, currently) as a
request for the default answer.

Addresses-Debian-Bug: #619859
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agologsave: Update usage message so it is correct
Carsten Hey [Sun, 27 Mar 2011 01:14:09 +0000 (03:14 +0200)]
logsave: Update usage message so it is correct

Addresses-Debian-Bug: #619788
Signed-off-by: Carsten Hey <carsten@debian.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agofilefrag: count 0 extents properly when verbose
Eric Sandeen [Thu, 5 May 2011 18:21:08 +0000 (13:21 -0500)]
filefrag: count 0 extents properly when verbose

/boot/a: 0 extents found

works properly, but

Filesystem type is: ef53
Filesystem cylinder groups is approximately 61
File size of a is 0 (0 blocks, blocksize 1024)
 ext logical physical expected length flags
a: 1 extent found

yields 1 extent when it should be 0.

Fix this up by special-casing no extents returned in verbose
mode; skip printing the header for the columns too, since there
are no columns to print.

Also, in nonverbose mode we can set fm_extent_count to 0
so that FIEMAP will just query the extent count without gathering
details; clarify this with a comment.

Addresses-RedHat-Bugzilla: 653234
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 18 Mar 2011 20:44:37 +0000 (16:44 -0400)]
Merge branch 'maint' into next

Conflicts:
lib/e2p/ls.c

13 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Fri, 18 Mar 2011 20:42:54 +0000 (16:42 -0400)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: man page typo fixes
Eric Sandeen [Thu, 10 Mar 2011 16:09:35 +0000 (10:09 -0600)]
e2fsprogs: man page typo fixes

Fix a few typos in manpages.

Reported-by: Branislav Náter <bnater@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoadd new superblock field: s_overhead_blocks
Theodore Ts'o [Fri, 18 Mar 2011 18:47:15 +0000 (14:47 -0400)]
add new superblock field: s_overhead_blocks

It turns out that it's very hard to calculate overheads in the face of
clustered allocation (bigalloc).  This is because multiple metadata
blocks from different block groups can end up in the same allocation
cluster.  Calculating the exact overhead requires O(all block bitmaps)
in memory, or O(number of block groups**2) in time.  So we will
calculate this at mkfs time and stash it in the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agomke2fs: If the device supports discard, don't print an error message
Theodore Ts'o [Mon, 28 Feb 2011 01:09:54 +0000 (20:09 -0500)]
mke2fs: If the device supports discard, don't print an error message

Check to see if the device supports discard before starting the
progress bar, and then printing an error about inappropriate ioctl for
device (when creating a file system image to a file, for example).

Also, add a function signature in the ext2_io.h header file for
io_channel_discard() and fix an extra, uneeded argument in mke2fs's
call to that function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 28 Feb 2011 00:47:44 +0000 (19:47 -0500)]
Merge branch 'maint' into next

Conflicts:
lib/ext2fs/initialize.c

13 years agoAdd basic BIGALLOC support for cluster-based allocation
Theodore Ts'o [Sat, 26 Feb 2011 02:43:54 +0000 (21:43 -0500)]
Add basic BIGALLOC support for cluster-based allocation

This adds the superblock fields needed so that dumpe2fs works and the
code points and renames the superblock fields from describing
fragments to clusters.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agoe2fsprogs: reserving code points for new ext4 quota feature
Aditya Kali [Tue, 15 Feb 2011 22:27:27 +0000 (14:27 -0800)]
e2fsprogs: reserving code points for new ext4 quota feature

This patch adds support for detecting the new 'quota' feature in ext4.
The patch reserves code points for usr and group quota inodes and also
for the feature flag EXT4_FEATURE_RO_COMPAT_QUOTA.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agomke2fs: Display progress report during the device discard
Lukas Czerner [Mon, 24 Jan 2011 19:52:00 +0000 (20:52 +0100)]
mke2fs: Display progress report during the device discard

For some time now we are doing initial discard of the device prior to
filesystem creation. However, there is no feedback for the user and
hence on some devices with slow TRIM implementation it may appear that
mke2fs is stuck.

This commit introduce new function mke2fs_discard_device(), which is a
wrapper for io_channel_discard(). The discard is done in chunks of
2GB, which seems reasonably well for both slow and fast devices, and
discard progress is reported back to the user.

I gave up on doing fancy things like align discard according to
discard_alignment, checking for discard granularity and computing
estimate time. First of all, because it would require either new ioctl
to retrieve those information or use of libudev library, none of it
seems to be worth it. Regarding discard_granularity, I doubt there is
any sane device with discard granularity that big it would affect this.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 21 Feb 2011 02:54:43 +0000 (21:54 -0500)]
Merge branch 'maint' into next

Conflicts:
misc/mke2fs.conf.5.in

13 years agomke2fs: Simple man page nodiscard option correction
Lukas Czerner [Tue, 1 Feb 2011 16:56:41 +0000 (17:56 +0100)]
mke2fs: Simple man page nodiscard option correction

It is not true that 'nodiscard' is set as default, so remove this
sentence. The default is 'discard' and it is properly documented in man
page.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: enable user namespace xattrs by default
Eric Sandeen [Thu, 17 Feb 2011 21:56:17 +0000 (15:56 -0600)]
e2fsprogs: enable user namespace xattrs by default

User namespace xattrs are generally useful, and I think extN
is the only filesystem requiring a special mount option to
enable them, when xattrs are otherwise available.  So this
change sets that mount option into the defaults, via a
mke2fs.conf option.

Note that if xattrs are config'd off, this will lead to a
mostly-harmless:

   EXT4-fs (sdc1): (no)user_xattr options not supported

message at mount time...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: turn off enforced fsck intervals by default
Eric Sandeen [Thu, 17 Feb 2011 21:55:15 +0000 (15:55 -0600)]
e2fsprogs: turn off enforced fsck intervals by default

The forced fsck often comes at unexpected and inopportune moments,
and even enterprise customers are often caught by surprise when
this happens.  Because a filesystem with an error condition will
be marked as requiring fsck anyway, I submit that the time-based
and mount-based checks are not particularly useful, and that
administrators can schedule fscks on their own time, or tune2fs
the enforced intervals if they so choose.  This patch disables the
intervals by default, and I've added a new mkfs.conf option to
turn on the old behavior of random, unexpected, time-consuming
fscks at boot time.  ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agoe2fsprogs: create com_err.h link in includedir
Eric Sandeen [Wed, 16 Feb 2011 18:01:39 +0000 (12:01 -0600)]
e2fsprogs: create com_err.h link in includedir

After debian bug #192277, debian/rules started making a symlink
to com_err.h in /usr/include.  Now I have Fedora bug #550889
for the same issue, and perhaps it's time to make this link
by default, rather than fixing it up in packaging steps?

[ Changed by tytso to remove the explicit -s option; this will default
  to creating a hard link by default, which slightly faster.  If
  people want to use symlinks for all links during the install
  process, they can use configure option --enable-symlink-install.
  The reason for this change is that some file systems, like AFS,
  don't support symlinks, and AFS users complain when they can't build
  or install into AFS.  So I don't want to use symlinks
  unconditionally without a way of switching things back and forth,
  and it's easier if we just make all links made during the install
  process to be hard links or sym links. ]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agobadblocks: Add accounting for different types of errors
Theodore Ts'o [Sun, 20 Feb 2011 20:29:51 +0000 (15:29 -0500)]
badblocks: Add accounting for different types of errors

When using the -v option, report a breakdown of the number of read,
write, and comparison errors that were found by badblocks.

Thanks to Ragnar Kjørstad for providing this patch.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agobadblocks: Fix up recover_block handling in badblocks
Theodore Ts'o [Sun, 20 Feb 2011 20:19:47 +0000 (15:19 -0500)]
badblocks: Fix up recover_block handling in badblocks

If there was a bad block for block #0, badblocks would never switch
back testing blocks more efficiently.  In addition, we were
double-incrementing the blocks to be tested in the read/write test due
to failure to remove code.

Thanks to Ragnar Kjørstad for pointing these problems out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 18 Feb 2011 06:19:05 +0000 (01:19 -0500)]
Merge branch 'maint' into next

13 years agobadblocks: Only report errors when reading/writing one block at a time
Theodore Ts'o [Fri, 18 Feb 2011 03:58:21 +0000 (22:58 -0500)]
badblocks: Only report errors when reading/writing one block at a time

With Direct I/O, the kernel can report 0 bytes read even though the
first block has no errors.  So there are any errors, we need try to
read/write blocks one at a time and to get an accurate report.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agobadblocks: Add the -B option which forces the use of buffered I/O
Theodore Ts'o [Thu, 17 Feb 2011 04:40:46 +0000 (23:40 -0500)]
badblocks: Add the -B option which forces the use of buffered I/O

If for some reason direct I/O does not work correctly, force the use
of buffered I/O.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agobadblocks: Fix bug so that O_DIRECT mode is correctly entered
Theodore Ts'o [Thu, 17 Feb 2011 04:35:49 +0000 (23:35 -0500)]
badblocks: Fix bug so that O_DIRECT mode is correctly entered

The check to see if the block number is properly aligned was not done
correctly.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 11 Feb 2011 00:04:46 +0000 (19:04 -0500)]
Merge branch 'maint' into next

13 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Fri, 11 Feb 2011 00:03:42 +0000 (19:03 -0500)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 years agofilefrag: remove useless assignment
Jim Meyering [Tue, 1 Feb 2011 18:25:35 +0000 (19:25 +0100)]
filefrag: remove useless assignment

The very next one memset's all bytes of fiemap to 0.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>