summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-06-15misc: quiet "unused variable" compiler warningsAndreas Dilger3-12/+5
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-15check: build all dependencies before "make check"Andreas Dilger1-1/+1
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-15e2fsck: Fix pass5 handling for bigalloc && uninit_bg file systemsTheodore Ts'o1-29/+36
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-15libext2fs: fix regression in ext2fs_new_block2() for uninit_bg file systemsTheodore Ts'o1-0/+2
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-14mke2fs: add support for cluster size in mke2fs.confTheodore Ts'o2-9/+17
Add support for specifying the cluster size in mke2fs.conf Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-14mke2fs: Add support for [devices] stanza in mke2fs.confTheodore Ts'o2-5/+29
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-11Merge branch 'maint' into nextTheodore Ts'o3-2/+48
2011-06-11e2fsprogs: ignore generated files for "git status"Andreas Dilger2-1/+47
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-11ext2fs: fix error handling in ext2fs_add_dir_blockAndreas Dilger1-1/+1
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-11mke2fs: add extent-mapped journal regression testAndreas Dilger2-0/+130
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>
2011-06-11mke2fs: add test for large journal with lazy initAndreas Dilger2-0/+579
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>
2011-06-11mke2fs: skip zeroing journal blocksAndreas Dilger4-8/+44
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>
2011-06-11ext2fs: Handle internal journal over 2^32 bytesAndreas Dilger7-38/+53
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>
2011-06-11ext2fs: don't use O_DIRECT if not availableAndreas Dilger1-0/+2
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>
2011-06-11misc: fix compile warnings on OSXAndreas Dilger6-24/+23
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>
2011-06-11ext2fs: fix ext2fs_warn_bitmap32() return warningAndreas Dilger2-2/+2
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>
2011-06-11debugfs: fix icheck finding blocks used for xattrsAndreas Dilger1-2/+4
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>
2011-06-11tune2fs: add dir_index feature to tune2fs man pageAndreas Dilger1-0/+3
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>
2011-06-11ext2fs: fix undeclared posix_memalign() warningAndreas Dilger1-1/+12
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>
2011-06-11misc: clean up compiler warningsAndreas Dilger21-30/+35
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>
2011-06-10e2fsck: add basic bigalloc support to check (but not yet repair) file systemsTheodore Ts'o7-32/+62
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-10mke2fs: support creating bigalloc file systemsTheodore Ts'o2-24/+105
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-10libext2fs: allocate clusters to files in expand_dir.c and mkjournal.cTheodore Ts'o2-10/+26
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>
2011-06-10libext2fs: teach block allocation functions about bigalloc/clustersTheodore Ts'o1-5/+12
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>
2011-06-10libext2fs: teach bitmap functions about bigalloc/clusterTheodore Ts'o4-2/+111
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>
2011-06-10libext2fs: create extent-based directories if the extents feature is enabledTheodore Ts'o1-2/+15
This allows mke2fs to create the root and lost+found directories using extents. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-07Merge branch 'maint' into nextTheodore Ts'o1-1/+1
Conflicts: misc/mke2fs.c
2011-06-07mke2fs: Don't erase flash device if "-n" is givenAndreas Dilger1-1/+1
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>
2011-06-04Merge branch 'maint' into nextTheodore Ts'o9-30/+63
Conflicts: lib/ext2fs/bitmaps.c lib/ext2fs/rw_bitmaps.c misc/dumpe2fs.c
2011-06-04dumpe2fs: teach dumpe2fs to be cluster awareTheodore Ts'o1-15/+17
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>
2011-06-04libext2fs: Teach block bitmap read, write, and allocation funcs about clustersTheodore Ts'o2-9/+10
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-04libext2fs: change fs->clustersize to fs->cluster_ratio_bitsTheodore Ts'o4-5/+24
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>
2011-06-04libext2fs: change EXT2_MAX_BLOCKS_PER_GROUP() to be cluster size awareTheodore Ts'o1-1/+5
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>
2011-06-04libext2fs: require cluster size == block_size when opening a !bigalloc fsTheodore Ts'o1-0/+6
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>
2011-06-04libcom_err: Fix install rule if installing with hard linksTheodore Ts'o1-1/+2
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>
2011-05-31e2fsck: don't check/clone duplicate xattr blocks in fs without xattr featureEric Sandeen1-2/+4
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>
2011-05-31Merge branch 'maint' into nextTheodore Ts'o2-3/+12
Conflicts: misc/tune2fs.c
2011-05-31tune2fs: Fix overflow of interval checkKazuya Mio1-0/+6
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>
2011-05-31e2fsprogs: Unify the upper limit of reserved blocks countKazuya Mio1-1/+1
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>
2011-05-18mke2fs: don't set stripe/stride to 1 blockEric Sandeen1-2/+5
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>
2011-05-18tests: New i_e2image test to validate image creation/conversionLukas Czerner6-0/+73
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>
2011-05-18e2image: Support for conversion QCOW2 image into rawLukas Czerner2-1/+54
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>
2011-05-18e2image: Add support for qcow2 formatLukas Czerner7-103/+1106
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>
2011-05-18e2fsprogs: Add memory allocation and zero-out helpersLukas Czerner1-1/+27
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>
2011-05-14debugfs: document htree-related commands in man pageEric Sandeen1-0/+21
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>
2011-05-14debugfs: remove unused htree_dump "-l" argumentEric Sandeen1-24/+1
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>
2011-05-14mke2fs: Allow specifying reserved_ratio via mke2fs.confAditya Kali5-1/+80
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>
2011-05-14mke2fs: make s_inodes_per_group >= 8 in ext2fs_initializeTao Ma1-0/+2
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>
2011-05-08e2fsprogs: fix memory leak in ext2fs_free_generic_bmap()Lukas Czerner1-0/+1
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>
2011-05-08e2fsprogs: fix freeing bitmap in allocation error pathLukas Czerner1-1/+1
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>