btrfs: move and rename CSUM_FMT definition
Move the CSUM_FMT* definitions to fs.h where is be the BTRFS_KEY_FMT and add the prefix for consistency. Signed-off-by: David Sterba <dsterba@suse.com>pull/1354/merge
parent
a320476ca8
commit
4decf577fb
|
|
@ -543,10 +543,6 @@ static inline void btrfs_set_inode_mapping_order(struct btrfs_inode *inode)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Array of bytes with variable length, hexadecimal format 0x1234 */
|
||||
#define CSUM_FMT "0x%*phN"
|
||||
#define CSUM_FMT_VALUE(size, bytes) size, bytes
|
||||
|
||||
void btrfs_calculate_block_csum(struct btrfs_fs_info *fs_info, phys_addr_t paddr,
|
||||
u8 *dest);
|
||||
int btrfs_check_block_csum(struct btrfs_fs_info *fs_info, phys_addr_t paddr, u8 *csum,
|
||||
|
|
|
|||
|
|
@ -399,10 +399,10 @@ int btrfs_validate_extent_buffer(struct extent_buffer *eb,
|
|||
|
||||
if (memcmp(result, header_csum, csum_size) != 0) {
|
||||
btrfs_warn_rl(fs_info,
|
||||
"checksum verify failed on logical %llu mirror %u wanted " CSUM_FMT " found " CSUM_FMT " level %d%s",
|
||||
"checksum verify failed on logical %llu mirror %u wanted " BTRFS_CSUM_FMT " found " BTRFS_CSUM_FMT " level %d%s",
|
||||
eb->start, eb->read_mirror,
|
||||
CSUM_FMT_VALUE(csum_size, header_csum),
|
||||
CSUM_FMT_VALUE(csum_size, result),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, header_csum),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, result),
|
||||
btrfs_header_level(eb),
|
||||
ignore_csum ? ", ignored" : "");
|
||||
if (unlikely(!ignore_csum)) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ struct btrfs_space_info;
|
|||
#define BTRFS_SUPER_INFO_SIZE 4096
|
||||
static_assert(sizeof(struct btrfs_super_block) == BTRFS_SUPER_INFO_SIZE);
|
||||
|
||||
/* Array of bytes with variable length, hexadecimal format 0x1234 */
|
||||
#define BTRFS_CSUM_FMT "0x%*phN"
|
||||
#define BTRFS_CSUM_FMT_VALUE(size, bytes) size, bytes
|
||||
|
||||
#define BTRFS_KEY_FMT "(%llu %u %llu)"
|
||||
#define BTRFS_KEY_FMT_VALUE(key) (key)->objectid, (key)->type, (key)->offset
|
||||
|
||||
|
|
|
|||
|
|
@ -234,21 +234,21 @@ static void print_data_reloc_error(const struct btrfs_inode *inode, u64 file_off
|
|||
if (logical == U64_MAX) {
|
||||
btrfs_warn_rl(fs_info, "has data reloc tree but no running relocation");
|
||||
btrfs_warn_rl(fs_info,
|
||||
"csum failed root %lld ino %llu off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||
"csum failed root %lld ino %llu off %llu csum " BTRFS_CSUM_FMT " expected csum " BTRFS_CSUM_FMT " mirror %d",
|
||||
btrfs_root_id(inode->root), btrfs_ino(inode), file_off,
|
||||
CSUM_FMT_VALUE(csum_size, csum),
|
||||
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
mirror_num);
|
||||
return;
|
||||
}
|
||||
|
||||
logical += file_off;
|
||||
btrfs_warn_rl(fs_info,
|
||||
"csum failed root %lld ino %llu off %llu logical %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||
"csum failed root %lld ino %llu off %llu logical %llu csum " BTRFS_CSUM_FMT " expected csum " BTRFS_CSUM_FMT " mirror %d",
|
||||
btrfs_root_id(inode->root),
|
||||
btrfs_ino(inode), file_off, logical,
|
||||
CSUM_FMT_VALUE(csum_size, csum),
|
||||
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
mirror_num);
|
||||
|
||||
ret = extent_from_logical(fs_info, logical, &path, &found_key, &flags);
|
||||
|
|
@ -319,19 +319,19 @@ static void __cold btrfs_print_data_csum_error(struct btrfs_inode *inode,
|
|||
/* Output without objectid, which is more meaningful */
|
||||
if (btrfs_root_id(root) >= BTRFS_LAST_FREE_OBJECTID) {
|
||||
btrfs_warn_rl(root->fs_info,
|
||||
"csum failed root %lld ino %lld off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||
"csum failed root %lld ino %lld off %llu csum " BTRFS_CSUM_FMT " expected csum " BTRFS_CSUM_FMT " mirror %d",
|
||||
btrfs_root_id(root), btrfs_ino(inode),
|
||||
logical_start,
|
||||
CSUM_FMT_VALUE(csum_size, csum),
|
||||
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
mirror_num);
|
||||
} else {
|
||||
btrfs_warn_rl(root->fs_info,
|
||||
"csum failed root %llu ino %llu off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||
"csum failed root %llu ino %llu off %llu csum " BTRFS_CSUM_FMT " expected csum " BTRFS_CSUM_FMT " mirror %d",
|
||||
btrfs_root_id(root), btrfs_ino(inode),
|
||||
logical_start,
|
||||
CSUM_FMT_VALUE(csum_size, csum),
|
||||
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum),
|
||||
BTRFS_CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||
mirror_num);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -775,10 +775,10 @@ static void scrub_verify_one_metadata(struct scrub_stripe *stripe, int sector_nr
|
|||
scrub_bitmap_set_meta_error(stripe, sector_nr, sectors_per_tree);
|
||||
scrub_bitmap_set_error(stripe, sector_nr, sectors_per_tree);
|
||||
btrfs_warn_rl(fs_info,
|
||||
"scrub: tree block %llu mirror %u has bad csum, has " CSUM_FMT " want " CSUM_FMT,
|
||||
"scrub: tree block %llu mirror %u has bad csum, has " BTRFS_CSUM_FMT " want " BTRFS_CSUM_FMT,
|
||||
logical, stripe->mirror_num,
|
||||
CSUM_FMT_VALUE(fs_info->csum_size, on_disk_csum),
|
||||
CSUM_FMT_VALUE(fs_info->csum_size, calculated_csum));
|
||||
BTRFS_CSUM_FMT_VALUE(fs_info->csum_size, on_disk_csum),
|
||||
BTRFS_CSUM_FMT_VALUE(fs_info->csum_size, calculated_csum));
|
||||
return;
|
||||
}
|
||||
if (stripe->sectors[sector_nr].generation !=
|
||||
|
|
|
|||
Loading…
Reference in New Issue