mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-16 03:15:39 +00:00
9f6c055e38
Add new options to dumps checksums in node headers and in the checksum items: $ btrfs inspect dump-tree --csum-headers image root tree leaf 471515136 items 19 free space 12186 generation 15 owner ROOT_TREE leaf 471515136 flags 0x1(WRITTEN) backref revision 1 csum 0x756b2d54 fs uuid df0348df-5773-47dd-81e9-a18221461239 For nodes/leaves it's appended on the 2nd line of the header. Checksum items are stored in leaves as EXTENT_CSUM key type, with offset value as the logical offset starting. As the array would be hard to parse or match, each offset value is printed with the checksum. For crc32c it's 4 values on a line, for xxhash it's 2 and for the long 256bit checksums it's one checksum per line. $ btrfs inspect dump-tree --csum-items image leaf 5423104 items 1 free space 30 generation 6 owner CSUM_TREE leaf 5423104 flags 0x1(WRITTEN) backref revision 1 fs uuid bd7c981e-16ff-4081-a734-3ef5d50cafc1 chunk uuid 13f4c76c-7845-4984-88ed-f01b52e05cf8 item 0 key (EXTENT_CSUM EXTENT_CSUM 22020096) itemoff 55 itemsize 16228 range start 22020096 end 38637568 length 16617472 [22020096] 0x8941f998 [22024192] 0x8941f998 [22028288] 0x8941f998 [22032384] 0x8941f998 [22036480] 0x8941f998 [22040576] 0x8941f998 [22044672] 0x8941f998 [22048768] 0x8941f998 ... $ btrfs inspect dump-tree --csum-items image leaf 5718016 items 1 free space 7746 generation 6 owner CSUM_TREE leaf 5718016 flags 0x1(WRITTEN) backref revision 1 fs uuid f453a5b4-8b4a-4fbf-90a2-2925e4fe2335 chunk uuid eb1da63b-248b-44c2-82da-71b2564bf50e item 0 key (EXTENT_CSUM EXTENT_CSUM 52387840) itemoff 7771 itemsize 8512 range start 52387840 end 53477376 length 1089536 [52387840] 0x686ede9288c391e7e05026e56f2f91bfd879987a040ea98445dabc76f55b8e5f [52391936] 0x686ede9288c391e7e05026e56f2f91bfd879987a040ea98445dabc76f55b8e5f ... The options are not on by default, the header checksum is not important for the structures. Data checksums can be quite big so that would make the dump long and without any actual data to match against. Signed-off-by: David Sterba <dsterba@suse.com>
47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2007 Oracle. All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public
|
|
* License v2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public
|
|
* License along with this program; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 021110-1307, USA.
|
|
*/
|
|
|
|
#ifndef __PRINT_TREE_H__
|
|
#define __PRINT_TREE_H__
|
|
|
|
enum {
|
|
/* Depth-first search, nodes and leaves can be interleaved */
|
|
BTRFS_PRINT_TREE_DFS = (1 << 0),
|
|
/* Breadth-first search, first nodes, then leaves */
|
|
BTRFS_PRINT_TREE_BFS = (1 << 1),
|
|
/* Follow to child nodes */
|
|
BTRFS_PRINT_TREE_FOLLOW = (1 << 2),
|
|
/* Print checksum of node/leaf */
|
|
BTRFS_PRINT_TREE_CSUM_HEADERS = (1 << 3),
|
|
/* Print checksums in checksum items */
|
|
BTRFS_PRINT_TREE_CSUM_ITEMS = (1 << 4),
|
|
BTRFS_PRINT_TREE_DEFAULT = BTRFS_PRINT_TREE_BFS,
|
|
};
|
|
|
|
void btrfs_print_tree(struct extent_buffer *eb, unsigned int mode);
|
|
void btrfs_print_leaf(struct extent_buffer *eb, unsigned int mode);
|
|
|
|
void btrfs_print_key(struct btrfs_disk_key *disk_key);
|
|
void print_chunk_item(struct extent_buffer *eb, struct btrfs_chunk *chunk);
|
|
void print_extent_item(struct extent_buffer *eb, int slot, int metadata);
|
|
void print_objectid(FILE *stream, u64 objectid, u8 type);
|
|
void print_key_type(FILE *stream, u64 objectid, u8 type);
|
|
void btrfs_print_superblock(struct btrfs_super_block *sb, int full);
|
|
|
|
#endif
|