summaryrefslogtreecommitdiff
path: root/print-tree.c
Commit message (Collapse)AuthorAge
* btrfs-progs: print-tree: fix INODE_ITEM sequence and flagsAnand Jain2018-02-13
| | | | | | | | dump-tree prints wrong sequence number and the flags numbers, as we misplaced the printf args. This patch fixes it. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCKGu Jinxiang2018-02-02
| | | | | | | | | | | | Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since maybe in some situation we do not know root, but just know fs_info. To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: print c/o/s/r time of ROOT_ITEMMisono, Tomohiro2018-01-03
| | | | | | | | | | Currently ctime/otime/stime/rtime of ROOT_ITEM are not printed in print_root_item(). Fix this and print them if the values are not zero. The function print_timespec() is moved forward to reuse. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: Print offset as tree objectid for ROOT_ITEMQu Wenruo2017-11-14
| | | | | | | | | | | | | | | | | | | | | For cases like reloc trees and subvolume trees, their key offset is the tree id. The key will be printed as: (TREE_RELOC ROOT_ITEM 18446744073709551607) The negative number is long and even guys with real engineer brains can't easily get the meaning. This patch will change the output format to: (TREE_RELOC ROOT_ITEM DATA_RELOC_TREE) While for special offset value like 0 or (u64)-1, it's still shown as is. Signed-off-by: Qu Wenruo <wqu@suse.com> [ reword comment ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: use proper helper for reading offsetDavid Sterba2017-09-25
| | | | | | | | | | | | | Sparse warns print-tree.c:1261:49: warning: incorrect type in argument 4 (different base types) print-tree.c:1261:49: expected unsigned long long [unsigned] [usertype] start print-tree.c:1261:49: got restricted __le64 [addressable] [usertype] offset which means we have to use the helper instead of directly accessing the offset member. This could print bogus number on bigendian arch. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Add zstd supportNick Terrell2017-09-25
| | | | | | | | | | | | | | | | Adds zstd support to the btrfs program. An optional dependency on libzstd >= 1.0.0 is added. Autoconf accepts `--enable-zstd' or `--disable-zstd' and defaults to detecting if libzstd is present using `pkg-config'. The patch is also available in my fork of btrfs-progs [1], which passes Travis-CI with the new tests. The prebuilt binary is available there. I haven't updated Android.mk. [1] https://github.com/terrelln/btrfs-progs/tree/devel Signed-off-by: Nick Terrell <terrelln@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs-progs: print-tree: check num_stripes in print_chunkZhang Yu2017-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | [TEST/fuzz] case: 004-simple-dump-tree Since the wrong key(DATA_RELOC_TREE CHUNK_ITEM 0) in root tree, error calling print_chunk(), resulting in num_stripes == 0. ERROR: [TEST/fuzz] 004-simple-dump-tree ctree.h:317: btrfs_chunk_item_size: BUG_ON `num_stripes == 0` triggered, value 1 failed (ignored, ret=134): /myproject/btrfs-progs/btrfs inspect-internal dump-tree /myproject/btrfs-progs/tests/fuzz-tests/images/ bko-155201-wrong-chunk-item-in-root-tree.raw.restored test failed for case 004-simple-dump-tree Makefile:288: recipe for target 'test-fuzz' failed make: *** [test-fuzz] Error 1 So, check on num_stripes in print_chunk Signed-off-by: Zhang Yu <zhangyu-fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out extent_csum dumpDavid Sterba2017-09-08
| | | | | | | Factor out code to own helper and tweak the format so it matches the rest. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print the csum length in debug-treeJosef Bacik2017-09-08
| | | | | | | | | | While looking at a log of a corrupted fs I needed to verify we were missing csums for a given range. Make this easier by printing out the range of bytes a csum item covers. Signed-off-by: Josef Bacik <jbacik@fb.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out temporary_item dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out persistent_item dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out qgroup_limit dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out qgroup_info dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out qgroup_status dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out dev_extent dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out free_space_info dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out shared_data_ref dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out extent_data_ref dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: factor out block_group_item dumpDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: don't print the item type for all itemsDavid Sterba2017-09-08
| | | | | | | | In some cases it's clear from the context which item is being printed, so we can remove them. If the item has no data, some description is still desired (eg. orphan or various backrefs). Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: rename item callbacks to match the key nameDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: drop blocksize from read_tree_blockDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: drop local blocksize variables if they're nodesizeDavid Sterba2017-09-08
| | | | | | Prep work so we can drop the blocksize argument from several functions. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Tighten integer types in print-treeAdam Buchbinder2017-07-20
| | | | | | | | | There are likely more places where the wrong size types are used, but these tripped Clang's warnings because they eventually get passed to printf. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Refactor read_tree_block to get rid of btrfs_rootQu Wenruo2017-07-03
| | | | | | | | | | | | | The only reasom read_tree_block() needs a btrfs_root parameter is to get its node/sector size. And long ago, I have already introduced a compactible interface, read_tree_block_fs_info() to pass btrfs_fs_info instead of btrfs_root. Since we have cleaned up all root->sector/node/stripesize users, we should be OK to refactor read_tree_block() function. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: Refactor nodesize user in print-tree.cQu Wenruo2017-07-03
| | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
* btrfs-progs: print-tree: Add leaf flags and backref revision outputQu Wenruo2017-05-15
| | | | | | | | | | | | Btrfs header has a u64 member flags, whose lowest 56 bits are for header flags like WRITTEN and RELOC. And its highest 8 bits are for backref revision. Manually checking btrfs_header_flags() will be a pain, so add such leaf flags and backref revision output for print-tree. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: add validation to print_chunkLu Fengqi2017-04-20
| | | | | | | | | | | In print_chunk, validate the value of uuid_offset when read the dev_uuid of stripe. Was triggered by misc-test/015-dump-super-garbage running indefinetelly. Issue: #37 Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: fix format string on 32bitDavid Sterba2016-11-24
| | | | | | We're passing a size_t, use the right format specifier. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: use new names for obsoleted keysDavid Sterba2016-11-09
| | | | | | | The DEV_STATS and BALANCE_ITEM have been deprecated in favor of more general items, print the new names in the dump. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: convert dir-item-to-string to tableDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: convert key-to-string to tableDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: cleanup types for item number iterationDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: move remaining item variables to the scope of useDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: move variable declarations closer to their useDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: rename extent buffer variable in btrfs_print_leafDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: add untyped item ptr helper and use itDavid Sterba2016-11-09
| | | | | | | | | | | There's lots of code that passes btrfs_item_ptr. Add a helper to extract the ptr at the beginning, ignoring the type. The print functions take the correct type, but we ignore it in the conversion macros as it does not provide the type checking anyway. If the typed variable is used more than once, it's kept in place. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: constify char argument in print_root_refDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: simplify and fix check for empty uuidDavid Sterba2016-11-09
| | | | | | | Counting non-zero bytes is wasteful, besides that it would not recognize uuids containing a 00 value. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: return void from print_* functionsDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: pass item size instead of itemDavid Sterba2016-11-09
| | | | | | | Several functions take item but use just the size, we can factor the item size and use that. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: remove unused parameter from print_inode_itemDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: consolidate data key namesDavid Sterba2016-11-09
| | | | | | | Rename to the structure members, add underscore so it's a single word. Compression is also printed as raw value. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: print dev statsDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: print balance status itemDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: teach print_leaf about temporary item subtypesDavid Sterba2016-11-09
| | | | | [ kernel patch 9f07e1d76eaeeddedcf9651395b4a8f870df31f0 ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: teach print_leaf about permanent item subtypesDavid Sterba2016-11-09
| | | | | [ kernel patch 585a3d0d238dfe42909cb58b0d05f644365fed14 ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: print-tree: extract offset from the item keyDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: print missing data for file extent itemDavid Sterba2016-11-09
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: dump-tree: print more root_item dataDavid Sterba2016-11-09
| | | | | | | Print a few more missing items of root_item (there are still some remaining). Drop key is printend unconditionally. Signed-off-by: David Sterba <dsterba@suse.com>