aboutsummaryrefslogtreecommitdiffstats
path: root/debugfs/debugfs.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'maint' into nextTheodore Ts'o2012-12-241-4/+1
|\ | | | | | | | | | | Conflicts: e2fsck/problem.c e2fsck/problem.h
| * debugfs: add the ability to manipulate the extent tree directlyTheodore Ts'o2012-12-241-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the functionality which had previously only been in the tst_extents command to debugfs. The debugfs command extent_open will open extent tree of a particular inode, and enables a series of commands which will allow the user to interact with the extent tree directly. Once the extent tree is closed via extent_open(), these additional commands will be disabled again. This commit exports two new functions from lib/ext2fs/extent.c which had previously been statically defined: ext2fs_extent_node_split() and ext2fs_extent_goto2(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* | libext2fs: add checksum to MMP blockDarrick J. Wong2012-08-021-0/+1
| | | | | | | | | | | | | | Calculate and verify a checksum of the MMP block. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | libext2fs: block group checksum should use metadata_csum algorithmDarrick J. Wong2012-08-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | Change the block group algorithm to use the same algorithm as the rest of the metadata_csum. This mostly involves providing a helper function to tell if group descriptors should have checksums set or verified, and modifying the gdt checksum code to use the correct algorithm. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | debugfs: dump inode checksum when appropriateDarrick J. Wong2012-07-301-0/+13
| | | | | | | | | | | | | | Dump inode checksum when displaying inode info. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | debugfs: optionally ignore bad checksumsDarrick J. Wong2012-07-301-2/+5
| | | | | | | | | | | | | | | | | | If someone is debugging a badly damaged filesystem, it might be useful to disable the checksum verifications that will otherwise prevent the filesystem from loading. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Make Multi Mount Protection (MMP) optional at configure time.Tony Breeds2012-07-301-0/+5
|/ | | | | | | | | Add --{en,dis}able-mmp options for configure, default to enabled. Also make tools fail gracefully in the event of encoutering a filesystem with MMP enabled when the tools were compiled with --disable-mmp Signed-off-by: Tony Breeds <tony@bakeyournoodle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* debugfs: cleanup in do_show_debugfs_paramsZheng Liu2012-04-241-6/+4
| | | | | | | Remove 'out' variable and replace fprintf with printf. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* Fix gcc -Wall nitpicksTheodore Ts'o2012-04-051-1/+1
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: teach seti and freei to free a block of inodesTheodore Ts'o2012-03-261-10/+42
| | | | | | | In order to the inode allocation functions, it's useful to set and clear a range of inodes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* Use rbtree bitmaps for dumpe2fs, debugfs, and tune2fsTheodore Ts'o2012-03-151-0/+1
| | | | | | | For large file systems, using the rbtree bitmap can save a lot of memory. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: add ncheck -c optionTheodore Ts'o2012-01-171-29/+0
| | | | | | | 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>
* debugfs: fix gcc -Wall complaintsTheodore Ts'o2011-11-181-4/+4
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: build read-only variant of debugfsTheodore Ts'o2011-11-181-5/+48
| | | | | | | | | | | 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>
* debugfs: tidy up mmp handlingEric Sandeen2011-11-111-1/+6
| | | | | | | | | | | 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>
* libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flagTheodore Ts'o2011-10-161-1/+1
| | | | | | | | | | | | | | | | 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>
* ext2fs: add multi-mount protection (INCOMPAT_MMP)Andreas Dilger2011-09-251-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Shorten compile commands run by the build systemTheodore Ts'o2011-09-181-0/+1
| | | | | | | | | | | | | | | 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>
* dumpe2fs: display "free blocks" as "free clusters" for bigalloc file systemsTheodore Ts'o2011-09-161-3/+8
| | | | | | Change this for the equivalent function in debugfs as well. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: add a new debugfs command 'blocks'Theodore Ts'o2011-07-091-0/+28
| | | | | | | 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>
* misc: use EXT2_I_SIZE() consistently to get sizeAndreas Dilger2011-07-081-9/+4
| | | | | | | | 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>
* misc: clean up compiler warningsAndreas Dilger2011-06-111-3/+2
| | | | | | | | 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>
* Merge branch 'maint' into nextTheodore Ts'o2010-09-241-12/+15
|\ | | | | | | | | | | | | | | Conflicts: configure configure.in lib/ext2fs/ext2fs.h misc/mke2fs.c
| * debugfs: Make the extents listing in the stat command more conciseTheodore Ts'o2010-09-241-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>
| * debugfs: Add the -D option to request Direct I/OTheodore Ts'o2010-09-241-2/+8
| | | | | | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| * debugfs: Display the extent tree blocks in the stat command outputTheodore Ts'o2010-09-191-3/+3
| | | | | | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* | debugfs: Add new debugfs command punch (aka truncate)Theodore Ts'o2010-07-221-0/+31
| | | | | | | | | | | | This uses the newly added ext2fs_punch() function. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* | libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()Theodore Ts'o2009-10-251-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>
* | debugfs: open file systems using EXT2_FLAG_64BITSEric Sandeen2009-10-251-2/+2
| | | | | | | | | | Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2009-10-041-0/+2
|\| | | | | | | | | | | | | Conflicts: configure configure.in misc/mke2fs.c
| * debugfs: add matching fclosePeng Tao2009-10-031-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>
* | debugfs: Convert to support 64-bit filesystemsValerie Aurora Henson2009-09-071-71/+77
| | | | | | | | | | | | 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>
* | Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()Valerie Aurora Henson2009-09-071-3/+3
| | | | | | | | | | | | | | 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>
* | Use accessor functions fields for bg_flags in the block group descriptorsTheodore Ts'o2009-09-071-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>
* | debugfs: Move everything to new bitmap interfaceValerie Aurora Henson2009-08-221-14/+14
|/ | | | | Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Add the new command dump_extents and extent the stat commandTheodore Ts'o2009-07-271-2/+202
| | | | | | | | | | | | | | Extend the stat command to display more detailed extent information if the file uses extent mapping instead of displaying the block map using the block_iterate funtion. Add the command dump_extents which displays even more detailed information about an inode's extent tree. This commit is an extension of a patch from Curt Wohlgemuth. Signed-off-by: Curt Wohlgemuth <curtw@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Fix miscellaneous gcc -Wall warningsTheodore Ts'o2009-07-111-1/+1
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Fix miscellaneous memory leaksTheodore Ts'o2009-06-151-0/+2
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Add -a option to close_filesys commandTheodore Ts'o2009-05-281-1/+21
| | | | | | | | Add an -a option to the close_filesys command which writes any changes to the superblock or block group descriptors to all of the backup superblock locations. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Print 64-bit file aclTheodore Ts'o2009-04-181-2/+4
| | | | | | | This is necessary so we can debug filesystem corruptions caused by the i_file_acl bogusly getting set. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: fix segfault on "stat" command with no open fsEric Sandeen2009-03-081-3/+2
| | | | | | | | | | | | This is a regression from commit 8fdf29117f922419bd5b3f741e5d554b1d5b8893, which attempts to access current_fs via a feature check before we check that it's open. Just moving the feature check below the open check should fix it. Reported-by: Andrew Hecox <ahecox@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* Remove trailing whitespace for the entire source treeTheodore Ts'o2008-08-271-67/+67
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Use extents when writing a file if the filesystem supports themTheodore Ts'o2008-08-271-0/+3
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* add debugfs command to print known featuresAndreas Dilger2008-08-241-0/+66
| | | | | | | | | | | Print out the currently supported features of e2fsprogs/libext2fs via a new "debugfs supported_features" command. This helps scripts to know whether it is possible to try and enable specific features in the filesystem. Signed-off-by: Kalpak Shah <kalpak.shah@sun.com> Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* debugfs: Print the progname instead of argv[0] in error messageManish Katiyar2008-08-241-1/+1
| | | | | | | Trivial fix to print the progname instead of argv[0] in error message. Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* debugfs: Close the file handle and return in case of errorsManish Katiyar2008-08-241-0/+1
| | | | | | | | Close the filehandle and return in case if we are unable to expand the directory during write. Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* Flush stdio buffers before calling setbuf()Theodore Ts'o2008-07-131-0/+2
| | | | | | | On Solaris setbuf() will discard any pending output to the stream, so make we call fflush() before calling setbuf(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* debugfs: Print the nanosecond field and i_version field of an inodeTheodore Ts'o2008-05-151-10/+38
| | | | | | Add support for dumping out the new inode fields added in ext4 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* Make debugfs uninit block group awareJose R. Santos2008-03-201-3/+15
| | | | | | Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
* Fix miscellaneous gcc -Wall warningsTheodore Ts'o2008-03-171-1/+1
| | | | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>