summaryrefslogtreecommitdiff
path: root/misc
AgeCommit message (Collapse)AuthorFilesLines
2011-11-18debugfs: add the freefrag commandTheodore Ts'o1-27/+47
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-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-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 Kali2-16/+16
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'o1-1/+4
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>
2011-10-16libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flagTheodore Ts'o2-9/+10
The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to only check i_file_acl_high if the 64-bit flag is set. This is needed because otherwise we will run into problems on Hurd systems which actually use that field for h_i_mode_high. This involves an ABI change since we need to pass ext2_filsys to these functions. Fortunately these functions were first included in the 1.42-WIP series, so it's OK for us to change them now. (This is why we have 1.42-WIP releases. :-) Addresses-Sourceforge-Bug: #3379227 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-09filefrag: fix infinite loop in filefragTheodore Ts'o1-7/+0
Commit a00be17e4768 was missing a patch hunk needed to prevent filefrag from looping forever when it is run without the -v option. Addresses-Debian-Bug: #644792 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-09Fix more spelling errors found by translators and add pluralizationTheodore Ts'o4-7/+18
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-08dumpe2fs.8.in: add man page warning about mounted file systemsTheodore Ts'o1-4/+3
This should be obvious, but apparently not to all users... Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-08Fix spelling errors pointed out by translatorsTheodore Ts'o1-1/+1
Also remove the _("<foo>") marker from a string that was all numbers and hence didn't need punctuation. Thanks to Philipp Thomas and Goeran Uddeborg for reporting these buglets. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-06libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargsTheodore Ts'o1-1/+1
Some architectures have narrow mode_t's which can cause some portability warnings with varargs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05uuidgen: don't use set_com_err_gettext()Theodore Ts'o1-1/+0
The uuidgen program doesn't use libcom_err. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05mke2fs: Fix up usage & error text for cluster size specificationEric Sandeen1-2/+2
Commit c6ed60cd removed "f" (fragment size) from the getopt string, and re-used its spot in the getopt switch, but didn't update the usage message or the error message during parsing. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-05Pass the gettext() function to libcom_errTheodore Ts'o12-0/+12
For those e2fsprogs programs which use libcom_err and are internationalized, pass the gettext() function to libcom_err during program initialization. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-04libquota: remove get_qf_name()Theodore Ts'o1-2/+2
The get_qf_name() function used PATH_MAX, which is non-portable. Worse, it blindly assumed that PATH_MAX was the size of the buffer passed to it --- which in the one and only place where it was used in libquota, was a buffer declared to a fixed size 256 bytes. Fix this by simply getting rid of the function altogether. Cc: Aditya Kali <adityakali@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-03Add "big" and "huge" types to mke2fs.confTheodore Ts'o2-0/+12
mke2fs attempts to use the "big" and "huge" types, and now that mke2fs will complain if there are file system types which are undefined, let's add definitions for them. Thanks to Richard Jones for reporting this problem. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30filefrag: fix an off by one error in when printing the next expected blockTheodore Ts'o1-5/+5
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30filefrag: Display the number of contiguous, not physical, extentsTheodore Ts'o1-6/+3
From a bug report filed by Ibragimov Rinat: When filefrag uses FIEMAP ioctl its logic differs for ordinary and verbose (-v) modes. ext4 returns extent on every 32768 block so on large files it is possible that `filefrag large-file' tells about 4 extents while `filefrag -v large-file' finds only one. Also when I tried to use generic_block_fiemap function to add FIEMAP for reiserfs, every block was reported as a new extent resulting in thousands "extents" for continuous files. I think filefrag should merge adjacent extents even when -v is not specified. Addresses-Debian-Bug: #631498 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30mke2fs.conf.5: clarify the man page regarding boolean relationsTheodore Ts'o1-5/+10
Explain more clearly how boolean relations in the mke2fs.conf file are parsed, and which config parameters are in fact boolean relations. Addresses-Debian-Bug: #634883 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28debian: add hurd-specific mke2fs.conf fileTheodore Ts'o1-0/+36
Addresses-Debian-Bug: #629355 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28mke2fs: set s_max_mnt_count to -1 by defaultTheodore Ts'o3-4/+10
If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which is also the default), s_max_mnt_count needs to be set to -1, instead of 0. Kernels newer than 3.0 will interpret 0 to disable periodic checks, but older kernels will print a warning message on each mount, which will annoy users. Addresses-Debian-Bug: #632637 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25e2fsck: regression tests for INCOMPAT_MMP featureAndreas Dilger1-3/+3
Add tests for the MMP feature - creating a filesystem with mke2fs and MMP enabled, enable/disable MMP with tune2fs, disabling the e2fsck MMP flag with tune2fs after a failed e2fsck, and e2fsck checking and fixing a corrupt MMP block. The MMP tests need to be run from a real disk, not tmpfs, because tmpfs doesn't support O_DIRECT reads, which MMP uses to ensure that reads from the MMP block are not filled from the page cache. Using a local disk does not slow down the tests noticably, since they wait to detect if the MMP block is being modified. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25ext2fs: add multi-mount protection (INCOMPAT_MMP)Andreas Dilger6-57/+309
Multi-mount protection is feature that allows mke2fs, e2fsck, and others to detect if the filesystem is mounted on a remote node (on SAN disks) and avoid corrupting the filesystem. For e2fsprogs this means that it checks the MMP block to see if the filesystem is in use, and marks the filesystem busy while e2fsck is running on the system. This is useful on SAN disks that are shared between high-availability servers, or accessible by multiple nodes that aren't in HA pairs. MMP isn't intended to serve as a primary HA exclusion mechanism, but as a failsafe to protect against user, software, or hardware errors. There is no requirement that e2fsck updates the MMP block at regular intervals, but e2fsck does this occasionally to provide useful information to the sysadmin in case of a detected conflict. For the kernel (since Linux 3.0) MMP adds a "heartbeat" mechanism to periodically write to disk (every few seconds by default) to notify other nodes that the filesystem is still in use and unsafe to modify. Originally-by: Kalpak Shah <kalpak@clusterfs.com> Signed-off-by: Johann Lombardi <johann@whamcloud.com> Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-24tune2fs: miscellaneous whitespace fixupsAndreas Dilger1-6/+6
Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24tune2fs: kill external journal if device not foundAndreas Dilger1-2/+4
Continue to remove the external journal device even if the device cannot be found. Add a test to verify that the journal device/UUID are actually removed from the superblock. It isn't possible to use a real journal device for testing without loopback devices and such (it must be a block device) and this would invite complexity and failures in the regression test. Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24misc: quiet minor compiler errorsAndreas Dilger1-1/+1
Several compiler errors are quieted: - zero-length gnu_printf format string - unused variable - uninitalized variable (though it isn't actually used for anything) - fixed a bug in ext2fs_stat() if stat64() does not exist Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-18Shorten compile commands run by the build systemTheodore Ts'o25-25/+72
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and this was starting to cause some tools heartburn. It also made "make V=1" almost useless, since trying to following the individual commands run by make was lost in the noise of all of the defines. So fix this by putting the configure-generated defines in lib/config.h and the directory pathnames to lib/dirpaths.h. In addition, clean up some vestigal defines in configure.in and in the Makefiles to further shorten the cc command lines. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16mke2fs: free tdb_dir string if it came from the profileEric Sandeen1-2/+9
if tdb_dir points to a string allocated from profile_get_string, it should be freed again before we exit. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16e4defrag: Check error return of sysconf()Eric Sandeen1-1/+4
In theory sysconf() can fail, so check for an error return. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16e2fsprogs: Don't try to close an fd which is negativeEric Sandeen1-1/+2
These reflect either file descriptors which aren't tested for failure, or closures of fd's which may have failed. In setup_tdb(), test for failure of mkstemp and return without trying to open the file (again). In reserve_stdio_fds, rather than closing the "extra" fd == 3 due to the way the loop is written, just don't go that far by using while (fd <= 2). In logsave, it forks and retries forever if open fails, but at least make coverity happy by explicitly not trying to close a negative file descriptor. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16tune2fs: handle inode and/or block bitmap read failures in resize_inode()Eric Sandeen1-2/+13
Handle these failures in resize_inode, and handle the propagated error in the caller. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16e2initrd_helper: Fix memory leak on errorEric Sandeen1-4/+7
Some error paths did not properly free "buf" And the normal exit seemed to close e2_file twice (?) Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16mke2fs: Do not let -t or -T be specified more than onceEric Sandeen1-0/+10
In addition to not making sense, it causes a memory leak when fs_type gets overwritten. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16filefrag: Fix uninitialized "expected" valueEric Sandeen1-2/+3
The "count" variable is only ever set if FIBMAP is used, due to the -B switch, or a fiemap failure. However, we use it unconditionally to calculate "expected" for extN files, so we can end up printing garbage. Initialize count to 0, and unless we go through the FIBMAP path, expected will be 0 as well, and in that case do not print the message. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16freefrag: fix up getopt case statementEric Sandeen1-3/+1
There is no need to print out a "bad option" message; getopt does that for us, and in fact will change "c" to "?" so it's not even useful. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16uuidd: Add missing break to option case statementEric Sandeen1-0/+1
Specifying the "-n" option to uuidd would incorrectly fall through to the "-p" case, and assign that number to the pidfile_path. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16mke2fs: remove impossible tests for null usage_typesEric Sandeen1-5/+2
parse_fs_type explicitly sets usage_types if it is null, so there is no need to test for null later. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16fsck: fix -C option parsingEric Sandeen1-1/+1
The i++; statement is unreachable; fix same as commit f1c2eaac535bd9172a35ce39b6d8f392321f274d in util-linux Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16dumpe2fs: display "free blocks" as "free clusters" for bigalloc file systemsTheodore Ts'o1-2/+7
Change this for the equivalent function in debugfs as well. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16Merge branch 'maint' into nextTheodore Ts'o2-3/+5
2011-09-15e2fsprogs: Use punch hole as "discard" on regular filesLukas Czerner1-2/+8
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of on block device, we can use punch hole instead of regular discard command which would not work on regular file anyway. This gives us several advantages. First of all when e2fsck is run with '-E discard' parameter it will punch out all ununsed space from the image, hence trimming down the file system image. And secondly, when creating an file system on regular file (with '-E discard' which is default), we can use punch hole to clear the file content, hence we can skip inode table initialization, because reads from sparse area returns zeros. This will result in faster file system creation (without the need to specify lazy_itable_init) and smaller images. This commit also fixes some tests that would fail due to mke2fs showing discard progress, hence the output would differ. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15e2fsprogs: create open() and stat() helpersLukas Czerner2-23/+5
In many places we are using #ifdef HAVE_OPEN64 to determine if we can use open64() but that's ugly. This commit creates two new helpers ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need new typedef ext2fs_struct_stat for struct stat. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15mke2fs: check that auto-detected blocksize <= sys_page_sizeYury V. Zaytsev1-11/+13
Block size can be specified manually via the -b option or deduced automatically. Unfortunately, the check that it is still smaller than the system page size is only performed right after the command line options are parsed. Therefore, if buggy or inappropriately installed/configured hardware hints that larger block sizes have to be used, mkfs will silently create a file system which can not be mounted on the system in question. By moving the check beyond the last assignment to blocksize it is now ensured, that mkfs will issue a warning even if inappropriate blocksize was auto-detected. The new behavior can be easily tested, by exporting the following variables before running mkfs: export MKE2FS_DEVICE_SECTSIZE=8192 export MKE2FS_DEVICE_PHYS_SECTSIZE=8192 Signed-off-by: Yury V. Zaytsev <yury@shurup.com> Reviewed-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15mke2fs.8: Fix the documentation of maximum journal sizeSurbhi Palande1-1/+2
Fix the max journal size in mke2fs man page. Signed-off-by: Surbhi Palande <csurbhi@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15badblocks: update man page's description of the -v optionTheodore Ts'o1-1/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-15mke2fs: use "extent" consistently as a feature name in the man pageTheodore Ts'o1-1/+1
Addresses-Debian-Bug: #639411 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-14e2image: fix invalid lseek error detectionLukas Czerner1-1/+2
In flush_l2_cache() we are using ext2fs_llseek() however we do not properly detect the error code returned from the function, because we are assigning it into ULL variable, hence we will not see negative values. Fix this by changing the type of the variable to ext2_loff_t which is signed and hence will store negative values. Signed-off-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-13mke2fs.static: change library ordering to avoid a link errorTheodore Ts'o1-2/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>