Commit Graph

3578 Commits (a3efe4842054175d01b465fbe0b29b9be8b800a1)

Author SHA1 Message Date
Theodore Ts'o 92eb5a3392 mke2fs: Set logical/physical sector size from environment for debugging
If MKE2FS_DEVICE_SECTSIZE is set, then this will override the logical
sector size, which is the smallest sector size that can be written
atomically by the device.  (Previously MKE2FS_DEVICE_SECTSIZE set the
physical sector size, which was incorrect given its historical usage.)
The environment variable MKE2FS_DEVICE_PHYS_SECTSIZE will set the
physical sector size, which is the actual sector size used by the
device in reality.

The logical sector size is always less than or equal to the physical
sector size; and writes smaller than the physical sector size but
greather than or equal to the logical sector size will cause a
read-modify-write cycle within the device firmware (or in some
abstract layer lower than the Linux block I/O subsystem, at any rate).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-22 11:09:00 -05:00
Theodore Ts'o 1599b470fb mke2fs: Fill in min_io and opt_io with physical sector size
If the device does not have an explicitly specified minimum io_size or
optimal io_size, and the physical sector size is greater than the
block size, then use the physical sector size as a better-than-nothing
hint.

This should help for SSD's that have a physical sector size of 8k or
16k (which are reportedly will be coming soon).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-22 10:50:42 -05:00
Theodore Ts'o f89f54aff4 mke2fs: Do not require -F for block size < physical size
There will be SSD's out soon that have 8k or 16k phyiscal block sizes.
So don't enforce a requirement that the block size be less than the
physical block size unless the force option is given, and don't give a
warning if the user can't do anything about it (i.e., if the physical
block size is > than the page size).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-22 09:22:05 -05:00
Theodore Ts'o 210fd2c707 mke2fs: Enable lazy_itable_init if the kernel supports this feature
Add check for /sys/fs/ext4/features/lazy_itable_init.  If this file
exists, it should be OK to skip initializing the inode table since the
kernel will do it at mount time.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-10-01 10:47:38 -04:00
Theodore Ts'o 9946478a23 tune2fs.8: Document that the device can be specified via LABEL= or UUID=
Addresses-Debian-Bug: #580236

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-25 21:41:21 -04:00
Theodore Ts'o 8718359b40 e2fsck: Open the external journal in exclusive mode
This prevents accidentally replaying and resetting the journal while
it is mounted, due to an accidental attempt to run e2fsck on an LVM
snapshot of a file system with an external journal.

Addresses-Debian-Bug: #587531

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-25 21:14:06 -04:00
Theodore Ts'o 63feaa13ab resize2fs.8: Make it clear that power-of-2 units are meant by kilobytes
It's sad that this needs to be made clear....

Addresses-Debian-Bug: #594004

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-25 20:24:18 -04:00
Theodore Ts'o b70506bffb e2fsck: Set i_blocks_hi when correcting the i_blocks field in pass #1
For file systems with 64-bit block numbers, we need to make sure we
correct the i_blocks_hi field as well as the i_blocks field when
setting it to the correct value.

Thanks to Justin Maggard for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 22:57:06 -04:00
Theodore Ts'o 9d92a201de Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
	lib/ext2fs/ext2fs.h
	misc/mke2fs.c
2010-09-24 22:40:21 -04:00
Theodore Ts'o 73fbe2323a libext2fs: Change EXT2_FLAG_DIRECT_IO to avoid conflict with devel branch
The development branch of e2fsprogs already has a code point assigned
in conflict with EXT2_FLAG_DIRECT_IO.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 22:22:09 -04:00
Theodore Ts'o a946844235 debugfs: Make the extents listing in the stat command more concise
Use "[u]" instead of "[uninit]" and limit the amount of detail printed
for the extent tree blocks, so it is more similar to the format used
for direct/indirect mapped inodes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 22:05:58 -04:00
Theodore Ts'o 0fd68e0241 debugfs: Add the -D option to request Direct I/O
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 10:12:54 -04:00
Theodore Ts'o 00f0b14118 ext2fs: Optimize for Direct I/O
Allocate various memory structures to be properly aligned to avoid
needing to use a bounce buffer when doing direct I/O read/writes.
This should also help on FreeBSD systems which require aligned buffers
unconditionally.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 10:06:45 -04:00
Theodore Ts'o 7f1a1fbf85 ext2fs: Add Direct I/O support to the ext2fs library
This adds the basic support for Direct I/O to unix_io.c, and adds a
new flag EXT_FLAG_DIRECT_IO which can be passed to ext2fs_open() or
ext2fs_open2() to request Direct I/O support.

Note that device mapper devices in Linux don't support Direct I/O, and
in some circumstances using Direct I/O can actually make performance
*worse*!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 10:02:25 -04:00
Theodore Ts'o faafdb765b libext2fs: Fix memory leak in the Unix I/O layer when changing block size
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-23 16:38:26 -04:00
Theodore Ts'o 023a1df091 ext2fs: add ext2fs_get_memalign() function
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-23 16:38:22 -04:00
Eric Sandeen 792cce3092 mke2fs: make "invalid blocks count" error more clear
Mistakes on the commandline can lead to odd error messages:

# mke2fs -t ext4 -E stride=128 stripe-width=512 /dev/sda1
mke2fs: invalid blocks count - /dev/sda1

Making it a bit more explicit is more obvious:

mke2fs: invalid blocks count '/dev/sda1' on device 'stripe-width=512'

(hint, the mistake was no comma separation for -E)

Reported-by: Adam Huffman <bloch@verdurin.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-09-20 09:25:23 -04:00
Eric Sandeen 6fcd6f84c2 mke2fs: use lazy inode init on some discard-able devices
If a device supports discard -and- returns 0s for discarded blocks,
then we can skip the inode table initialization -and- the inode table
zeroing at mkfs time, and skip the lazy init as well since they are
already zeroed out.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-09-20 09:20:25 -04:00
Jan Kara 32f66cc791 e2fsck: Improve error message when device name misspelled
When a device name is misspelled, we output the full text about specifying
alternate superblock. This is slightly misleading because when the device
cannot be open because of ENOENT, this certainly won't help. So just print
that device does not exist and exit.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-09-19 22:54:58 -04:00
Theodore Ts'o c4b87b8c4f debugfs: Display the extent tree blocks in the stat command output
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-19 22:52:09 -04:00
Theodore Ts'o 9345f02671 tune2fs, debugfs, libext2fs: Add support for ext4 default mount options
Add support for 2.6.35's new default mount options which can be
specified in the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-18 19:38:22 -04:00
Theodore Ts'o 61ef2474c2 badblocks: Deal with UTF-8 characters in progress message
Addresses-Gentoo-Bug: #309909
Addresses-Debian-Bug: #583782
Addresses-Debian-Bug: #587834

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-08-01 22:30:33 -04:00
Tim Small e447ba3731 mke2fs: fix mke2fs "invalid inode ratio" error message
Make error message consistent with the validity test.

Signed-off-by: Tim Small <tim@seoss.co.uk>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-30 20:43:11 -04:00
Eric Sandeen eddf36bac0 mke2fs.8.in: clarify the sign of a block-size constraint.
This bit of the mke2fs manpage is slightly confusing:

-b block-size
    Specify the size of blocks in bytes. <snip>
    If block-size is negative, then mke2fs will use heuristics
    to determine the appropriate block size, with the constraint
    that the block size will be at least block-size bytes.

because it sounds like the block size will be at least a negative
number.  Clarify just what the negative sign means.

Reported-by: Chris Frost <chris@frostnet.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-30 20:40:23 -04:00
Theodore Ts'o ccc7cf0328 libext2fs: fix obvious big-endian bugs introduced by 64-bit changes
These patches fix obvious bone-headed mistakes, so e2fsprogs will now
build and mostly work on powerpc.  The m_meta_bg, u_mke2fs, and
u_tune2fs tests are still failing, however, so there's still work to do...

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-30 18:41:47 -04:00
Theodore Ts'o 27a0e958e6 libext2fs: Add ext2fs_file_size_size2() and truncate the file if necessary
This adds a 64-bit interface for ext2fs_file_size_size() and enhances
it to trunate the file if necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-30 15:40:53 -04:00
Renzo Davoli 6dc058bd12 libext2fs: Add new function ext2fs_file_get_inode()
This patch adds a very simple function:

	struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file);

which is useful for fuse-ext2 when it needs to read the inode of an
open file.

Signed-off-by: renzo davoli <renzo@cs.unibo.it>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-22 09:40:25 -04:00
Theodore Ts'o 8668592362 debugfs: Add new debugfs command punch (aka truncate)
This uses the newly added ext2fs_punch() function.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-22 09:39:04 -04:00
Theodore Ts'o 3adb9374fb libext2fs: Add new function ext2fs_punch()
This function deallocates a range of blocks from a passed-in file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-22 09:37:35 -04:00
Theodore Ts'o f03bb73ceb libext2fs: Don't make a copy of the inode in ext2fs_extent_open2()
Previously, ext2fs_extent_open2() copied the passed-in inode structure
into the extent handle, and the extent functions modified the copy of
the inode structure if necessary due to extent splits, etc.  Change
ext2fs_extent_open2() so that the extent functions use the inode
structure passed into ext2fs_extent_open2().  Otherwise the passed-in
inode structure could become out of date due to changes made by the
extent functions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-22 09:27:45 -04:00
Theodore Ts'o 47e155df57 libext2fs: Fix ext2fs_iblk_{add,sub}_blocks() when the i_blocks_hi is non-zero
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-21 16:10:10 -04:00
Theodore Ts'o 92e2d79cfb tst_extents: Fix 64-bit bugs in do_goto_block()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-20 11:36:34 -04:00
Theodore Ts'o db0bdb49f4 Merge branch 'maint' into next
Conflicts:
	resize/extent.c
2010-07-19 02:37:41 -04:00
Theodore Ts'o 58384b8fa8 debian: Fix outdated description: /sbin/fsck has moved to util-linux
Addresses-Debian-Bug: #588726

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-19 02:27:07 -04:00
Theodore Ts'o b344ed7bc3 resize2fs.8: Update man page to indicate ext4 supports on-line resize
Addresses-Debian-Bug: #589345

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-19 02:23:12 -04:00
Eric Sandeen 8587d393b0 resize2fs: relax requirements for -P output a bit
Requiring an immediate pre-fsck before printing a minimum
resize size seems a bit draconian; if the fs isn't clean or marked
with error, then certainly, but for an informational minimum
size, I don't think we need to require a fsck since last mount.

I had simply copied the checks from the actual resize path,
previously.

Installers use this option (-P) to gather minimum resize info,
and requiring an actual fsck before use just seems to go too far.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-17 06:36:26 -04:00
Theodore Ts'o d85bdf7f19 debian: Remove obsolete initrd script
Addresses-Debian-Bug: #585041

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-06 14:08:09 -04:00
Theodore Ts'o ac92f3cc04 e2fsck, resize2fs: fix a fp precision error that can lead to a seg fault
Commit 641b66b fixed a floating point precision error which can result
in a search algorithm looping forever.  It can also result in an array
index being out of bounds and causing a segfault.  Here are two more
cases in e2fsck and resize2fs that need to be fixed.  I've just used
the same fix from the that commit.

Signed-off-by: Lachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-05 20:40:41 -04:00
Theodore Ts'o 22ff06d5f7 e2fsck: Add missing ext2fs_close() call when going back to original superblock
In the case where the original superblock and the backup superblock
are both invalid in some way, e2fsck will try to go back to the
orignal superblock.  To do that, it must close the attempted open
using the backup superblock first (since otherwise the exclusive open
will prevent the subsequent open from succeding).

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-05 15:06:37 -04:00
Mike Frysinger b887f08f95 e2freefrag: Fix getopt bug on machines with unsigned chars
The getopt() function returns an int, not a char.  On systems where the
default char is unsigned (like ppc), we get weird behavior where -1 is
truncated to 0xff but compared to (int)-1.

Also fix this same bug for two test programs, test_rel and iscan,
which aren't currently used at the moment.

Addresses-Gentoo-Bug: #299386

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-05 14:53:58 -04:00
Theodore Ts'o f96cb89e7a e2freefrag: Display the total number of free extents
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-05 14:51:47 -04:00
Theodore Ts'o c5726f1ad7 Enhance tst_super_size so that it checks the superblock fields as well
The test now checks to make sure the superblock fields are correctly
aligned and prints them out so they can be manually checked to make
sure they are where we expect them to be.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-05 14:50:17 -04:00
Theodore Ts'o 993988f655 Add superblock fields which track first and most recent fs errors
Add superblock fields which track where and when the first and most
recent file system errors occured.  These fields are displayed by
dumpe2fs and cleared by e2fsck.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-05 14:45:55 -04:00
Theodore Ts'o 8c084167ee Fix Makefile dependencies for test programs in lib/ext2fs
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-24 21:11:01 -04:00
Theodore Ts'o f5448c19ac Add support for Next3 snapshot superblock fields to dumpe2fs and debugfs
We also support for byte-swapping the Next3 fields, although the
current Next3 implementation doesn't support big-endian systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-24 21:08:37 -04:00
Eric Sandeen efe0b40146 libext2fs: make fs->group_desc opaque
To prevent direct array indexing of fs->group_desc[i] (because the
group_desc may be a different size for different filesystems) make it
an opaque pointer that may only be accessed through the accessor
functions in blknum.c.  The type itself is still available in a public
header; if we have a group_desc that we know is one type or another,
it's ok to access its fields directly.  This change only prevents us
from indexing off fs->group_desc[i] directly.

Old-style applications who don't want to change their source code can
(as a temporary short-term hack) #define EXT2FS_OLD_32_COMPAT before
including ext2fs.h.

Change the accessors in blknum.c to use ext4fs_group_desc(), a version
of ext2fs_group_desc() which returns a ext4_group_desc pointer.

This simplifies and collapses a fair bit of code in blknum.c

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 21:00:00 -04:00
Valerie Aurora Henson cd5ca12d43 e2image: Fix up to be 64-bit block number safe
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 20:00:00 -04:00
Valerie Aurora Henson d991bc742f e2image: Fix up to be 64-bit block number safe
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Valerie Aurora (Henson) <vaurora@redhat.com>
2010-06-13 19:00:00 -04:00
Valerie Aurora Henson 8728d50657 resize2fs: Fix up to be 64-bit block number safe
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 18:00:00 -04:00
Valerie Aurora Henson 6dc64392c0 e2fsck: Fix up to be 64-bit block number safe
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13 17:00:00 -04:00