super-io.c (7468c4effc8c93464ec0fd4336494312bebb8033) | super-io.c (8244f3209b5b49a6bde9921d7825af9f57161b23) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3#include "bcachefs.h" 4#include "btree_update_interior.h" 5#include "buckets.h" 6#include "checksum.h" 7#include "disk_groups.h" 8#include "ec.h" --- 253 unchanged lines hidden (view full) --- 262 return "Bad minimum version"; 263 264 if (sb->features[1] || 265 (le64_to_cpu(sb->features[0]) & (~0ULL << BCH_FEATURE_NR))) 266 return "Filesystem has incompatible features"; 267 268 block_size = le16_to_cpu(sb->block_size); 269 | 1// SPDX-License-Identifier: GPL-2.0 2 3#include "bcachefs.h" 4#include "btree_update_interior.h" 5#include "buckets.h" 6#include "checksum.h" 7#include "disk_groups.h" 8#include "ec.h" --- 253 unchanged lines hidden (view full) --- 262 return "Bad minimum version"; 263 264 if (sb->features[1] || 265 (le64_to_cpu(sb->features[0]) & (~0ULL << BCH_FEATURE_NR))) 266 return "Filesystem has incompatible features"; 267 268 block_size = le16_to_cpu(sb->block_size); 269 |
270 if (!is_power_of_2(block_size) || 271 block_size > PAGE_SECTORS) | 270 if (block_size > PAGE_SECTORS) |
272 return "Bad block size"; 273 274 if (bch2_is_zero(sb->user_uuid.b, sizeof(sb->user_uuid))) 275 return "Bad user UUID"; 276 277 if (bch2_is_zero(sb->uuid.b, sizeof(sb->uuid))) 278 return "Bad internal UUID"; 279 --- 25 unchanged lines hidden (view full) --- 305 return "Invalid metadata checksum type"; 306 307 if (BCH_SB_COMPRESSION_TYPE(sb) >= BCH_COMPRESSION_OPT_NR) 308 return "Invalid compression type"; 309 310 if (!BCH_SB_BTREE_NODE_SIZE(sb)) 311 return "Btree node size not set"; 312 | 271 return "Bad block size"; 272 273 if (bch2_is_zero(sb->user_uuid.b, sizeof(sb->user_uuid))) 274 return "Bad user UUID"; 275 276 if (bch2_is_zero(sb->uuid.b, sizeof(sb->uuid))) 277 return "Bad internal UUID"; 278 --- 25 unchanged lines hidden (view full) --- 304 return "Invalid metadata checksum type"; 305 306 if (BCH_SB_COMPRESSION_TYPE(sb) >= BCH_COMPRESSION_OPT_NR) 307 return "Invalid compression type"; 308 309 if (!BCH_SB_BTREE_NODE_SIZE(sb)) 310 return "Btree node size not set"; 311 |
313 if (!is_power_of_2(BCH_SB_BTREE_NODE_SIZE(sb))) 314 return "Btree node size not a power of two"; 315 | |
316 if (BCH_SB_GC_RESERVE(sb) < 5) 317 return "gc reserve percentage too small"; 318 319 if (!sb->time_precision || 320 le32_to_cpu(sb->time_precision) > NSEC_PER_SEC) 321 return "invalid time precision"; 322 323 /* validate layout */ --- 298 unchanged lines hidden (view full) --- 622 623 ret = -EINVAL; 624 goto err; 625 626got_super: 627 err = "Superblock block size smaller than device block size"; 628 ret = -EINVAL; 629 if (le16_to_cpu(sb->sb->block_size) << 9 < | 312 if (BCH_SB_GC_RESERVE(sb) < 5) 313 return "gc reserve percentage too small"; 314 315 if (!sb->time_precision || 316 le32_to_cpu(sb->time_precision) > NSEC_PER_SEC) 317 return "invalid time precision"; 318 319 /* validate layout */ --- 298 unchanged lines hidden (view full) --- 618 619 ret = -EINVAL; 620 goto err; 621 622got_super: 623 err = "Superblock block size smaller than device block size"; 624 ret = -EINVAL; 625 if (le16_to_cpu(sb->sb->block_size) << 9 < |
630 bdev_logical_block_size(sb->bdev)) 631 goto err; | 626 bdev_logical_block_size(sb->bdev)) { 627 pr_err("error reading superblock: Superblock block size (%u) smaller than device block size (%u)", 628 le16_to_cpu(sb->sb->block_size) << 9, 629 bdev_logical_block_size(sb->bdev)); 630 goto err_no_print; 631 } |
632 633 ret = 0; 634 sb->have_layout = true; 635out: 636 pr_verbose_init(*opts, "ret %i", ret); 637 return ret; 638err: | 632 633 ret = 0; 634 sb->have_layout = true; 635out: 636 pr_verbose_init(*opts, "ret %i", ret); 637 return ret; 638err: |
639 bch2_free_super(sb); | |
640 pr_err("error reading superblock: %s", err); | 639 pr_err("error reading superblock: %s", err); |
640err_no_print: 641 bch2_free_super(sb); |
|
641 goto out; 642} 643 644/* write superblock: */ 645 646static void write_super_endio(struct bio *bio) 647{ 648 struct bch_dev *ca = bio->bi_private; --- 557 unchanged lines hidden --- | 642 goto out; 643} 644 645/* write superblock: */ 646 647static void write_super_endio(struct bio *bio) 648{ 649 struct bch_dev *ca = bio->bi_private; --- 557 unchanged lines hidden --- |