summaryrefslogtreecommitdiff
path: root/print-tree.c
Commit message (Collapse)AuthorAge
* btrfs-progs: Allow btrfs-debug-tree to print human readable qgroup status flag.Qu Wenruo2015-03-24
| | | | | | | | | | | | Now btrfs-debug-tree can print qgroup status flag as ON|INCONSISTENT instead of 0x5. BTW, this patch helped us to find a bug that INCONSISTENT flag is never cleared in kernel. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [renamed to qgroup_flags_to_str] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Update qgroup status flags and replace qgroup level/subvid ↵Qu Wenruo2015-03-24
| | | | | | | | | | | | | | calculation with inline function Ctree.h of btrfs-progs contains wrong flags for btrfs_qgroup_status. Update it with the one in kernel. Also, introduce the inline function btrfs_qgroup_(level/subvid) to get the level/subvolid of qgroup, to replace the old open-coded bit operations. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: make debug-tree spit out full_backref flagJosef Bacik2015-02-09
| | | | | | | Currently btrfs-debug-tree ignores the FULL_BACKREF flag which makes it hard to figure out problems related to FULL_BACKREF. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com>
* btrfs-progs: read_tree_block() and read_node_slot() cleanup.Qu Wenruo2015-02-02
| | | | | | | | | | | | Allow read_tree_block() and read_node_slot() to return error pointer. This should help caller to get more specified error number. For existing callers, change (!eb) judgmentt to (!extent_buffer_uptodate(eb)) to keep the compatibility, and for caller missing the check, use PTR_ERR(eb) if possible. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: debug: print more info about inodeDavid Sterba2014-10-10
| | | | | | Add uid, gid, rdev and flags to btrfs_print_leaf. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add human readable flags output for chunk/block group type.Qu Wenruo2014-08-22
| | | | | | | | | | | Current btrfs-debug-tree output chunk/block group type as numbers, which makes it hard to understand and need to check the source to understand the meaning. This patch will convert numeric type output to human readable strings. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add human readable flags output string for extent flags.Qu Wenruo2014-08-22
| | | | | | | | | | | Current btrfs-debug-tree outputs extent flags as numbers, which makes it hard to understand and need to check the source to understand the meaning. This patch will convert numberic flags output to human readable strings. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add quota group verify codeMark Fasheh2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds functionality (in qgroup-verify.c) to compute bytecounts in subvolume quota groups. The original groups are read in and stored in memory so that after we compute our own bytecounts, we can compare them with those on disk. A print function is provided to do this comparison and show the results on the console. A 'qgroup check' pass is added to btrfsck. If any subvolume quota groups differ from what we compute, the differences for them are printed. We also provide an option '--qgroup-report' which will run only the quota check code and print a report on all quota groups. Other than making it possible to verify that our qgroup changes work correctly, this mode can also be used in xfstests for automated checking after qgroup tests. This patch does not address the following: - compressed counts are identical to non compressed, because kernel doesn't make the distinction yet. Adding the code to verify compressed counts shouldn't be hard at all though once kernel can do this. - It is only concerned with subvolume quota groups (like most of btrfs-progs). Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: print qgroup excl as unsignedMark Fasheh2014-08-22
| | | | | | | It's unsigned in the structure definition. Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add dev uuid output for print_dev_item().Qu Wenruo2014-08-22
| | | | | | | | | | | | | | | | The original print_dev_item() only prints device id,total bytes and bytes used. When it comes to debug duplicated device id, dev uuid is needed to distinguish different devices since device id is not reliable. (Although the current dev replace implement will reuse the dev uuid, so not really helpful) This patch adds dev uuid output for print_dev_item(). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add sys_chunk_array and backup roots info to show-superGui Hecheng2014-08-22
| | | | | | | | | Add sys chunk array and backup roots info if the new option '-f' if specified. This may be useful for debugging sys_chunk related issues. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: update btrfs_file_extent_inline_len to match kernel versionFilipe David Borba Manana2014-04-11
| | | | | | | | | | | | | | | | | | | | | | | The following kernel commit changed the definition of the inline function btrfs_file_extent_inline_len(): commit 514ac8ad8793a097c0c9d89202c642479d6dfa34 Author: Chris Mason <clm@fb.com> Date: Fri Jan 3 21:07:00 2014 -0800 Btrfs: don't use ram_bytes for uncompressed inline items If we truncate an uncompressed inline item, ram_bytes isn't updated to reflect the new size. The fixe uses the size directly from the item header when reading uncompressed inlines, and also fixes truncate to update the size as it goes. Not having this new definition implies that the restore tool might misbehave when restoring files with an inline extent that got truncated on a kernel older than release 3.14. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: convert remaining uuid buffer declarations to ↵David Sterba2014-01-31
| | | | | | | BTRFS_UUID_UNPARSED_SIZE Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: Make btrfs_header_chunk_tree_uuid() return unsigned longRoss Kirk2014-01-31
| | | | | | | | | | | | Internally, btrfs_header_chunk_tree_uuid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again. From btrfs commit b308bc2f05a86e728bd035e21a4974acd05f4d1e Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf sizeAnand Jain2014-01-31
| | | | | | | | | we use 37 as the allocation size to hold the uuid_unparse, here it defines BTRFS_UUID_UNPARSE_SIZE for the same. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: Make btrfs_header_fsid() return unsigned longRoss Kirk2013-10-16
| | | | | | | | | | | | | Internally, btrfs_header_fsid() calculates an unsigned long, but casts it to a pointer, while all callers cast it to unsigned long again. Committed to btrfs as fba6aa75654394fccf2530041e9451414c28084f Fix line length issues and match changes to kernelspace Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: remove unused parameter from btrfs_header_fsidRoss Kirk2013-10-16
| | | | | | | | | | Remove unused parameter, 'eb'. Unused since introduction in 7777e63b425f1444d2472ea05a6b2b9cf865f35b Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: drop unused parameter from btrfs_item_nrRoss Kirk2013-10-16
| | | | | | | | | | Remove unused eb parameter from btrfs_item_nr, unused since introduced in 7777e63b425f1444d2472ea05a6b2b9cf865f35b Signed-off-by: Ross Kirk <ross.kirk@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: fix in-place byte swappingZach Brown2013-09-03
| | | | | | | | | Storing fixed-endian values in native cpu types defeats the purpose of using sparse endian types to find endian conversion bugs. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: Support UUID tree and UUID items in btrfs-debug-treeStefan Behrens2013-08-09
| | | | | | | | Support printing these things. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: pretty print dir_item typeFilipe David Borba Manana2013-08-09
| | | | | | | | | | Instead of printing an integer, print a symbolic name which is more human friendly. Particularly useful when using the program btrfs-debug-tree. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: in btrfs-debug-tree, print -1 in key for (u64)-1Stefan Behrens2013-04-23
| | | | | | | | For the objectid and offset field of a key, print -1 instead of the decimal representation of 0xffffffffffffffff. At least for me it is more readable like this. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs-progs: add skinny metadata support to progs V3Josef Bacik2013-04-23
| | | | | | | | | This fixes up the progs to properly deal with skinny metadata. This adds the -x option to mkfs and btrfstune for enabling the skinny metadata option. This also makes changes to fsck so it can properly deal with the skinny metadata entries. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
* btrfs-progs: break after printing FREE_INOZach Brown2013-02-05
| | | | | | | The free inode objectid would be printed as "FREE_INOQUOTA_TREE" because of a missing break. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: Basic support for extended inode refsMark Fasheh2013-01-31
| | | | | | | | This patch syncs the extended inode ref definitions from kernels ctree.h and adds support in btrfs-debug-tree for visualizing the state of extended refs on disk. Signed-off-by: Mark Fasheh <mfasheh@suse.de>
* Btrfs-progs: add support for device replace procedureStefan Behrens2013-01-31
| | | | | | | | | | | This is the user mode part of the device replace patch series. The command group "btrfs replace" is added with three commands: - btrfs replace start srcdev|srcdevid targetdev [-Bfr] mount_point - btrfs replace status mount_point [-1] - btrfs replace cancel mount_point Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* Btrfs-progs: add command to get/reset device stats via ioctlStefan Behrens2013-01-31
| | | | | | | | "btrfs device stats" is used to retrieve and print the device stats. "btrfs device stats -z" is used to atomically retrieve, reset and print the stats. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
* btrfs-progs: pretty print key in extent_itemDavid Sterba2012-10-04
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs progs: quota groups supportArne Jansen2012-09-04
| | | | | Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Arne Jansen <sensille@gmx.net>
* Btrfs-progs: update btrfs-progs for subvol uuid+times supportAlexander Block2012-07-26
| | | | | | Update ctree.h and ioctl.h for the new uuid+times for subvolumes. Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: print inode transid and dir item data field in debug-treeAlexander Block2012-07-26
| | | | | | Add printing of inode transid and dir item data field. Signed-off-by: Alexander Block <ablock84@googlemail.com>
* Btrfs-progs: make print-tree.c aware of free space cacheIlya Dryomov2012-03-13
| | | | | | | This adds proper formatting for free space and inode cache items in btrfs-debug-tree output. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* btrfsck: add code to rebuild extent recordsChris Mason2012-02-07
| | | | | | | This also includes a new --repair btrfsck option. For now it can only fix errors in the extent allocation tree. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs-progs: add restriper headersIlya Dryomov2012-02-03
| | | | | | Add restriper headers and update print-tree.c Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Print the root generation in btrfs-debug-treeChris Mason2011-10-25
| | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-progs: cast u64 to long long to avoid printf warningsAnton Blanchard2011-10-25
| | | | | | | | | | | | When building on ppc64 I hit a number of warnings in printf: btrfs-map-logical.c:69: error: format ‘%Lu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u64’ Fix them. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
* Fix unused-but-set errors in gcc-4.6Chris Ball2011-10-25
| | | | | | | | | | | | | | | | gcc-4.6 (as shipped in Fedora) turns on -Wunused-but-set-variable by default, which breaks the build when combined with -Wall, e.g.: debug-tree.c: In function ‘print_extent_leaf’: debug-tree.c:45:13: error: variable ‘last_len’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:44:13: error: variable ‘last’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:41:21: error: variable ‘item’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors This patch fixes the errors by removing the unused variables. Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
* only print FIRST_CHUNK_TREE for chunk items in debug-treeSage Weil2010-09-23
| | | | | | | Otherwise we print FIRST_CHUNK_TREE for any objectid 256, which e.g. for the root tree is the first snap/subvol. Signed-off-by: Sage Weil <sage@newdream.net>
* Btrfs: add btrfs-debug-tree -b <block number> to print a single blockChris Mason2010-04-06
|
* Mixed back reference (FORWARD ROLLING FORMAT CHANGE)Chris Mason2009-06-08
| | | | | | | | | | | | | | | | | This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS. The new back ref provides information about pointer's key, level and in which tree the pointer lives. This information allow us to find the pointer by searching the tree. The shortcoming of the new back ref is that it only works for pointers in tree blocks referenced by their owner trees. This is mostly a problem for snapshots, where resolving one of these fuzzy back references would be O(number_of_snapshots) and quite slow. The solution used here is to use the fuzzy back references in the common case where a given tree block is only referenced by one root, and use the full back references when multiple roots have a reference
* Fix printf format casting errorsLuca Bruno2009-06-03
| | | | | | | | | | | | There are still some warnings of the form: format '%llu' expects type 'long long unsigned int' but argument has type 'u64' In conjunction with -Werror, this is causing some build failures. Now they're properly casted, avoiding compiler warnings. Signed-off-by: Luca Bruno <lucab@debian.org> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Update btrfs-debug-tree to output more readable strings.Shen Feng2009-06-03
| | | | | | | | | | output objectid in btrfs_disk_key with human readable strings. Other updates are included for more readable output. Thanks Fengguang's fix to this patch. Signed-off-by: Shen Feng <shen@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Fix print-tree.c to skip blocks it can't read instead of abortingChris Mason2009-05-13
|
* Add scan of the btrfs log tree to btrfs-debug-treeChris Mason2009-04-15
|
* debug-tree output tree/key type instead of idShen Feng2009-01-07
| | | | | | | This makes the tree name and key type output more readable. Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
* Btrfs: move data checksumming into a dedicated treeChris Mason2008-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Btrfs stores checksums for each data block. Until now, they have been stored in the subvolume trees, indexed by the inode that is referencing the data block. This means that when we read the inode, we've probably read in at least some checksums as well. But, this has a few problems: * The checksums are indexed by logical offset in the file. When compression is on, this means we have to do the expensive checksumming on the uncompressed data. It would be faster if we could checksum the compressed data instead. * If we implement encryption, we'll be checksumming the plain text and storing that on disk. This is significantly less secure. * For either compression or encryption, we have to get the plain text back before we can verify the checksum as correct. This makes the raid layer balancing and extent moving much more expensive. * It makes the front end caching code more complex, as we have touch the subvolume and inodes as we cache extents. * There is potentitally one copy of the checksum in each subvolume referencing an extent. The solution used here is to store the extent checksums in a dedicated tree. This allows us to index the checksums by phyiscal extent start and length. It means: * The checksum is against the data stored on disk, after any compression or encryption is done. * The checksum is stored in a central location, and can be verified without following back references, or reading inodes. This makes compression significantly faster by reducing the amount of data that needs to be checksummed. It will also allow much faster raid management code in general. The checksums are indexed by a key with a fixed objectid (a magic value in ctree.h) and offset set to the starting byte of the extent. This allows us to copy the checksum items into the fsync log tree directly (or any other tree), without having to invent a second format for them. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs image toolYan Zheng2008-11-20
| | | | | | | | | This patch adds btrfs image tool. The image tool is a debugging tool that creates/restores btrfs metadump image. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* Add disk format requirements for subvol backward and forward refsChris Mason2008-11-18
|
* Add fallocate support v2Yan Zheng2008-10-31
| | | | | | | This patch updates btrfs-progs for fallocate support. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
* Add disk format elements for compressionChris Mason2008-10-29
| | | | | Signed-off-by: Chris Mason <chris.mason@oracle.com>