Lines Matching refs:disk
203 struct superblock_disk *disk = dm_block_data(b); in sb_prepare_for_write() local
205 disk->blocknr = cpu_to_le64(dm_block_location(b)); in sb_prepare_for_write()
206 disk->csum = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_prepare_for_write()
211 static int check_metadata_version(struct superblock_disk *disk) in check_metadata_version() argument
213 uint32_t metadata_version = le32_to_cpu(disk->version); in check_metadata_version()
228 struct superblock_disk *disk = dm_block_data(b); in sb_check() local
231 if (dm_block_location(b) != le64_to_cpu(disk->blocknr)) { in sb_check()
233 __func__, le64_to_cpu(disk->blocknr), in sb_check()
238 if (le64_to_cpu(disk->magic) != SUPERBLOCK_MAGIC) { in sb_check()
240 __func__, le64_to_cpu(disk->magic), in sb_check()
245 csum_le = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_check()
248 if (csum_le != disk->csum) { in sb_check()
250 __func__, le32_to_cpu(csum_le), le32_to_cpu(disk->csum)); in sb_check()
254 return check_metadata_version(disk); in sb_check()
364 static void ws_pack(const struct writeset_metadata *core, struct writeset_disk *disk) in ws_pack() argument
366 disk->nr_bits = cpu_to_le32(core->nr_bits); in ws_pack()
367 disk->root = cpu_to_le64(core->root); in ws_pack()
370 static void ws_unpack(const struct writeset_disk *disk, struct writeset_metadata *core) in ws_unpack() argument
372 core->nr_bits = le32_to_cpu(disk->nr_bits); in ws_unpack()
373 core->root = le64_to_cpu(disk->root); in ws_unpack()
493 static void copy_sm_root(struct era_metadata *md, struct superblock_disk *disk) in copy_sm_root() argument
495 memcpy(&disk->metadata_space_map_root, in copy_sm_root()
505 static void prepare_superblock(struct era_metadata *md, struct superblock_disk *disk) in prepare_superblock() argument
507 disk->magic = cpu_to_le64(SUPERBLOCK_MAGIC); in prepare_superblock()
508 disk->flags = cpu_to_le32(0ul); in prepare_superblock()
511 memset(disk->uuid, 0, sizeof(disk->uuid)); in prepare_superblock()
512 disk->version = cpu_to_le32(MAX_ERA_VERSION); in prepare_superblock()
514 copy_sm_root(md, disk); in prepare_superblock()
516 disk->data_block_size = cpu_to_le32(md->block_size); in prepare_superblock()
517 disk->metadata_block_size = cpu_to_le32(DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); in prepare_superblock()
518 disk->nr_blocks = cpu_to_le32(md->nr_blocks); in prepare_superblock()
519 disk->current_era = cpu_to_le32(md->current_era); in prepare_superblock()
521 ws_pack(&md->current_writeset->md, &disk->current_writeset); in prepare_superblock()
522 disk->writeset_tree_root = cpu_to_le64(md->writeset_tree_root); in prepare_superblock()
523 disk->era_array_root = cpu_to_le64(md->era_array_root); in prepare_superblock()
524 disk->metadata_snap = cpu_to_le64(md->metadata_snap); in prepare_superblock()
531 struct superblock_disk *disk; in write_superblock() local
543 disk = dm_block_data(sblock); in write_superblock()
544 prepare_superblock(md, disk); in write_superblock()
574 struct superblock_disk *disk; in open_metadata() local
582 disk = dm_block_data(sblock); in open_metadata()
585 if (le32_to_cpu(disk->data_block_size) != md->block_size) { in open_metadata()
587 le32_to_cpu(disk->data_block_size), md->block_size); in open_metadata()
593 disk->metadata_space_map_root, in open_metadata()
594 sizeof(disk->metadata_space_map_root), in open_metadata()
603 md->nr_blocks = le32_to_cpu(disk->nr_blocks); in open_metadata()
604 md->current_era = le32_to_cpu(disk->current_era); in open_metadata()
606 ws_unpack(&disk->current_writeset, &md->current_writeset->md); in open_metadata()
607 md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root); in open_metadata()
608 md->era_array_root = le64_to_cpu(disk->era_array_root); in open_metadata()
609 md->metadata_snap = le64_to_cpu(disk->metadata_snap); in open_metadata()
752 struct writeset_disk disk; in metadata_digest_lookup_writeset() local
762 md->writeset_tree_root, &key, &disk); in metadata_digest_lookup_writeset()
773 ws_unpack(&disk, &d->writeset); in metadata_digest_lookup_writeset()
1096 struct superblock_disk *disk; in metadata_drop_snap() local
1115 disk = dm_block_data(clone); in metadata_drop_snap()
1117 le64_to_cpu(disk->writeset_tree_root)); in metadata_drop_snap()
1124 r = dm_array_del(&md->era_array_info, le64_to_cpu(disk->era_array_root)); in metadata_drop_snap()