Commit Graph

3618 Commits (9f6ba888f027ba4daf57ac61a11a6dce98e42347)

Author SHA1 Message Date
Yongqiang Yang 9f6ba888f0 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>
2011-09-14 13:26:57 -04:00
Theodore Ts'o 478113973e mke2fs.static: change library ordering to avoid a link error
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-13 23:03:17 -04:00
Lukas Czerner faa2dcdad0 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>
2011-09-13 22:42:19 -04:00
Theodore Ts'o 906a1cf9b6 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>
2011-09-03 10:04:37 -04:00
Theodore Ts'o f305fd7f0c 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>
2011-09-03 10:02:34 -04:00
Theodore Ts'o dd62d85606 e2fsck: fix valgrind commit in sigcatcher
Thanks to Andreas Dilger for catching this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-03 09:43:50 -04:00
Aditya Kali 771e8db9f0 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>
2011-08-31 18:08:42 -04:00
Aditya Kali 1f5d7a890e 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>
2011-08-31 16:31:49 -04:00
Aditya Kali 624e4a6466 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>
2011-08-31 16:31:13 -04:00
Aditya Kali f239fefc14 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>
2011-08-31 15:21:40 -04:00
Theodore Ts'o a4aff9ca5b 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>
2011-08-31 14:27:21 -04:00
Theodore Ts'o 9b3018a82e e2fsck: catch termination signals and print information about them
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-08-11 14:56:49 -04:00
Eric Sandeen 9c79612f21 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>
2011-08-10 21:49:38 -04:00
Andreas Dilger d4c0d8e5b8 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>
2011-07-17 23:13:47 -04:00
Theodore Ts'o 92122d324d 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>
2011-07-12 15:22:14 -04:00
Theodore Ts'o 95a7f15f46 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>
2011-07-10 16:25:55 -04:00
Theodore Ts'o f51b4d3341 e2fsck: fix pass1b handling for bigalloc file systems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-09 23:00:53 -04:00
Theodore Ts'o d8fae3cf42 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>
2011-07-09 22:25:52 -04:00
Theodore Ts'o af0df2aa4a 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>
2011-07-09 12:13:40 -04:00
Theodore Ts'o b4db1e4c74 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>
2011-07-09 12:08:10 -04:00
Andreas Dilger 0bd0e59320 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>
2011-07-08 20:52:59 -04:00
Theodore Ts'o 81c6377d93 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>
2011-07-07 22:29:00 -04:00
Theodore Ts'o 8e8a190fa2 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>
2011-07-07 22:27:42 -04:00
Theodore Ts'o 551e2e46ee 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>
2011-07-07 14:21:12 -04:00
Theodore Ts'o b98d3e8fad 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>
2011-07-07 14:21:12 -04:00
Theodore Ts'o c4d2d43e2d libext2fs: replace missing flexbg initialization in flexbg_offset
Commit 25567a7b0f 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>
2011-07-07 14:20:42 -04:00
Theodore Ts'o d32c915abf libext2fs: Fix gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-07 13:50:22 -04:00
Theodore Ts'o 062cc472e6 libext2fs: fix 64-bit support in ext2fs_bmap2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-05 20:35:46 -04:00
Theodore Ts'o 41e102a4d1 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>
2011-07-05 20:02:27 -04:00
Theodore Ts'o 25567a7b0f 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>
2011-07-05 13:42:07 -04:00
Theodore Ts'o f37901a22d Merge branch 'maint' into next
Conflicts:
	misc/tune2fs.c
2011-07-04 20:51:19 -04:00
Theodore Ts'o 5b734a0e71 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>
2011-07-04 20:43:39 -04:00
Theodore Ts'o 9a976ac732 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>
2011-07-04 20:14:35 -04:00
Theodore Ts'o 035f32ab17 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>
2011-07-04 19:37:11 -04:00
Theodore Ts'o c0b3deb5f8 Update for e2fsprogs 1.42-WIP-0702 release 2011-07-03 00:04:36 -04:00
Theodore Ts'o 594ec97beb 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>
2011-07-03 00:04:36 -04:00
Theodore Ts'o 1ca87790b9 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>
2011-06-19 21:58:20 -04:00
Theodore Ts'o b2e6c86d61 mke2fs, e2fsck: fix i_blocks handling for bigalloc file systems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-16 10:12:43 -04:00
Theodore Ts'o b12a0bc301 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>
2011-06-16 10:11:06 -04:00
Theodore Ts'o fe75afbf33 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>
2011-06-16 01:38:43 -04:00
Theodore Ts'o a3efe48420 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>
2011-06-16 01:22:02 -04:00
Andreas Dilger 96367ad3bc 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>
2011-06-15 22:17:38 -04:00
Andreas Dilger db7cb4b4a6 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>
2011-06-15 22:17:38 -04:00
Theodore Ts'o 3385a25408 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>
2011-06-15 22:15:34 -04:00
Theodore Ts'o 5f2e1a81d2 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>
2011-06-15 22:11:59 -04:00
Theodore Ts'o 2d34a25f81 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>
2011-06-14 14:32:48 -04:00
Theodore Ts'o 4c2b28ab67 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>
2011-06-14 14:32:41 -04:00
Theodore Ts'o 8f36e6925f Merge branch 'maint' into next 2011-06-11 12:55:26 -04:00
Andreas Dilger 177cb5c7e2 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>
2011-06-11 12:51:44 -04:00
Andreas Dilger 388b66f727 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>
2011-06-11 12:51:21 -04:00