diff options
author | David Sterba <dsterba@suse.com> | 2019-03-20 11:22:58 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-04-29 13:02:34 -0400 |
commit | d001e4a3fe3959bdd7b5d4d29246082305d1b840 (patch) | |
tree | 8453e1d6456249eeeedde3200650b9495cb4eca4 /fs/btrfs/tree-checker.c | |
parent | e2ccd361ef06d18eaba488a568ed4d3664f2d4a7 (diff) |
btrfs: tree-checker: get fs_info from eb in chunk_err
We can read fs_info from extent buffer and can drop it from the
parameters.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-checker.c')
-rw-r--r-- | fs/btrfs/tree-checker.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index 65e2906d133e..1dac957eaf35 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c | |||
@@ -447,13 +447,13 @@ static int check_block_group_item(struct extent_buffer *leaf, | |||
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | __printf(5, 6) | 450 | __printf(4, 5) |
451 | __cold | 451 | __cold |
452 | static void chunk_err(const struct btrfs_fs_info *fs_info, | 452 | static void chunk_err(const struct extent_buffer *leaf, |
453 | const struct extent_buffer *leaf, | ||
454 | const struct btrfs_chunk *chunk, u64 logical, | 453 | const struct btrfs_chunk *chunk, u64 logical, |
455 | const char *fmt, ...) | 454 | const char *fmt, ...) |
456 | { | 455 | { |
456 | const struct btrfs_fs_info *fs_info = leaf->fs_info; | ||
457 | bool is_sb; | 457 | bool is_sb; |
458 | struct va_format vaf; | 458 | struct va_format vaf; |
459 | va_list args; | 459 | va_list args; |
@@ -517,37 +517,37 @@ int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, | |||
517 | type = btrfs_chunk_type(leaf, chunk); | 517 | type = btrfs_chunk_type(leaf, chunk); |
518 | 518 | ||
519 | if (!num_stripes) { | 519 | if (!num_stripes) { |
520 | chunk_err(fs_info, leaf, chunk, logical, | 520 | chunk_err(leaf, chunk, logical, |
521 | "invalid chunk num_stripes, have %u", num_stripes); | 521 | "invalid chunk num_stripes, have %u", num_stripes); |
522 | return -EUCLEAN; | 522 | return -EUCLEAN; |
523 | } | 523 | } |
524 | if (!IS_ALIGNED(logical, fs_info->sectorsize)) { | 524 | if (!IS_ALIGNED(logical, fs_info->sectorsize)) { |
525 | chunk_err(fs_info, leaf, chunk, logical, | 525 | chunk_err(leaf, chunk, logical, |
526 | "invalid chunk logical, have %llu should aligned to %u", | 526 | "invalid chunk logical, have %llu should aligned to %u", |
527 | logical, fs_info->sectorsize); | 527 | logical, fs_info->sectorsize); |
528 | return -EUCLEAN; | 528 | return -EUCLEAN; |
529 | } | 529 | } |
530 | if (btrfs_chunk_sector_size(leaf, chunk) != fs_info->sectorsize) { | 530 | if (btrfs_chunk_sector_size(leaf, chunk) != fs_info->sectorsize) { |
531 | chunk_err(fs_info, leaf, chunk, logical, | 531 | chunk_err(leaf, chunk, logical, |
532 | "invalid chunk sectorsize, have %u expect %u", | 532 | "invalid chunk sectorsize, have %u expect %u", |
533 | btrfs_chunk_sector_size(leaf, chunk), | 533 | btrfs_chunk_sector_size(leaf, chunk), |
534 | fs_info->sectorsize); | 534 | fs_info->sectorsize); |
535 | return -EUCLEAN; | 535 | return -EUCLEAN; |
536 | } | 536 | } |
537 | if (!length || !IS_ALIGNED(length, fs_info->sectorsize)) { | 537 | if (!length || !IS_ALIGNED(length, fs_info->sectorsize)) { |
538 | chunk_err(fs_info, leaf, chunk, logical, | 538 | chunk_err(leaf, chunk, logical, |
539 | "invalid chunk length, have %llu", length); | 539 | "invalid chunk length, have %llu", length); |
540 | return -EUCLEAN; | 540 | return -EUCLEAN; |
541 | } | 541 | } |
542 | if (!is_power_of_2(stripe_len) || stripe_len != BTRFS_STRIPE_LEN) { | 542 | if (!is_power_of_2(stripe_len) || stripe_len != BTRFS_STRIPE_LEN) { |
543 | chunk_err(fs_info, leaf, chunk, logical, | 543 | chunk_err(leaf, chunk, logical, |
544 | "invalid chunk stripe length: %llu", | 544 | "invalid chunk stripe length: %llu", |
545 | stripe_len); | 545 | stripe_len); |
546 | return -EUCLEAN; | 546 | return -EUCLEAN; |
547 | } | 547 | } |
548 | if (~(BTRFS_BLOCK_GROUP_TYPE_MASK | BTRFS_BLOCK_GROUP_PROFILE_MASK) & | 548 | if (~(BTRFS_BLOCK_GROUP_TYPE_MASK | BTRFS_BLOCK_GROUP_PROFILE_MASK) & |
549 | type) { | 549 | type) { |
550 | chunk_err(fs_info, leaf, chunk, logical, | 550 | chunk_err(leaf, chunk, logical, |
551 | "unrecognized chunk type: 0x%llx", | 551 | "unrecognized chunk type: 0x%llx", |
552 | ~(BTRFS_BLOCK_GROUP_TYPE_MASK | | 552 | ~(BTRFS_BLOCK_GROUP_TYPE_MASK | |
553 | BTRFS_BLOCK_GROUP_PROFILE_MASK) & | 553 | BTRFS_BLOCK_GROUP_PROFILE_MASK) & |
@@ -557,13 +557,13 @@ int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, | |||
557 | 557 | ||
558 | if (!is_power_of_2(type & BTRFS_BLOCK_GROUP_PROFILE_MASK) && | 558 | if (!is_power_of_2(type & BTRFS_BLOCK_GROUP_PROFILE_MASK) && |
559 | (type & BTRFS_BLOCK_GROUP_PROFILE_MASK) != 0) { | 559 | (type & BTRFS_BLOCK_GROUP_PROFILE_MASK) != 0) { |
560 | chunk_err(fs_info, leaf, chunk, logical, | 560 | chunk_err(leaf, chunk, logical, |
561 | "invalid chunk profile flag: 0x%llx, expect 0 or 1 bit set", | 561 | "invalid chunk profile flag: 0x%llx, expect 0 or 1 bit set", |
562 | type & BTRFS_BLOCK_GROUP_PROFILE_MASK); | 562 | type & BTRFS_BLOCK_GROUP_PROFILE_MASK); |
563 | return -EUCLEAN; | 563 | return -EUCLEAN; |
564 | } | 564 | } |
565 | if ((type & BTRFS_BLOCK_GROUP_TYPE_MASK) == 0) { | 565 | if ((type & BTRFS_BLOCK_GROUP_TYPE_MASK) == 0) { |
566 | chunk_err(fs_info, leaf, chunk, logical, | 566 | chunk_err(leaf, chunk, logical, |
567 | "missing chunk type flag, have 0x%llx one bit must be set in 0x%llx", | 567 | "missing chunk type flag, have 0x%llx one bit must be set in 0x%llx", |
568 | type, BTRFS_BLOCK_GROUP_TYPE_MASK); | 568 | type, BTRFS_BLOCK_GROUP_TYPE_MASK); |
569 | return -EUCLEAN; | 569 | return -EUCLEAN; |
@@ -571,7 +571,7 @@ int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, | |||
571 | 571 | ||
572 | if ((type & BTRFS_BLOCK_GROUP_SYSTEM) && | 572 | if ((type & BTRFS_BLOCK_GROUP_SYSTEM) && |
573 | (type & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA))) { | 573 | (type & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA))) { |
574 | chunk_err(fs_info, leaf, chunk, logical, | 574 | chunk_err(leaf, chunk, logical, |
575 | "system chunk with data or metadata type: 0x%llx", | 575 | "system chunk with data or metadata type: 0x%llx", |
576 | type); | 576 | type); |
577 | return -EUCLEAN; | 577 | return -EUCLEAN; |
@@ -584,7 +584,7 @@ int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, | |||
584 | if (!mixed) { | 584 | if (!mixed) { |
585 | if ((type & BTRFS_BLOCK_GROUP_METADATA) && | 585 | if ((type & BTRFS_BLOCK_GROUP_METADATA) && |
586 | (type & BTRFS_BLOCK_GROUP_DATA)) { | 586 | (type & BTRFS_BLOCK_GROUP_DATA)) { |
587 | chunk_err(fs_info, leaf, chunk, logical, | 587 | chunk_err(leaf, chunk, logical, |
588 | "mixed chunk type in non-mixed mode: 0x%llx", type); | 588 | "mixed chunk type in non-mixed mode: 0x%llx", type); |
589 | return -EUCLEAN; | 589 | return -EUCLEAN; |
590 | } | 590 | } |
@@ -596,7 +596,7 @@ int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info, | |||
596 | (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) || | 596 | (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) || |
597 | (type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 2) || | 597 | (type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 2) || |
598 | ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 && num_stripes != 1)) { | 598 | ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 && num_stripes != 1)) { |
599 | chunk_err(fs_info, leaf, chunk, logical, | 599 | chunk_err(leaf, chunk, logical, |
600 | "invalid num_stripes:sub_stripes %u:%u for profile %llu", | 600 | "invalid num_stripes:sub_stripes %u:%u for profile %llu", |
601 | num_stripes, sub_stripes, | 601 | num_stripes, sub_stripes, |
602 | type & BTRFS_BLOCK_GROUP_PROFILE_MASK); | 602 | type & BTRFS_BLOCK_GROUP_PROFILE_MASK); |