summaryrefslogtreecommitdiff
path: root/debugfs
AgeCommit message (Collapse)AuthorFilesLines
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-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>
2011-11-21rdebugfs: don't install by defaultTheodore Ts'o1-2/+2
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-18debugfs: fix gcc -Wall complaintsTheodore Ts'o4-31/+37
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-18debugfs: add filefrag commandTheodore Ts'o6-3/+357
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'o5-2/+23
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-11debugfs: tidy up mmp handlingEric Sandeen2-1/+15
Several small fixes: * Gracefully fail mmp commands if fs is not open * Show magic number in dump_mmp command * Fix header in output for set_mmp_value -l Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-11debugfs.8: add documentation of the mmp commandsEric Sandeen1-0/+13
Document the dump_mmp and set_mmp_value commands in the debugfs manpage. Signed-off-by: Eric Sandeen <sandeen@redhat.com> 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-4/+4
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-09-25debugfs: initialize inode to 0 in list_dir_proc() if no inode nrEric Sandeen1-3/+6
If (!ino), the inode will be uninitialized when we print it in the PARSE_OPT case. So do the same as the LONG_OPT case, and memset it to 0 if (!ino). Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-25ext2fs: add multi-mount protection (INCOMPAT_MMP)Andreas Dilger3-1/+134
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-18Shorten compile commands run by the build systemTheodore Ts'o11-0/+11
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-16e2fsprogs: Remove impossible name_len tests.Eric Sandeen3-6/+3
The name_len field in ext2_dir_entry is actually comprised of the name length in the lower 8 bytes, and the filetype in the high 8 bytes. So in places, we mask name_len with 0xFF to get the actual length. But once we have masked name_len with 0xFF, there is no point in testing whether it is greater than EXT2_NAME_LEN, which is 255 - or 0xFF. So all of these tests are extraneous. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16debugfs: add 64-bit support to the set_field commandsTheodore Ts'o3-161/+310
The set_fields commands (set_super_value, set_inode_field, set_block_group) now handle fields which store in split fields on ext4's on-disk format. For example, the superblock fields s_blocks_count and s_blocks_count_hi. The user can either set the low or high part of the field via "blocks_count_lo" or "blocks_count_hi", or both parts can be set via "blocks_count". Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-16libext2fs: add metadata checksum and snapshot feature flagsTheodore Ts'o1-1/+2
Reserve EXT4_FEATURE_RO_COMPAT_METADATA_CSUM and EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP. Also reserve fields in the superblock and the inode for the checksums. In the block group descriptor, reserve the exclude bitmap field for the snapshot feature, and checksums for the inode and block allocation bitmaps. With this commit, the metadata checksum and exclude bitmap features should have reserved all of the fields they need in ext4's on-disk format. This commit also fixes an a missing byte swap for s_overhead_blocks. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Darrick J. Wong <djwong@us.ibm.com> Cc: Amir Goldstein <amir73il@gmail.com>
2011-09-16dumpe2fs: display "free blocks" as "free clusters" for bigalloc file systemsTheodore Ts'o1-3/+8
Change this for the equivalent function in debugfs as well. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-09debugfs: add a new debugfs command 'blocks'Theodore Ts'o4-0/+37
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-08misc: use EXT2_I_SIZE() consistently to get sizeAndreas Dilger3-16/+7
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-06-11ext2fs: Handle internal journal over 2^32 bytesAndreas Dilger1-0/+1
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-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-11misc: clean up compiler warningsAndreas Dilger3-3/+5
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-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-03-18Merge branch 'maint' into nextTheodore Ts'o2-1/+2
Conflicts: lib/e2p/ls.c
2011-03-18e2fsprogs: man page typo fixesEric Sandeen1-1/+1
Fix a few typos in manpages. Reported-by: Branislav NĂ¡ter <bnater@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-03-18add new superblock field: s_overhead_blocksTheodore Ts'o1-0/+1
It turns out that it's very hard to calculate overheads in the face of clustered allocation (bigalloc). This is because multiple metadata blocks from different block groups can end up in the same allocation cluster. Calculating the exact overhead requires O(all block bitmaps) in memory, or O(number of block groups**2) in time. So we will calculate this at mkfs time and stash it in the superblock. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-27Merge branch 'maint' into nextTheodore Ts'o1-2/+4
Conflicts: lib/ext2fs/initialize.c
2011-02-25Add basic BIGALLOC support for cluster-based allocationTheodore Ts'o1-2/+2
This adds the superblock fields needed so that dumpe2fs works and the code points and renames the superblock fields from describing fragments to clusters. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-02-25e2fsprogs: reserving code points for new ext4 quota featureAditya Kali1-0/+2
This patch adds support for detecting the new 'quota' feature in ext4. The patch reserves code points for usr and group quota inodes and also for the feature flag EXT4_FEATURE_RO_COMPAT_QUOTA. Signed-off-by: Aditya Kali <adityakali@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-09-24Merge branch 'maint' into nextTheodore Ts'o3-18/+29
Conflicts: configure configure.in lib/ext2fs/ext2fs.h misc/mke2fs.c
2010-09-24debugfs: Make the extents listing in the stat command more conciseTheodore Ts'o1-8/+5
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-24debugfs: Add the -D option to request Direct I/OTheodore Ts'o2-8/+21
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-19debugfs: Display the extent tree blocks in the stat command outputTheodore Ts'o1-3/+3
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-18tune2fs, debugfs, libext2fs: Add support for ext4 default mount optionsTheodore Ts'o1-0/+1
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-07-22debugfs: Add new debugfs command punch (aka truncate)Theodore Ts'o4-0/+47
This uses the newly added ext2fs_punch() function. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-07-19Merge branch 'maint' into nextTheodore Ts'o1-0/+5
Conflicts: resize/extent.c
2010-06-24Add support for Next3 snapshot superblock fields to dumpe2fs and debugfsTheodore Ts'o1-0/+5
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-03-15Merge branch 'maint' into nextTheodore Ts'o1-1/+1
2010-03-15debugfs: Correctly show the allocation status of a block using logdumpTheodore Ts'o1-1/+1
The offset in the bitmap was not getting correctly calculated when the user specifics a block to track using "logdump -b <block-num>" Addresses-Debian-Bug: #564084 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert to use block group accessor functionsValerie Aurora Henson1-3/+10
Convert direct accesses to use the following block group accessor functions: ext2fs_block_bitmap_loc(), ext2fs_inode_bitmap_loc(), ext2fs_inode_table_loc(), ext2fs_bg_itable_unused(), ext2fs_block_bitmap_loc_set(), ext2fs_inode_bitmap_loc_set(), ext2fs_inode_table_loc_set(), ext2fs_bg_free_inodes_count(), ext2fs_ext2fs_bg_used_dirs_count(), ext2fs_bg_free_inodes_count_set(), ext2fs_bg_free_blocks_count_set(), ext2fs_bg_used_dirs_count_set() 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>
2009-10-25libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()Theodore Ts'o1-1/+1
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(), we're left with ext2fs_bg_flag_test(). Convert it to ext2fs_bg_flags_test(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25debugfs: open file systems using EXT2_FLAG_64BITSEric Sandeen1-2/+2
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04Merge branch 'maint' into nextTheodore Ts'o2-31/+42
Conflicts: configure configure.in misc/mke2fs.c
2009-10-04Don't use in-tree header files if using system uuid or blkid librariesTheodore Ts'o1-31/+40
This commit forces the use of the system-provided blkid or uuid header files if we are using the system-provided blkid or uuid libraries. This avoids using the in-tree header files with the system libraries. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-03debugfs: add matching fclosePeng Tao1-0/+2
If the cmd_file is not stdin, we should close the file handle via fclose(). Thanks David Binderman to point this out. Addresses-Novell-Bugzilla: #524526 Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07debugfs: Convert to support 64-bit filesystemsValerie Aurora Henson9-116/+150
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>
2009-09-07Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()Valerie Aurora Henson4-6/+6
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Use accessor functions fields for bg_flags in the block group descriptorsTheodore Ts'o1-4/+4
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>