Commit Graph

164 Commits (c23c1271d30e1c3834e6814d222cba315c6c72d5)

Author SHA1 Message Date
David Sterba c23c1271d3 btrfs-progs: print-tree: factor out extent_data_ref dump
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba e853a1abcd btrfs-progs: print-tree: factor out block_group_item dump
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 077a7024cd btrfs-progs: print-tree: don't print the item type for all items
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>
2017-09-08 16:15:05 +02:00
David Sterba 1224f7343e btrfs-progs: print-tree: rename item callbacks to match the key name
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 98909c21d7 btrfs-progs: drop blocksize from read_tree_block
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
David Sterba 1fa9653dc8 btrfs-progs: drop local blocksize variables if they're nodesize
Prep work so we can drop the blocksize argument from several functions.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-08 16:15:05 +02:00
Adam Buchbinder 3987fb6f07 btrfs-progs: Tighten integer types in print-tree
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>
2017-07-20 17:43:43 +02:00
Qu Wenruo 8690c887d1 btrfs-progs: Refactor read_tree_block to get rid of btrfs_root
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>
2017-07-03 13:35:11 +02:00
Qu Wenruo 428e689b87 btrfs-progs: Refactor nodesize user in print-tree.c
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
2017-07-03 13:35:10 +02:00
Qu Wenruo f8c82394c4 btrfs-progs: print-tree: Add leaf flags and backref revision output
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>
2017-05-15 16:13:17 +02:00
Lu Fengqi da76d52947 btrfs-progs: print-tree: add validation to print_chunk
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>
2017-04-20 13:35:39 +02:00
David Sterba f8278f94ff btrfs-progs: print-tree: fix format string on 32bit
We're passing a size_t, use the right format specifier.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-24 13:06:36 +01:00
David Sterba 5103e80b21 btrfs-progs: dump-tree: use new names for obsoleted keys
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>
2016-11-09 13:47:31 +01:00
David Sterba b9ff0190cf btrfs-progs: dump-tree: convert dir-item-to-string to table
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba e6410f631d btrfs-progs: dump-tree: convert key-to-string to table
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 69f879eac9 btrfs-progs: dump-tree: cleanup types for item number iteration
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 56917b41fb btrfs-progs: dump-tree: move remaining item variables to the scope of use
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba e58cc23823 btrfs-progs: dump-tree: move variable declarations closer to their use
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 6b138f5367 btrfs-progs: dump-tree: rename extent buffer variable in btrfs_print_leaf
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 7541b53b34 btrfs-progs: dump-tree: add untyped item ptr helper and use it
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>
2016-11-09 13:47:30 +01:00
David Sterba 17a9d9013d btrfs-progs: dump-tree: constify char argument in print_root_ref
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba a15294f0c4 btrfs-progs: dump-tree: simplify and fix check for empty uuid
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>
2016-11-09 13:47:30 +01:00
David Sterba 5082ec84a8 btrfs-progs: dump-tree: return void from print_* functions
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba e9c1121495 btrfs-progs: dump-tree: pass item size instead of item
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>
2016-11-09 13:47:30 +01:00
David Sterba ae00d4a251 btrfs-progs: remove unused parameter from print_inode_item
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 15db981600 btrfs-progs: dump-tree: consolidate data key names
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>
2016-11-09 13:47:30 +01:00
David Sterba cf5c55fba8 btrfs-progs: dump-tree: print dev stats
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba b74dbb86c0 btrfs-progs: dump-tree: print balance status item
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 8a50dc9600 btrfs-progs: teach print_leaf about temporary item subtypes
[ kernel patch 9f07e1d76eaeeddedcf9651395b4a8f870df31f0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 9da5b472d5 btrfs-progs: teach print_leaf about permanent item subtypes
[ kernel patch 585a3d0d238dfe42909cb58b0d05f644365fed14 ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba e905d055f6 btrfs-progs: print-tree: extract offset from the item key
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 5d43dfd344 btrfs-progs: dump-tree: print missing data for file extent item
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:30 +01:00
David Sterba 069b0b6d14 btrfs-progs: dump-tree: print more root_item data
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>
2016-11-09 13:47:29 +01:00
David Sterba 58bef5b4a7 btrfs-progs: dump-tree: print missing dir_item data
Add items from dir_item that are not printed, plus other adjustments.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba 6c849c616e btrfs-progs: dump-tree: print missing inode_item data
Add items from inode_item that are not printed.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba f1d4606a6d btrfs-progs: dump-tree: add helper to print timespec
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba 58fe71f3f7 btrfs-progs: dump-tree: factor inode_item dump to function
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba cae265e816 btrfs-progs: dump-tree: print missing dev_extent data
Add items from chunk that are not printed, unify names according to
the member names and reorder a bit.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba c6cd8ff6ec btrfs-progs: dump-tree: print missing chunk data
Add items from chunk that are not printed, unify names according to
the member names and reorder a bit.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
David Sterba 20ba2993a5 btrfs-progs: dump-tree: print missing dev_item data
Add items from dev_item that are not printed, unify names according to
the member names.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:29 +01:00
Qu Wenruo 5bd4016363 btrfs-progs: Make btrfs-debug-tree print all readable strings for inode flags
Before this patch, only 3 inode flags have readable string: NODATACOW,
NODATASUM, READONLY.

This patch will output all readable strings for remaining inode flags,
making debug-tree tool more handy.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor adjustments ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-24 14:58:02 +02:00
David Sterba ad44d1eb17 btrfs-progs: improved error handling in btrfs_print_tree
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
Qu Wenruo 00045ff485 btrfs-progs: Enhance and export print_key_type function
Just the same thing done for print_objectid().

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-05 10:04:07 +02:00
Qu Wenruo 7aafabd2b8 btrfs-progs: Enhance and export print_objectid function
This function is quite useful for a lot of error report.
Enhance it to support custom output other than stdout.
And export it for later btrfsck enhancement.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-05 10:04:04 +02:00
Qu Wenruo 1c202eb06d btrfs-progs: print-tree: Print hex and human readable root flags
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-08-19 13:54:05 +02:00
Qu Wenruo 44e2b7a7e5 btrfs-progs: print-tree: Print human readable inode flags
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-08-19 13:53:52 +02:00
Mark Fasheh a804254361 btrfs-progs: check: write corrected qgroup info to disk
Now that we can verify all qgroups, we can write the corrected qgroups out
to disk when '--repair' is specified. The qgroup status item is also updated
to clear any out-of-date state. The repair_ functions were modeled after the
inode repair code in cmds-check.c.

I also renamed the 'scan' member of qgroup_status_item to 'rescan' in order
to keep consistency with the kernel.

Testing this was easy, I just reproduced qgroup inconsistencies via the
usual routes and had btrfsck fix them.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-07-13 18:44:26 +02:00
David Sterba 3be6e3e7c9 btrfs-progs: deprecate and stop using btrfs_level_size
Size of a b-tree node is always nodesize, regardless of the level.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-05-02 14:40:23 +02:00
Wang Xiaoguang cfa4b5bc4d btrfs-progs: print-tree: show the compression method string
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
[ changed the format of unknown value ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Omar Sandoval d8c537e71f btrfs-progs: add basic awareness of the free space tree
To start, let's tell btrfs-progs to read the free space root and how to
print the on-disk format of the free space tree. However, we're not
adding the FREE_SPACE_TREE read-only compat bit to the set of supported
bits because progs doesn't know how to keep the free space tree
consistent.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-01-12 15:02:54 +01:00