On Tue, Apr 24, 2018 at 12:48:09PM +0800, Qu Wenruo wrote:
> -static int btrfs_validate_super(struct btrfs_fs_info *fs_info)
> +/*
> + * Check the validation of btrfs super block.
> + *
> + * @sb: super block to check
> + * @super_mirror: the super block number to check its bytenr.
> + * 0 means the primary (1st) sb, 1 and 2 means 2nd and
> + * 3rd backup sb, while -1 means to skip bytenr check.
Please format the values like:
/*
* Check the validity of btrfs super block
*
* @sb: super block to check
* @super_mirror: the super block number to check its bytenr:
* 0 means the primary (1st) sb,
* 1 and 2 means 2nd and 3rd backup copy
* -1 means to skip bytenr check
*/
> + */
> +static int btrfs_validate_super(struct btrfs_fs_info *fs_info,
> + struct btrfs_super_block *sb,
> + int super_mirror)
> {
> - struct btrfs_super_block *sb = fs_info->super_copy;
> u64 nodesize = btrfs_super_nodesize(sb);
> u64 sectorsize = btrfs_super_sectorsize(sb);
> int ret = 0;
> @@ -4088,9 +4109,10 @@ static int btrfs_validate_super(struct btrfs_fs_info *fs_info)
> ret = -EINVAL;
> }
>
> - if (btrfs_super_bytenr(sb) != BTRFS_SUPER_INFO_OFFSET) {
> - btrfs_err(fs_info, "super offset mismatch %llu != %u",
> - btrfs_super_bytenr(sb), BTRFS_SUPER_INFO_OFFSET);
> + if (super_mirror >= 0 && btrfs_super_bytenr(sb) !=
> + btrfs_sb_offset(super_mirror)) {
The preferred condition split is after the operators, not in the middle
of the expression. Like this:
if (super_mirror >= 0 &&
btrfs_super_bytenr(sb) != btrfs_sb_offset(super_mirror)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html