Lines Matching +full:low +full:- +full:vt

1 // SPDX-License-Identifier: GPL-2.0-only
3 #include "persistent-data/dm-transaction-manager.h"
4 #include "persistent-data/dm-bitset.h"
5 #include "persistent-data/dm-space-map.h"
7 #include <linux/dm-io.h>
8 #include <linux/dm-kcopyd.h>
26 *--------------------------------------------------------------
28 *--------------------------------------------------------------
51 vfree(ws->bits); in writeset_free()
52 ws->bits = NULL; in writeset_free()
77 ws->bits = vzalloc(bitset_size(nr_blocks)); in writeset_alloc()
78 if (!ws->bits) { in writeset_alloc()
80 return -ENOMEM; in writeset_alloc()
87 * Wipes the in-core bitset, and creates a new on disk bitset.
94 memset(ws->bits, 0, bitset_size(nr_blocks)); in writeset_init()
96 ws->md.nr_bits = nr_blocks; in writeset_init()
97 r = setup_on_disk_bitset(info, ws->md.nr_bits, &ws->md.root); in writeset_init()
108 return test_bit(block, ws->bits); in writeset_marked()
116 dm_block_t old = m->root; in writeset_marked_on_disk()
122 r = dm_bitset_test_bit(info, m->root, block, &m->root, result); in writeset_marked_on_disk()
128 BUG_ON(m->root != old); in writeset_marked_on_disk()
141 if (!test_bit(block, ws->bits)) { in writeset_test_and_set()
142 r = dm_bitset_set_bit(info, ws->md.root, block, &ws->md.root); in writeset_test_and_set()
155 *--------------------------------------------------------------
157 *--------------------------------------------------------------
195 *--------------------------------------------------------------
197 *--------------------------------------------------------------
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()
207 sb_block_size - sizeof(__le32), in sb_prepare_for_write()
213 uint32_t metadata_version = le32_to_cpu(disk->version); in check_metadata_version()
218 return -EINVAL; in check_metadata_version()
231 if (dm_block_location(b) != le64_to_cpu(disk->blocknr)) { in sb_check()
233 __func__, le64_to_cpu(disk->blocknr), in sb_check()
235 return -ENOTBLK; 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()
242 return -EILSEQ; in sb_check()
245 csum_le = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_check()
246 sb_block_size - sizeof(__le32), 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()
251 return -EILSEQ; in sb_check()
264 *--------------------------------------------------------------
265 * Low level metadata handling
266 *--------------------------------------------------------------
314 return dm_bm_read_lock(md->bm, SUPERBLOCK_LOCATION, in superblock_read_lock()
321 return dm_bm_write_lock_zero(md->bm, SUPERBLOCK_LOCATION, in superblock_lock_zero()
328 return dm_bm_write_lock(md->bm, SUPERBLOCK_LOCATION, in superblock_lock()
342 * We can't use a validator here - it may be all zeroes. in superblock_all_zeroes()
362 /*----------------------------------------------------------------*/
366 disk->nr_bits = cpu_to_le32(core->nr_bits); in ws_pack()
367 disk->root = cpu_to_le64(core->root); in ws_pack()
372 core->nr_bits = le32_to_cpu(disk->nr_bits); in ws_unpack()
373 core->root = le64_to_cpu(disk->root); in ws_unpack()
386 dm_tm_inc(md->tm, b); in ws_inc()
400 dm_bitset_del(&md->bitset_info, b); in ws_dec()
409 /*----------------------------------------------------------------*/
413 struct dm_btree_value_type *vt = &md->writeset_tree_info.value_type; in setup_writeset_tree_info() local
415 md->writeset_tree_info.tm = md->tm; in setup_writeset_tree_info()
416 md->writeset_tree_info.levels = 1; in setup_writeset_tree_info()
417 vt->context = md; in setup_writeset_tree_info()
418 vt->size = sizeof(struct writeset_disk); in setup_writeset_tree_info()
419 vt->inc = ws_inc; in setup_writeset_tree_info()
420 vt->dec = ws_dec; in setup_writeset_tree_info()
421 vt->equal = ws_eq; in setup_writeset_tree_info()
426 struct dm_btree_value_type vt; in setup_era_array_info() local
428 vt.context = NULL; in setup_era_array_info()
429 vt.size = sizeof(__le32); in setup_era_array_info()
430 vt.inc = NULL; in setup_era_array_info()
431 vt.dec = NULL; in setup_era_array_info()
432 vt.equal = NULL; in setup_era_array_info()
434 dm_array_info_init(&md->era_array_info, md->tm, &vt); in setup_era_array_info()
439 dm_disk_bitset_init(md->tm, &md->bitset_info); in setup_infos()
444 /*----------------------------------------------------------------*/
450 r = dm_tm_create_with_sm(md->bm, SUPERBLOCK_LOCATION, in create_fresh_metadata()
451 &md->tm, &md->sm); in create_fresh_metadata()
459 r = dm_btree_empty(&md->writeset_tree_info, &md->writeset_tree_root); in create_fresh_metadata()
465 r = dm_array_empty(&md->era_array_info, &md->era_array_root); in create_fresh_metadata()
474 dm_sm_destroy(md->sm); in create_fresh_metadata()
475 dm_tm_destroy(md->tm); in create_fresh_metadata()
485 r = dm_sm_root_size(md->sm, &metadata_len); in save_sm_root()
489 return dm_sm_copy_root(md->sm, &md->metadata_space_map_root, in save_sm_root()
495 memcpy(&disk->metadata_space_map_root, in copy_sm_root()
496 &md->metadata_space_map_root, in copy_sm_root()
497 sizeof(md->metadata_space_map_root)); in copy_sm_root()
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()
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()
546 return dm_tm_commit(md->tm, sblock); in write_superblock()
562 dm_sm_destroy(md->sm); in format_metadata()
563 dm_tm_destroy(md->tm); in format_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()
588 r = -EINVAL; in open_metadata()
592 r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION, in open_metadata()
593 disk->metadata_space_map_root, in open_metadata()
594 sizeof(disk->metadata_space_map_root), in open_metadata()
595 &md->tm, &md->sm); 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()
610 md->archived_writesets = true; in open_metadata()
627 r = superblock_all_zeroes(md->bm, &unformatted); in open_or_format_metadata()
632 return may_format ? format_metadata(md) : -EPERM; in open_or_format_metadata()
642 md->bm = dm_block_manager_create(md->bdev, DM_ERA_METADATA_BLOCK_SIZE, in create_persistent_data_objects()
644 if (IS_ERR(md->bm)) { in create_persistent_data_objects()
646 return PTR_ERR(md->bm); in create_persistent_data_objects()
651 dm_block_manager_destroy(md->bm); in create_persistent_data_objects()
658 dm_sm_destroy(md->sm); in destroy_persistent_data_objects()
659 dm_tm_destroy(md->tm); in destroy_persistent_data_objects()
660 dm_block_manager_destroy(md->bm); in destroy_persistent_data_objects()
668 rcu_assign_pointer(md->current_writeset, new_writeset); in swap_writeset()
673 *------------------------------------------------------------------------
679 *------------------------------------------------------------------------
698 uint64_t key = d->era; in metadata_digest_remove_writeset()
700 r = dm_btree_remove(&md->writeset_tree_info, md->writeset_tree_root, in metadata_digest_remove_writeset()
701 &key, &md->writeset_tree_root); in metadata_digest_remove_writeset()
707 d->step = metadata_digest_lookup_writeset; in metadata_digest_remove_writeset()
718 unsigned int b, e = min(d->current_bit + INSERTS_PER_STEP, d->nr_bits); in metadata_digest_transcribe_writeset()
720 for (b = d->current_bit; b < e; b++) { in metadata_digest_transcribe_writeset()
721 r = writeset_marked_on_disk(&d->info, &d->writeset, b, &marked); in metadata_digest_transcribe_writeset()
730 __dm_bless_for_disk(&d->value); in metadata_digest_transcribe_writeset()
731 r = dm_array_set_value(&md->era_array_info, md->era_array_root, in metadata_digest_transcribe_writeset()
732 b, &d->value, &md->era_array_root); in metadata_digest_transcribe_writeset()
739 if (b == d->nr_bits) in metadata_digest_transcribe_writeset()
740 d->step = metadata_digest_remove_writeset; in metadata_digest_transcribe_writeset()
742 d->current_bit = b; in metadata_digest_transcribe_writeset()
754 r = dm_btree_find_lowest_key(&md->writeset_tree_info, in metadata_digest_lookup_writeset()
755 md->writeset_tree_root, &key); in metadata_digest_lookup_writeset()
759 d->era = key; in metadata_digest_lookup_writeset()
761 r = dm_btree_lookup(&md->writeset_tree_info, in metadata_digest_lookup_writeset()
762 md->writeset_tree_root, &key, &disk); in metadata_digest_lookup_writeset()
764 if (r == -ENODATA) { in metadata_digest_lookup_writeset()
765 d->step = NULL; in metadata_digest_lookup_writeset()
773 ws_unpack(&disk, &d->writeset); in metadata_digest_lookup_writeset()
774 d->value = cpu_to_le32(key); in metadata_digest_lookup_writeset()
780 dm_disk_bitset_init(md->tm, &d->info); in metadata_digest_lookup_writeset()
782 d->nr_bits = min(d->writeset.nr_bits, md->nr_blocks); in metadata_digest_lookup_writeset()
783 d->current_bit = 0; in metadata_digest_lookup_writeset()
784 d->step = metadata_digest_transcribe_writeset; in metadata_digest_lookup_writeset()
791 if (d->step) in metadata_digest_start()
795 d->step = metadata_digest_lookup_writeset; in metadata_digest_start()
801 *-----------------------------------------------------------------
804 *-----------------------------------------------------------------
816 md->bdev = bdev; in metadata_open()
817 md->block_size = block_size; in metadata_open()
819 md->writesets[0].md.root = INVALID_WRITESET_ROOT; in metadata_open()
820 md->writesets[1].md.root = INVALID_WRITESET_ROOT; in metadata_open()
821 md->current_writeset = &md->writesets[0]; in metadata_open()
834 writeset_free(&md->writesets[0]); in metadata_close()
835 writeset_free(&md->writesets[1]); in metadata_close()
844 * further to 2^31 - 1 in valid_nr_blocks()
858 return -EINVAL; in metadata_resize()
861 writeset_free(&md->writesets[0]); in metadata_resize()
862 writeset_free(&md->writesets[1]); in metadata_resize()
864 r = writeset_alloc(&md->writesets[0], *new_size); in metadata_resize()
870 r = writeset_alloc(&md->writesets[1], *new_size); in metadata_resize()
873 writeset_free(&md->writesets[0]); in metadata_resize()
879 r = dm_array_resize(&md->era_array_info, md->era_array_root, in metadata_resize()
880 md->nr_blocks, *new_size, in metadata_resize()
881 &value, &md->era_array_root); in metadata_resize()
884 writeset_free(&md->writesets[0]); in metadata_resize()
885 writeset_free(&md->writesets[1]); in metadata_resize()
889 md->nr_blocks = *new_size; in metadata_resize()
899 r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root, in metadata_era_archive()
900 &md->current_writeset->md.root); in metadata_era_archive()
906 ws_pack(&md->current_writeset->md, &value); in metadata_era_archive()
908 keys[0] = md->current_era; in metadata_era_archive()
910 r = dm_btree_insert(&md->writeset_tree_info, md->writeset_tree_root, in metadata_era_archive()
911 keys, &value, &md->writeset_tree_root); in metadata_era_archive()
918 md->current_writeset->md.root = INVALID_WRITESET_ROOT; in metadata_era_archive()
919 md->archived_writesets = true; in metadata_era_archive()
926 return (md->current_writeset == &md->writesets[0]) ? in next_writeset()
927 &md->writesets[1] : &md->writesets[0]; in next_writeset()
935 r = writeset_init(&md->bitset_info, new_writeset, md->nr_blocks); in metadata_new_era()
942 md->current_era++; in metadata_new_era()
951 if (md->current_writeset->md.root != INVALID_WRITESET_ROOT) { in metadata_era_rollover()
976 ws = rcu_dereference(md->current_writeset); in metadata_current_marked()
988 if (md->current_writeset->md.root != INVALID_WRITESET_ROOT) { in metadata_commit()
989 r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root, in metadata_commit()
990 &md->current_writeset->md.root); in metadata_commit()
997 r = dm_tm_pre_commit(md->tm); in metadata_commit()
1017 return dm_tm_commit(md->tm, sblock); in metadata_commit()
1037 if (md->metadata_snap != SUPERBLOCK_LOCATION) { in metadata_take_snap()
1039 return -EINVAL; in metadata_take_snap()
1054 r = dm_sm_inc_block(md->sm, SUPERBLOCK_LOCATION); in metadata_take_snap()
1060 r = dm_tm_shadow_block(md->tm, SUPERBLOCK_LOCATION, in metadata_take_snap()
1064 dm_sm_dec_block(md->sm, SUPERBLOCK_LOCATION); in metadata_take_snap()
1069 r = dm_sm_inc_block(md->sm, md->writeset_tree_root); in metadata_take_snap()
1072 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1076 r = dm_sm_inc_block(md->sm, md->era_array_root); in metadata_take_snap()
1079 dm_sm_dec_block(md->sm, md->writeset_tree_root); in metadata_take_snap()
1080 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1084 md->metadata_snap = dm_block_location(clone); in metadata_take_snap()
1086 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1098 if (md->metadata_snap == SUPERBLOCK_LOCATION) { in metadata_drop_snap()
1100 return -EINVAL; in metadata_drop_snap()
1103 r = dm_tm_read_lock(md->tm, md->metadata_snap, &sb_validator, &clone); in metadata_drop_snap()
1113 md->metadata_snap = SUPERBLOCK_LOCATION; in metadata_drop_snap()
1116 r = dm_btree_del(&md->writeset_tree_info, in metadata_drop_snap()
1117 le64_to_cpu(disk->writeset_tree_root)); in metadata_drop_snap()
1120 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1124 r = dm_array_del(&md->era_array_info, le64_to_cpu(disk->era_array_root)); in metadata_drop_snap()
1127 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1132 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1134 return dm_sm_dec_block(md->sm, location); in metadata_drop_snap()
1150 r = dm_sm_get_nr_free(md->sm, &nr_free); in metadata_get_stats()
1156 r = dm_sm_get_nr_blocks(md->sm, &nr_total); in metadata_get_stats()
1162 s->used = nr_total - nr_free; in metadata_get_stats()
1163 s->total = nr_total; in metadata_get_stats()
1164 s->snap = md->metadata_snap; in metadata_get_stats()
1165 s->era = md->current_era; in metadata_get_stats()
1170 /*----------------------------------------------------------------*/
1208 *---------------------------------------------------------------
1210 *---------------------------------------------------------------
1214 return era->sectors_per_block_shift >= 0; in block_size_is_power_of_two()
1219 sector_t block_nr = bio->bi_iter.bi_sector; in get_block()
1222 (void) sector_div(block_nr, era->sectors_per_block); in get_block()
1224 block_nr >>= era->sectors_per_block_shift; in get_block()
1231 bio_set_dev(bio, era->origin_dev->bdev); in remap_to_origin()
1235 *--------------------------------------------------------------
1237 *--------------------------------------------------------------
1241 if (!atomic_read(&era->suspended)) in wake_worker()
1242 queue_work(era->wq, &era->worker); in wake_worker()
1249 if (!era->digest.step) in process_old_eras()
1252 r = era->digest.step(era->md, &era->digest); in process_old_eras()
1255 era->digest.step = NULL; in process_old_eras()
1257 } else if (era->digest.step) in process_old_eras()
1269 struct writeset *ws = era->md->current_writeset; in process_deferred_bios()
1274 spin_lock(&era->deferred_lock); in process_deferred_bios()
1275 bio_list_merge_init(&deferred_bios, &era->deferred_bios); in process_deferred_bios()
1276 spin_unlock(&era->deferred_lock); in process_deferred_bios()
1282 r = writeset_test_and_set(&era->md->bitset_info, ws, in process_deferred_bios()
1297 r = metadata_commit(era->md); in process_deferred_bios()
1309 * Only update the in-core writeset if the on-disk one in process_deferred_bios()
1313 set_bit(get_block(era, bio), ws->bits); in process_deferred_bios()
1328 spin_lock(&era->rpc_lock); in process_rpc_calls()
1329 list_splice_init(&era->rpc_calls, &calls); in process_rpc_calls()
1330 spin_unlock(&era->rpc_lock); in process_rpc_calls()
1333 rpc->result = rpc->fn0 ? rpc->fn0(era->md) : rpc->fn1(era->md, rpc->arg); in process_rpc_calls()
1338 r = metadata_commit(era->md); in process_rpc_calls()
1341 rpc->result = r; in process_rpc_calls()
1345 complete(&rpc->complete); in process_rpc_calls()
1350 if (era->md->archived_writesets) { in kick_off_digest()
1351 era->md->archived_writesets = false; in kick_off_digest()
1352 metadata_digest_start(era->md, &era->digest); in kick_off_digest()
1368 spin_lock(&era->deferred_lock); in defer_bio()
1369 bio_list_add(&era->deferred_bios, bio); in defer_bio()
1370 spin_unlock(&era->deferred_lock); in defer_bio()
1380 rpc->result = 0; in perform_rpc()
1381 init_completion(&rpc->complete); in perform_rpc()
1383 spin_lock(&era->rpc_lock); in perform_rpc()
1384 list_add(&rpc->list, &era->rpc_calls); in perform_rpc()
1385 spin_unlock(&era->rpc_lock); in perform_rpc()
1388 wait_for_completion(&rpc->complete); in perform_rpc()
1390 return rpc->result; in perform_rpc()
1417 atomic_set(&era->suspended, 0); in start_worker()
1422 atomic_set(&era->suspended, 1); in stop_worker()
1423 drain_workqueue(era->wq); in stop_worker()
1427 *--------------------------------------------------------------
1429 *--------------------------------------------------------------
1433 if (era->md) in era_destroy()
1434 metadata_close(era->md); in era_destroy()
1436 if (era->wq) in era_destroy()
1437 destroy_workqueue(era->wq); in era_destroy()
1439 if (era->origin_dev) in era_destroy()
1440 dm_put_device(era->ti, era->origin_dev); in era_destroy()
1442 if (era->metadata_dev) in era_destroy()
1443 dm_put_device(era->ti, era->metadata_dev); in era_destroy()
1450 return dm_sector_div_up(era->ti->len, era->sectors_per_block); in calc_nr_blocks()
1456 bool multiple_of_min_block_size = (block_size & (MIN_BLOCK_SIZE - 1)) == 0; in valid_block_size()
1472 ti->error = "Invalid argument count"; in era_ctr()
1473 return -EINVAL; in era_ctr()
1478 ti->error = "Error allocating era structure"; in era_ctr()
1479 return -ENOMEM; in era_ctr()
1482 era->ti = ti; in era_ctr()
1485 &era->metadata_dev); in era_ctr()
1487 ti->error = "Error opening metadata device"; in era_ctr()
1489 return -EINVAL; in era_ctr()
1493 &era->origin_dev); in era_ctr()
1495 ti->error = "Error opening data device"; in era_ctr()
1497 return -EINVAL; in era_ctr()
1500 r = sscanf(argv[2], "%u%c", &era->sectors_per_block, &dummy); in era_ctr()
1502 ti->error = "Error parsing block size"; in era_ctr()
1504 return -EINVAL; in era_ctr()
1507 r = dm_set_target_max_io_len(ti, era->sectors_per_block); in era_ctr()
1509 ti->error = "could not set max io len"; in era_ctr()
1511 return -EINVAL; in era_ctr()
1514 if (!valid_block_size(era->sectors_per_block)) { in era_ctr()
1515 ti->error = "Invalid block size"; in era_ctr()
1517 return -EINVAL; in era_ctr()
1519 if (era->sectors_per_block & (era->sectors_per_block - 1)) in era_ctr()
1520 era->sectors_per_block_shift = -1; in era_ctr()
1522 era->sectors_per_block_shift = __ffs(era->sectors_per_block); in era_ctr()
1524 md = metadata_open(era->metadata_dev->bdev, era->sectors_per_block, true); in era_ctr()
1526 ti->error = "Error reading metadata"; in era_ctr()
1530 era->md = md; in era_ctr()
1532 era->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM); in era_ctr()
1533 if (!era->wq) { in era_ctr()
1534 ti->error = "could not create workqueue for metadata object"; in era_ctr()
1536 return -ENOMEM; in era_ctr()
1538 INIT_WORK(&era->worker, do_work); in era_ctr()
1540 spin_lock_init(&era->deferred_lock); in era_ctr()
1541 bio_list_init(&era->deferred_bios); in era_ctr()
1543 spin_lock_init(&era->rpc_lock); in era_ctr()
1544 INIT_LIST_HEAD(&era->rpc_calls); in era_ctr()
1546 ti->private = era; in era_ctr()
1547 ti->num_flush_bios = 1; in era_ctr()
1548 ti->flush_supported = true; in era_ctr()
1550 ti->num_discard_bios = 1; in era_ctr()
1557 era_destroy(ti->private); in era_dtr()
1562 struct era *era = ti->private; in era_map()
1575 if (!(bio->bi_opf & REQ_PREFLUSH) && in era_map()
1577 !metadata_current_marked(era->md, block)) { in era_map()
1588 struct era *era = ti->private; in era_postsuspend()
1598 r = metadata_commit(era->md); in era_postsuspend()
1608 struct era *era = ti->private; in era_preresume()
1611 if (era->nr_blocks != new_size) { in era_preresume()
1612 r = metadata_resize(era->md, &new_size); in era_preresume()
1618 r = metadata_commit(era->md); in era_preresume()
1624 era->nr_blocks = new_size; in era_preresume()
1642 * <current era> <held metadata root | '-'>
1648 struct era *era = ti->private; in era_status()
1668 DMEMIT(" -"); in era_status()
1672 format_dev_t(buf, era->metadata_dev->bdev->bd_dev); in era_status()
1674 format_dev_t(buf, era->origin_dev->bdev->bd_dev); in era_status()
1675 DMEMIT("%s %u", buf, era->sectors_per_block); in era_status()
1692 struct era *era = ti->private; in era_message()
1696 return -EINVAL; in era_message()
1709 return -EINVAL; in era_message()
1714 return bdev_nr_sectors(dev->bdev); in get_dev_size()
1720 struct era *era = ti->private; in era_iterate_devices()
1722 return fn(ti, era->origin_dev, 0, get_dev_size(era->origin_dev), data); in era_iterate_devices()
1727 struct era *era = ti->private; in era_io_hints()
1728 uint64_t io_opt_sectors = limits->io_opt >> SECTOR_SHIFT; in era_io_hints()
1731 * If the system-determined stacked limits are compatible with the in era_io_hints()
1734 if (io_opt_sectors < era->sectors_per_block || in era_io_hints()
1735 do_div(io_opt_sectors, era->sectors_per_block)) { in era_io_hints()
1736 limits->io_min = 0; in era_io_hints()
1737 limits->io_opt = era->sectors_per_block << SECTOR_SHIFT; in era_io_hints()
1741 /*----------------------------------------------------------------*/