Lines Matching refs:disk_sb
225 struct bch_fs *c = container_of(sb, struct bch_fs, disk_sb); in bch2_sb_field_resize_id()
232 struct bch_sb_handle *dev_sb = &ca->disk_sb; in bch2_sb_field_resize_id()
352 static int bch2_sb_validate(struct bch_sb_handle *disk_sb, in bch2_sb_validate() argument
355 struct bch_sb *sb = disk_sb->sb; in bch2_sb_validate()
515 struct bch_sb *src = c->disk_sb.sb; in bch2_sb_update()
617 ret = bch2_sb_realloc(&c->disk_sb, 0) ?: in bch2_sb_to_fs()
618 __copy_super(&c->disk_sb, src) ?: in bch2_sb_to_fs()
630 return __copy_super(&ca->disk_sb, c->disk_sb.sb); in bch2_sb_from_fs()
891 struct bch_sb *sb = ca->disk_sb.sb; in read_back_super()
892 struct bio *bio = ca->disk_sb.bio; in read_back_super()
894 bio_reset(bio, ca->disk_sb.bdev, REQ_OP_READ|REQ_SYNC|REQ_META); in read_back_super()
909 struct bch_sb *sb = ca->disk_sb.sb; in write_one_super()
910 struct bio *bio = ca->disk_sb.bio; in write_one_super()
918 bio_reset(bio, ca->disk_sb.bdev, REQ_OP_WRITE|REQ_SYNC|REQ_META); in write_one_super()
924 bdev_logical_block_size(ca->disk_sb.bdev))); in write_one_super()
964 c->disk_sb.sb->magic = BCHFS_MAGIC; in bch2_write_super()
965 c->disk_sb.sb->layout.magic = BCHFS_MAGIC; in bch2_write_super()
967 le64_add_cpu(&c->disk_sb.sb->seq, 1); in bch2_write_super()
969 struct bch_sb_field_members_v2 *mi = bch2_sb_field_get(c->disk_sb.sb, members_v2); in bch2_write_super()
971 __bch2_members_v2_get_mut(mi, (*ca)->dev_idx)->seq = c->disk_sb.sb->seq; in bch2_write_super()
972 c->disk_sb.sb->write_time = cpu_to_le64(ktime_get_real_seconds()); in bch2_write_super()
975 SET_BCH_SB_HAS_ERRORS(c->disk_sb.sb, 1); in bch2_write_super()
977 SET_BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb, 1); in bch2_write_super()
979 SET_BCH_SB_BIG_ENDIAN(c->disk_sb.sb, CPU_BIG_ENDIAN); in bch2_write_super()
983 bch2_sb_members_cpy_v2_v1(&c->disk_sb); in bch2_write_super()
993 ret = bch2_sb_validate(&(*ca)->disk_sb, BCH_VALIDATE_write, &err); in bch2_write_super()
1007 if (!BCH_SB_INITIALIZED(c->disk_sb.sb)) in bch2_write_super()
1010 if (le16_to_cpu(c->disk_sb.sb->version) > bcachefs_metadata_version_current) { in bch2_write_super()
1013 bch2_version_to_text(&buf, le16_to_cpu(c->disk_sb.sb->version)); in bch2_write_super()
1037 if (le64_to_cpu(ca->sb_read_scratch->seq) < ca->disk_sb.seq) { in bch2_write_super()
1040 prt_bdevname(&buf, ca->disk_sb.bdev); in bch2_write_super()
1044 ca->disk_sb.seq); in bch2_write_super()
1050 if (le64_to_cpu(ca->sb_read_scratch->seq) > ca->disk_sb.seq) { in bch2_write_super()
1053 prt_bdevname(&buf, ca->disk_sb.bdev); in bch2_write_super()
1057 ca->disk_sb.seq); in bch2_write_super()
1072 sb < ca->disk_sb.sb->layout.nr_superblocks) { in bch2_write_super()
1086 ca->disk_sb.seq = le64_to_cpu(ca->disk_sb.sb->seq); in bch2_write_super()
1129 c->disk_sb.sb->features[0] |= cpu_to_le64(1ULL << feat); in __bch2_check_set_feature()
1150 if (BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb) > bcachefs_metadata_version_current) in bch2_check_version_downgrade()
1151 SET_BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb, bcachefs_metadata_version_current); in bch2_check_version_downgrade()
1153 c->disk_sb.sb->version = cpu_to_le16(bcachefs_metadata_version_current); in bch2_check_version_downgrade()
1155 c->disk_sb.sb->version_min = cpu_to_le16(bcachefs_metadata_version_current); in bch2_check_version_downgrade()
1156 c->disk_sb.sb->compat[0] &= cpu_to_le64((1ULL << BCH_COMPAT_NR) - 1); in bch2_check_version_downgrade()
1165 BCH_VERSION_MAJOR(le16_to_cpu(c->disk_sb.sb->version))) in bch2_sb_upgrade()
1166 bch2_sb_field_resize(&c->disk_sb, downgrade, 0); in bch2_sb_upgrade()
1168 c->disk_sb.sb->version = cpu_to_le16(new_version); in bch2_sb_upgrade()
1169 c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL); in bch2_sb_upgrade()