summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-01-23Import of version 1.42+ (replacing debian/)HEADmasterIgor Pashev61-5497/+221
2012-01-17debugfs: add ncheck -c optionTheodore Ts'o5-41/+78
Add a -c option to ncheck will verifies the file type information in the directory entry. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-17libext2fs: display partial path if fs corrupted in ext2fs_get_pathname()Theodore Ts'o5-14/+25
The function ext2fs_get_pathname() used to return EXT2_ET_NO_DIRECTORY if one of the directories in an inode's pathname is not a directory. This is not very useful in an emergency, when the file system is corrupted. This commit will cause ext2fs_get_pathname() to return a partial pathname, which should help system administrators trying to use debugfs to investigate a corrupted file system. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-16debugfs: optimize ncheck and improve its error checkingTheodore Ts'o1-10/+25
Don't call ext2fs_get_pathname() for every single directory; instead, only call it if we find a matching directory entry. In addition, if ext2fs_get_pathname() fails, print the number of the parent directory in angle parents so the user gets some additional information. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-09libext2fs: change getpagesize to sysconfMike Frysinger1-5/+1
Newer versions of glibc no longer export the getpagesize() prototype when using recent versions of POSIX (_XOPEN_SOURCE). So building tdb.c gives use implicit function declaration warnings. Fix the issue by using the portable sysconf() function which returns the same answer. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-01-09mke2fs: fix -T/-t usage outputMike Frysinger1-1/+2
There is a slight desync between the mke2fs(8) man page and the mke2fs help output when it comes to the -t/-T options. Since the man page is correct, update the mke2fs usage string to match. Reported-by: Ben Kohler <bkohler@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-12-18libext2fs: add bitmap statisticsLukas Czerner6-8/+265
This feature is especially useful for better understanding how e2fsprogs tools (mainly e2fsck) treats bitmaps and what bitmap backend can be most suitable for particular bitmap. Backend itself (if implemented) can provide statistics of its own as well. [ Changed to provide basic statistics when enabled with the E2FSPROGS_BITMAPS_STATS environment variable -- tytso] Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: adjust the description when copying a bitmapTheodore Ts'o1-2/+2
Label the copy of a bitmap as "copy of ..." so that the bitmap's description is more descriptive. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18e2fsck: use different bitmap types as appropriateTheodore Ts'o8-31/+137
Now that we have multiple backend implementations of the bitmap code, this commit teaches e2fsck to use either the most appropriate backend for each use case. Since we don't know for sure if we will get it all right, the default choices can be overridden via e2fsck.conf. The various definitions are shown here, with the current defaults (which may change as we add more bitmap implementations and as learn what works better). ; EXT2FS_BAMP64_BITARRAY is 1 ; EXT2FS_BMAP64_RBTREE is 2 ; EXT2FS_BMAP64_AUTODIR is 3 [bitmaps] inode_used_map = 2 ; pass1 inode_dir_map = 3 ; pass1 inode_reg_map = 2 ; pass1 block_found_map = 2 ; pass1 inode_bad_map = 2 ; pass1 inode_imagic_map = 2 ; pass1 block_dup_map = 2 ; pass1 block_ea_map = 2 ; pass1 inode_link_info = 2 ; pass1 inode_dup_map = 2 ; pass1b inode_done_map = 3 ; pass3 inode_loop_detect = 3 ; pass3 fs_bitmaps = 2 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: use the rbtree bitmap by default when initializing a file systemTheodore Ts'o1-0/+1
This change causes the max resident memory of mke2fs, as reported by /usr/bin/time, to drop from 9296k to 5328k when formatting a 25 gig volume. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18e2fsck: fix pass5 bug when using two different bitmap backendsTheodore Ts'o1-2/+2
The pass5 checks would fail if the expected and current {inode,block} bitmaps used different back ends that returned different non-zero values from the test_*_bitmap() functions. Fix this by changing "(actual == bitmap)" to "(!actual == !bitmap)". Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIRTheodore Ts'o3-0/+12
This backend type will automatically switch between the bitarray and the rbtree backend based on the number of directories in the file system. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: add a bitmap implementation using rbtree'sLukas Czerner5-5/+760
For a long time we had a bitarray backend for storing filesystem metadata bitmaps, however today this approach might hit its limits with todays huge data storage devices, because of its memory utilization. Bitarrays stores bitmaps as ..well, as bitmaps. But this is in most cases highly unefficient because we need to allocate memory even for the big parts of bitmaps we will never use, resulting in high memory utilization especially for huge filesystem, when bitmaps might occupy gigabytes of space. This commit adds another backend to store bitmaps. It is based on rbtrees and it stores just used extents of bitmaps. It means that it can be more memory efficient in most cases. I have done some limited benchmarking and it shows that rbtree backend consumes approx 65% less memory that bitarray on 312GB filesystem aged with Impression (default config). This number may grow significantly with the filesystem size, but also it may be a lot lower (even negative) if the inodes are very fragmented (need more benchmarking). This commit itself does not enable the use of rbtree backend. [ Simplified the code by avoiding unneeded memory allocation and deallocation of del_ext. In addition, fixed a bug discovered by the tst_bitmaps tests: rb_unamrk_bmap() must return true if the bit was previously set in bitmap, and zero otherwise -- tytso ] Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: add rbtree libraryLukas Czerner3-2/+640
This commit adds rbtree library into e2fsprogs so it can be used for various internal data structures. The rbtree implementation is ripped of kernel rbtree implementation with small changes needed for it to work outside kernel. [ I prefixed the exported symbols and interface with ext2fs_ to keep avoid pulluting the namespace exported by the libext2fs shared library. -- tytso ] Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: add tests for the bitmap functionsTheodore Ts'o5-1/+770
These tests allow us to be sure that the new bitmap backends are correctly implemented. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18libext2fs: add default_bitmap_type to the ext2_filsys structureTheodore Ts'o4-10/+19
This allows a program to control the bitmap backend implementation that will get used without needing to change the current library API. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-16e2fsck: fix use of uninitialized value in the MMP codeTheodore Ts'o2-2/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-05libext2fs: don't break when ext2fs_clear_generic_bmap() for 32-bit bitmapsTheodore Ts'o1-2/+2
This is only an issue for programs compiled against e2fsprogs 1.41 that manipulate bitmaps directly. Fortunately there are very few programs which do that, especially those that try to clear a bitmap. Addresses-Sourceforge-Bugs: #3451486 Reported-by: robi6@users.sourceforge.net Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-29Update Release Notes, Changelogs, version.h, etc. for 1.42 releaseTheodore Ts'o11-46/+138
Also fixed depfix.sed Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-29po: update sv.po (from translationproject.org)Göran Uddeborg2-249/+119
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-29po: update cs.po (from translationproject.org)Petr Pisar2-26/+26
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-29e2fsck: speed up runs when using tdb for large atypical filesystemsTheodore Ts'o3-6/+21
Optimize how the tdb library so that running with [scratch_files] in /etc/e2fsck.conf is more efficient. Use a better hash function, supplied by Rogier Wolff, and supply an estimate of the size of the hash table to tdb_open instead of using the default (which is way too small in most cases). Also, disable the tdb locking and fsync calls, since it's not necessary for our use in this case (which is essentially as cheap swap space; the tdb files do not contain persistent data.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-28configure: check for msync() for portability reasonsTheodore Ts'o3-3/+3
Turns out the Hurd defines MS_SYNC but doesn't define msync(). Go figure. So check for both. Reported by Svante Signell. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-28tests: add test case for multiply claimed blocks with bigallocTheodore Ts'o4-0/+77
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-28e2fsck: fix handling of duplicate blocks with bigalloc file systemsTheodore Ts'o1-31/+24
We need to do an accounting of duplicate clusters on a per-cluster instead of a per-block basis so we know when we've correctly accounted for all of the multiply claimed blocks in a particular inode. Thanks to Robin Dong for reporting this bug. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-27libquota: remove use of PATH_MAX and replace it with QUOTA_NAME_LENTheodore Ts'o4-8/+12
PATH_MAX is not portable (for example, it doesn't exist on the Hurd). So replace it with a new define, which defines the maximum length of the base quota name. As it turns out, this is substantially smaller than PATH_MAX. Also move the definitions relating to quotaio.c from mkquota.h to quotaio.h, as a cleanup. Addresses-Debian-Bug: #649689 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-25e2fsck: fix the max size calculation for non-extent fileKazuya Mio1-1/+1
When I create a non-extent file with the maximum size in ext4, e2fsck detects the following error: Pass 1: Checking inodes, blocks, and sizes Inode 12, i_size is 4402345721856, should be 4402345721856. Fix? As we know, e2fsck checks the size field of the inode in pass 1. However, in case of the ext4 with the feature of ^extent and huge_file, the maximum file size calculated in e2fsck is less than the real one. The patch fixes this problem. Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-25libext2fs: move mmp fields to preserve structure layout of ext2_filsysTheodore Ts'o1-7/+7
This helps provide better ABI compatibility for e2fsprogs 1.42. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-25tst_fs_struct: add program to help check ABI compatibility of ext2fs_filsysTheodore Ts'o2-0/+87
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-21Update for e2fsprogs 1.42-WIP-1120 releaseTheodore Ts'o4-253/+302
2011-11-21rdebugfs: don't install by defaultTheodore Ts'o1-2/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-20resize2fs: treat EINVAL to mean the new resize ioctl does not existTheodore Ts'o1-1/+10
Linux's compat_sys_ioctl() function, which is run when executing a ioctl using a 32-bit binary on a 64-bit kernel, returns EINVAL when an inode does not exist. Sigh. See /usr/src/linux/fs/compat_ioctl.c. This is probably a kernel bug, but work around it for now. Addresses-Debian-Bug: #644989 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-20e2fsck: return more status if fsck abortsEric Sandeen1-2/+21
If we abort fsck (due to ENOMEM for example) we exit with only the FSCK_ERROR flag. It seems useful to do the same sorts of checks as we do on normal exit, and return whether the filesystem was modified, whether there are still uncorrected errors, etc, even in the abort case. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-20debugfs: fix sprintf stack overflowDarrick J. Wong1-3/+3
The htree dump code overflows a char buffer if the directory has a long filename because the buffer is not large enough to hold the characters that are not part of the filename. Make the buffer larger and use snprintf instead. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-19libext2fs: enforce a max nested link count in ext2fs_find_block_device()Niu Yawei3-2/+10
Define EXT2FS_MAX_NESTED_LINKS as 8, and check the link count to make sure we don't exceed it in ext2fs_find_block_device() and follow_link(). This fixes a potential infinite loop in ext2fs_find_block_device() if there are symbolic loop links in the device directory. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-18e2undo: cast dptr to blk64_t to retrieve block numberEric Sandeen1-1/+1
A 32-bit s390 build was failing on a 64-bit s390x host, when make check failed e2undo tests, like this: md5sum before mke2fs 922c8a591c882dbdd1a381d18547cfd5 using mke2fs to test e2undo Overwriting existing filesystem; this can be undone using the command: e2undo /tmp/mke2fs-tmp.EM9XjmTA81.e2undo /tmp/tmp.EM9XjmTA81 md5sum after mke2fs cbf32fb6c3db45280ad013f42ac294f1 Replayed transaction of size 32768 at location 0 Replayed transaction of size 32768 at location 0 Replayed transaction of size 32768 at location 0 Replayed transaction of size 32768 at location 0 Replayed transaction of size 0 at location 0 md5sum after e2undo 31b4e14307c5b7ccce5b8d300c2ad5f1 Note the "at location 0" for the block number. A proper cast in e2undo.c fixes this up. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-18debugfs: fix gcc -Wall complaintsTheodore Ts'o5-51/+61
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18debugfs: add filefrag commandTheodore Ts'o7-4/+362
Add the ability to report on the fragmentation of a file on a file system opened using debugfs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18debugfs: add the freefrag commandTheodore Ts'o7-30/+76
The freefrag command provides the functionality of e2freefrag on the currently open file system in debugfs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18debugfs: build read-only variant of debugfsTheodore Ts'o3-7/+151
Create a version of debugfs which only supports read-only examination of the file system metadata (but not the data blocks). The idea is that this version of debugfs might be suitable to be setuid root, and executable only by members of a particular group, or setgid disk, and globally executable, depending on the security/privacy policies in force at a particular site. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-14libquota: log an error message if ext2fs_file_open() failsTheodore Ts'o1-1/+1
This also fixes a format string type compiler warning. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-14libquota: fix get_dq()Niu Yawei1-0/+1
The dq_id should be set on newly created dqout. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: fix quota usage computeNiu1-2/+1
In quota_compute_usage(), the space usage should be in bytes but not quota block. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14tune2fs: preserve old limits when turn on quota featureNiu1-7/+24
When turn on quota by tune2fs, if the old quota file exist, the quota usage should be recomputed but the old limits should be preserved. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: quota file read supportNiu7-18/+179
This patch adds read quota file support, which includes: - Improve scan dquot APIs & fix defects in scan dquot functions; - Implement quota_file_open(); - Introduce quota_update_inode() to update usage in old quota file, and keep the limits unchanged. Signed-off-by: Niu Yawei <niu@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14mke2fs: Add extended option to select quota typeAditya Kali2-3/+28
mke2fs was creating both user and group quota inodes on enabling the quota feature. This patch adds the extended option 'quotatype' that can be used to exclusively specify the quota type that the user wants to initialize. # Ex: Default behavior without extended option creates both # user and group quota inodes: $ mke2fs -t ext4 -O quota /dev/ram1 # To enable only user quotas: $ mke2fs -t ext4 -O quota -E quotatype=usr /dev/ram1 # To enable only group quotas: $ mke2fs -t ext4 -O quota -E quotatype=grp /dev/ram1 Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14tune2fs: Compute quota usage when turning on the 'quota' featureAditya Kali1-14/+9
When turning on the quota feature, tune2fs would create empty quota inodes and set their inode numbers in superblock. This required e2fsck to be ran before using the quota feature. This patch adds adds call to compute_quota() and make sure that we write correct quota information in the quota files at tune2fs time itself. This gets rid of the necessity for running e2fsck after setting the quota feature. Also, tune2fs now does not use existing old quota files (aquota.user and aquota.group) even if they exist. Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14libquota: cleanup libquota codeAditya Kali13-230/+256
This patch cleans up the quota code as suggested in previous reviews. This includes * remove BUG_ON()s and 'exit()' calls from library code * remove calls to malloc/free and instead use ext2fs_get/free_mem functions. * lib/quota/common.c file in not needed anymore and is removed. * rename exported functions to start with quota_ (ex: init_quota_context --> quota_init_context) * better error handling in quota library Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-14Make quota support disabled by supportTheodore Ts'o7-116/+50
Quota support can be enabled using --enable-quota. There are still some buglets that we need to fix up before it can be considered 100% supported, so let's disable it for the 1.42 release. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-11e2freefrag: fix "Illegal block number" errors with bigalloc file systemsRobin Dong1-1/+1
After: # mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda # e2freefrag /dev/sda It will report error message like: Illegal block number passed to ext2fs_test_block_bitmap #1732133 for block bitmap for /dev/sda Illegal block number passed to ext2fs_test_block_bitmap #1732134 for block bitmap for /dev/sda Illegal block number passed to ext2fs_test_block_bitmap #1732135 for block bitmap for /dev/sda One bit in bitmap of bigalloc-ext4 means a cluster not a block, therefore ext2fs_fast_test_block_bitmap2 should check cluster. Signed-off-by: Robin Dong <sanbai@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Theodore Ts'o <tytso@mit.edu>