Lines Matching refs:disk
196 struct superblock_disk *disk = dm_block_data(b); in sb_prepare_for_write() local
198 disk->blocknr = cpu_to_le64(dm_block_location(b)); in sb_prepare_for_write()
199 disk->csum = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_prepare_for_write()
204 static int check_metadata_version(struct superblock_disk *disk) in check_metadata_version() argument
206 uint32_t metadata_version = le32_to_cpu(disk->version); in check_metadata_version()
220 struct superblock_disk *disk = dm_block_data(b); in sb_check() local
223 if (dm_block_location(b) != le64_to_cpu(disk->blocknr)) { in sb_check()
225 le64_to_cpu(disk->blocknr), in sb_check()
230 if (le64_to_cpu(disk->magic) != SUPERBLOCK_MAGIC) { in sb_check()
232 le64_to_cpu(disk->magic), in sb_check()
237 csum_le = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_check()
240 if (csum_le != disk->csum) { in sb_check()
242 le32_to_cpu(csum_le), le32_to_cpu(disk->csum)); in sb_check()
246 return check_metadata_version(disk); in sb_check()
354 static void ws_pack(const struct writeset_metadata *core, struct writeset_disk *disk) in ws_pack() argument
356 disk->nr_bits = cpu_to_le32(core->nr_bits); in ws_pack()
357 disk->root = cpu_to_le64(core->root); in ws_pack()
360 static void ws_unpack(const struct writeset_disk *disk, struct writeset_metadata *core) in ws_unpack() argument
362 core->nr_bits = le32_to_cpu(disk->nr_bits); in ws_unpack()
363 core->root = le64_to_cpu(disk->root); in ws_unpack()
478 static void copy_sm_root(struct era_metadata *md, struct superblock_disk *disk) in copy_sm_root() argument
480 memcpy(&disk->metadata_space_map_root, in copy_sm_root()
490 static void prepare_superblock(struct era_metadata *md, struct superblock_disk *disk) in prepare_superblock() argument
492 disk->magic = cpu_to_le64(SUPERBLOCK_MAGIC); in prepare_superblock()
493 disk->flags = cpu_to_le32(0ul); in prepare_superblock()
496 memset(disk->uuid, 0, sizeof(disk->uuid)); in prepare_superblock()
497 disk->version = cpu_to_le32(MAX_ERA_VERSION); in prepare_superblock()
499 copy_sm_root(md, disk); in prepare_superblock()
501 disk->data_block_size = cpu_to_le32(md->block_size); in prepare_superblock()
502 disk->metadata_block_size = cpu_to_le32(DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); in prepare_superblock()
503 disk->nr_blocks = cpu_to_le32(md->nr_blocks); in prepare_superblock()
504 disk->current_era = cpu_to_le32(md->current_era); in prepare_superblock()
506 ws_pack(&md->current_writeset->md, &disk->current_writeset); in prepare_superblock()
507 disk->writeset_tree_root = cpu_to_le64(md->writeset_tree_root); in prepare_superblock()
508 disk->era_array_root = cpu_to_le64(md->era_array_root); in prepare_superblock()
509 disk->metadata_snap = cpu_to_le64(md->metadata_snap); in prepare_superblock()
516 struct superblock_disk *disk; in write_superblock() local
528 disk = dm_block_data(sblock); in write_superblock()
529 prepare_superblock(md, disk); in write_superblock()
559 struct superblock_disk *disk; in open_metadata() local
567 disk = dm_block_data(sblock); in open_metadata()
570 if (le32_to_cpu(disk->data_block_size) != md->block_size) { in open_metadata()
572 le32_to_cpu(disk->data_block_size), md->block_size); in open_metadata()
578 disk->metadata_space_map_root, in open_metadata()
579 sizeof(disk->metadata_space_map_root), in open_metadata()
588 md->nr_blocks = le32_to_cpu(disk->nr_blocks); in open_metadata()
589 md->current_era = le32_to_cpu(disk->current_era); in open_metadata()
591 ws_unpack(&disk->current_writeset, &md->current_writeset->md); in open_metadata()
592 md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root); in open_metadata()
593 md->era_array_root = le64_to_cpu(disk->era_array_root); in open_metadata()
594 md->metadata_snap = le64_to_cpu(disk->metadata_snap); in open_metadata()
735 struct writeset_disk disk; in metadata_digest_lookup_writeset() local
745 md->writeset_tree_root, &key, &disk); in metadata_digest_lookup_writeset()
756 ws_unpack(&disk, &d->writeset); in metadata_digest_lookup_writeset()
1077 struct superblock_disk *disk; in metadata_drop_snap() local
1096 disk = dm_block_data(clone); in metadata_drop_snap()
1098 le64_to_cpu(disk->writeset_tree_root)); in metadata_drop_snap()
1105 r = dm_array_del(&md->era_array_info, le64_to_cpu(disk->era_array_root)); in metadata_drop_snap()