Lines Matching +full:high +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>
25 /*----------------------------------------------------------------
27 *--------------------------------------------------------------*/
49 vfree(ws->bits); in writeset_free()
74 ws->md.nr_bits = nr_blocks; in writeset_alloc()
75 ws->md.root = INVALID_WRITESET_ROOT; in writeset_alloc()
76 ws->bits = vzalloc(bitset_size(nr_blocks)); in writeset_alloc()
77 if (!ws->bits) { in writeset_alloc()
79 return -ENOMEM; in writeset_alloc()
86 * Wipes the in-core bitset, and creates a new on disk bitset.
92 memset(ws->bits, 0, bitset_size(ws->md.nr_bits)); in writeset_init()
94 r = setup_on_disk_bitset(info, ws->md.nr_bits, &ws->md.root); in writeset_init()
105 return test_bit(block, ws->bits); in writeset_marked()
112 dm_block_t old = m->root; in writeset_marked_on_disk()
118 int r = dm_bitset_test_bit(info, m->root, block, &m->root, result); in writeset_marked_on_disk()
124 BUG_ON(m->root != old); in writeset_marked_on_disk()
137 if (!test_and_set_bit(block, ws->bits)) { in writeset_test_and_set()
138 r = dm_bitset_set_bit(info, ws->md.root, block, &ws->md.root); in writeset_test_and_set()
150 /*----------------------------------------------------------------
152 *--------------------------------------------------------------*/
188 /*----------------------------------------------------------------
190 *--------------------------------------------------------------*/
197 disk->blocknr = cpu_to_le64(dm_block_location(b)); in sb_prepare_for_write()
198 disk->csum = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_prepare_for_write()
199 sb_block_size - sizeof(__le32), in sb_prepare_for_write()
205 uint32_t metadata_version = le32_to_cpu(disk->version); in check_metadata_version()
209 return -EINVAL; in check_metadata_version()
222 if (dm_block_location(b) != le64_to_cpu(disk->blocknr)) { in sb_check()
224 le64_to_cpu(disk->blocknr), in sb_check()
226 return -ENOTBLK; in sb_check()
229 if (le64_to_cpu(disk->magic) != SUPERBLOCK_MAGIC) { in sb_check()
231 le64_to_cpu(disk->magic), in sb_check()
233 return -EILSEQ; in sb_check()
236 csum_le = cpu_to_le32(dm_bm_checksum(&disk->flags, in sb_check()
237 sb_block_size - sizeof(__le32), in sb_check()
239 if (csum_le != disk->csum) { in sb_check()
241 le32_to_cpu(csum_le), le32_to_cpu(disk->csum)); in sb_check()
242 return -EILSEQ; in sb_check()
254 /*----------------------------------------------------------------
256 *--------------------------------------------------------------*/
303 return dm_bm_read_lock(md->bm, SUPERBLOCK_LOCATION, in superblock_read_lock()
310 return dm_bm_write_lock_zero(md->bm, SUPERBLOCK_LOCATION, in superblock_lock_zero()
317 return dm_bm_write_lock(md->bm, SUPERBLOCK_LOCATION, in superblock_lock()
331 * We can't use a validator here - it may be all zeroes. in superblock_all_zeroes()
351 /*----------------------------------------------------------------*/
355 disk->nr_bits = cpu_to_le32(core->nr_bits); in ws_pack()
356 disk->root = cpu_to_le64(core->root); in ws_pack()
361 core->nr_bits = le32_to_cpu(disk->nr_bits); in ws_unpack()
362 core->root = le64_to_cpu(disk->root); in ws_unpack()
374 dm_tm_inc(md->tm, b); in ws_inc()
386 dm_bitset_del(&md->bitset_info, b); in ws_dec()
394 /*----------------------------------------------------------------*/
398 struct dm_btree_value_type *vt = &md->writeset_tree_info.value_type; in setup_writeset_tree_info() local
399 md->writeset_tree_info.tm = md->tm; in setup_writeset_tree_info()
400 md->writeset_tree_info.levels = 1; in setup_writeset_tree_info()
401 vt->context = md; in setup_writeset_tree_info()
402 vt->size = sizeof(struct writeset_disk); in setup_writeset_tree_info()
403 vt->inc = ws_inc; in setup_writeset_tree_info()
404 vt->dec = ws_dec; in setup_writeset_tree_info()
405 vt->equal = ws_eq; in setup_writeset_tree_info()
411 struct dm_btree_value_type vt; in setup_era_array_info() local
412 vt.context = NULL; in setup_era_array_info()
413 vt.size = sizeof(__le32); in setup_era_array_info()
414 vt.inc = NULL; in setup_era_array_info()
415 vt.dec = NULL; in setup_era_array_info()
416 vt.equal = NULL; in setup_era_array_info()
418 dm_array_info_init(&md->era_array_info, md->tm, &vt); in setup_era_array_info()
423 dm_disk_bitset_init(md->tm, &md->bitset_info); in setup_infos()
428 /*----------------------------------------------------------------*/
434 r = dm_tm_create_with_sm(md->bm, SUPERBLOCK_LOCATION, in create_fresh_metadata()
435 &md->tm, &md->sm); in create_fresh_metadata()
443 r = dm_btree_empty(&md->writeset_tree_info, &md->writeset_tree_root); in create_fresh_metadata()
449 r = dm_array_empty(&md->era_array_info, &md->era_array_root); in create_fresh_metadata()
458 dm_sm_destroy(md->sm); in create_fresh_metadata()
459 dm_tm_destroy(md->tm); in create_fresh_metadata()
469 r = dm_sm_root_size(md->sm, &metadata_len); in save_sm_root()
473 return dm_sm_copy_root(md->sm, &md->metadata_space_map_root, in save_sm_root()
479 memcpy(&disk->metadata_space_map_root, in copy_sm_root()
480 &md->metadata_space_map_root, in copy_sm_root()
481 sizeof(md->metadata_space_map_root)); in copy_sm_root()
491 disk->magic = cpu_to_le64(SUPERBLOCK_MAGIC); in prepare_superblock()
492 disk->flags = cpu_to_le32(0ul); in prepare_superblock()
495 memset(disk->uuid, 0, sizeof(disk->uuid)); in prepare_superblock()
496 disk->version = cpu_to_le32(MAX_ERA_VERSION); in prepare_superblock()
500 disk->data_block_size = cpu_to_le32(md->block_size); in prepare_superblock()
501 disk->metadata_block_size = cpu_to_le32(DM_ERA_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); in prepare_superblock()
502 disk->nr_blocks = cpu_to_le32(md->nr_blocks); in prepare_superblock()
503 disk->current_era = cpu_to_le32(md->current_era); in prepare_superblock()
505 ws_pack(&md->current_writeset->md, &disk->current_writeset); in prepare_superblock()
506 disk->writeset_tree_root = cpu_to_le64(md->writeset_tree_root); in prepare_superblock()
507 disk->era_array_root = cpu_to_le64(md->era_array_root); in prepare_superblock()
508 disk->metadata_snap = cpu_to_le64(md->metadata_snap); in prepare_superblock()
530 return dm_tm_commit(md->tm, sblock); in write_superblock()
546 dm_sm_destroy(md->sm); in format_metadata()
547 dm_tm_destroy(md->tm); in format_metadata()
567 r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION, in open_metadata()
568 disk->metadata_space_map_root, in open_metadata()
569 sizeof(disk->metadata_space_map_root), in open_metadata()
570 &md->tm, &md->sm); in open_metadata()
578 md->block_size = le32_to_cpu(disk->data_block_size); in open_metadata()
579 md->nr_blocks = le32_to_cpu(disk->nr_blocks); in open_metadata()
580 md->current_era = le32_to_cpu(disk->current_era); in open_metadata()
582 md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root); in open_metadata()
583 md->era_array_root = le64_to_cpu(disk->era_array_root); in open_metadata()
584 md->metadata_snap = le64_to_cpu(disk->metadata_snap); in open_metadata()
585 md->archived_writesets = true; in open_metadata()
602 r = superblock_all_zeroes(md->bm, &unformatted); in open_or_format_metadata()
607 return may_format ? format_metadata(md) : -EPERM; in open_or_format_metadata()
617 md->bm = dm_block_manager_create(md->bdev, DM_ERA_METADATA_BLOCK_SIZE, in create_persistent_data_objects()
619 if (IS_ERR(md->bm)) { in create_persistent_data_objects()
621 return PTR_ERR(md->bm); in create_persistent_data_objects()
626 dm_block_manager_destroy(md->bm); in create_persistent_data_objects()
633 dm_sm_destroy(md->sm); in destroy_persistent_data_objects()
634 dm_tm_destroy(md->tm); in destroy_persistent_data_objects()
635 dm_block_manager_destroy(md->bm); in destroy_persistent_data_objects()
643 rcu_assign_pointer(md->current_writeset, new_writeset); in swap_writeset()
647 /*----------------------------------------------------------------
653 *--------------------------------------------------------------*/
671 uint64_t key = d->era; in metadata_digest_remove_writeset()
673 r = dm_btree_remove(&md->writeset_tree_info, md->writeset_tree_root, in metadata_digest_remove_writeset()
674 &key, &md->writeset_tree_root); in metadata_digest_remove_writeset()
680 d->step = metadata_digest_lookup_writeset; in metadata_digest_remove_writeset()
691 unsigned b, e = min(d->current_bit + INSERTS_PER_STEP, d->nr_bits); in metadata_digest_transcribe_writeset()
693 for (b = d->current_bit; b < e; b++) { in metadata_digest_transcribe_writeset()
694 r = writeset_marked_on_disk(&d->info, &d->writeset, b, &marked); in metadata_digest_transcribe_writeset()
703 __dm_bless_for_disk(&d->value); in metadata_digest_transcribe_writeset()
704 r = dm_array_set_value(&md->era_array_info, md->era_array_root, in metadata_digest_transcribe_writeset()
705 b, &d->value, &md->era_array_root); in metadata_digest_transcribe_writeset()
712 if (b == d->nr_bits) in metadata_digest_transcribe_writeset()
713 d->step = metadata_digest_remove_writeset; in metadata_digest_transcribe_writeset()
715 d->current_bit = b; in metadata_digest_transcribe_writeset()
727 r = dm_btree_find_lowest_key(&md->writeset_tree_info, in metadata_digest_lookup_writeset()
728 md->writeset_tree_root, &key); in metadata_digest_lookup_writeset()
732 d->era = key; in metadata_digest_lookup_writeset()
734 r = dm_btree_lookup(&md->writeset_tree_info, in metadata_digest_lookup_writeset()
735 md->writeset_tree_root, &key, &disk); in metadata_digest_lookup_writeset()
737 if (r == -ENODATA) { in metadata_digest_lookup_writeset()
738 d->step = NULL; in metadata_digest_lookup_writeset()
746 ws_unpack(&disk, &d->writeset); in metadata_digest_lookup_writeset()
747 d->value = cpu_to_le32(key); in metadata_digest_lookup_writeset()
749 d->nr_bits = min(d->writeset.nr_bits, md->nr_blocks); in metadata_digest_lookup_writeset()
750 d->current_bit = 0; in metadata_digest_lookup_writeset()
751 d->step = metadata_digest_transcribe_writeset; in metadata_digest_lookup_writeset()
758 if (d->step) in metadata_digest_start()
767 dm_disk_bitset_init(md->tm, &d->info); in metadata_digest_start()
768 d->step = metadata_digest_lookup_writeset; in metadata_digest_start()
773 /*----------------------------------------------------------------
774 * High level metadata interface. Target methods should use these, and not
776 *--------------------------------------------------------------*/
787 md->bdev = bdev; in metadata_open()
788 md->block_size = block_size; in metadata_open()
790 md->writesets[0].md.root = INVALID_WRITESET_ROOT; in metadata_open()
791 md->writesets[1].md.root = INVALID_WRITESET_ROOT; in metadata_open()
792 md->current_writeset = &md->writesets[0]; in metadata_open()
813 * further to 2^31 - 1 in valid_nr_blocks()
827 return -EINVAL; in metadata_resize()
830 writeset_free(&md->writesets[0]); in metadata_resize()
831 writeset_free(&md->writesets[1]); in metadata_resize()
833 r = writeset_alloc(&md->writesets[0], *new_size); in metadata_resize()
839 r = writeset_alloc(&md->writesets[1], *new_size); in metadata_resize()
847 r = dm_array_resize(&md->era_array_info, md->era_array_root, in metadata_resize()
848 md->nr_blocks, *new_size, in metadata_resize()
849 &value, &md->era_array_root); in metadata_resize()
855 md->nr_blocks = *new_size; in metadata_resize()
865 r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root, in metadata_era_archive()
866 &md->current_writeset->md.root); in metadata_era_archive()
872 ws_pack(&md->current_writeset->md, &value); in metadata_era_archive()
873 md->current_writeset->md.root = INVALID_WRITESET_ROOT; in metadata_era_archive()
875 keys[0] = md->current_era; in metadata_era_archive()
877 r = dm_btree_insert(&md->writeset_tree_info, md->writeset_tree_root, in metadata_era_archive()
878 keys, &value, &md->writeset_tree_root); in metadata_era_archive()
885 md->archived_writesets = true; in metadata_era_archive()
892 return (md->current_writeset == &md->writesets[0]) ? in next_writeset()
893 &md->writesets[1] : &md->writesets[0]; in next_writeset()
901 r = writeset_init(&md->bitset_info, new_writeset); in metadata_new_era()
908 md->current_era++; in metadata_new_era()
917 if (md->current_writeset->md.root != INVALID_WRITESET_ROOT) { in metadata_era_rollover()
942 ws = rcu_dereference(md->current_writeset); in metadata_current_marked()
954 if (md->current_writeset->md.root != SUPERBLOCK_LOCATION) { in metadata_commit()
955 r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root, in metadata_commit()
956 &md->current_writeset->md.root); in metadata_commit()
963 r = dm_tm_pre_commit(md->tm); in metadata_commit()
983 return dm_tm_commit(md->tm, sblock); in metadata_commit()
1003 if (md->metadata_snap != SUPERBLOCK_LOCATION) { in metadata_take_snap()
1005 return -EINVAL; in metadata_take_snap()
1020 r = dm_sm_inc_block(md->sm, SUPERBLOCK_LOCATION); in metadata_take_snap()
1026 r = dm_tm_shadow_block(md->tm, SUPERBLOCK_LOCATION, in metadata_take_snap()
1030 dm_sm_dec_block(md->sm, SUPERBLOCK_LOCATION); in metadata_take_snap()
1035 r = dm_sm_inc_block(md->sm, md->writeset_tree_root); in metadata_take_snap()
1038 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1042 r = dm_sm_inc_block(md->sm, md->era_array_root); in metadata_take_snap()
1045 dm_sm_dec_block(md->sm, md->writeset_tree_root); in metadata_take_snap()
1046 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1050 md->metadata_snap = dm_block_location(clone); in metadata_take_snap()
1052 dm_tm_unlock(md->tm, clone); in metadata_take_snap()
1064 if (md->metadata_snap == SUPERBLOCK_LOCATION) { in metadata_drop_snap()
1066 return -EINVAL; in metadata_drop_snap()
1069 r = dm_tm_read_lock(md->tm, md->metadata_snap, &sb_validator, &clone); in metadata_drop_snap()
1079 md->metadata_snap = SUPERBLOCK_LOCATION; in metadata_drop_snap()
1082 r = dm_btree_del(&md->writeset_tree_info, in metadata_drop_snap()
1083 le64_to_cpu(disk->writeset_tree_root)); in metadata_drop_snap()
1086 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1090 r = dm_array_del(&md->era_array_info, le64_to_cpu(disk->era_array_root)); in metadata_drop_snap()
1093 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1098 dm_tm_unlock(md->tm, clone); in metadata_drop_snap()
1100 return dm_sm_dec_block(md->sm, location); in metadata_drop_snap()
1116 r = dm_sm_get_nr_free(md->sm, &nr_free); in metadata_get_stats()
1122 r = dm_sm_get_nr_blocks(md->sm, &nr_total); in metadata_get_stats()
1128 s->used = nr_total - nr_free; in metadata_get_stats()
1129 s->total = nr_total; in metadata_get_stats()
1130 s->snap = md->metadata_snap; in metadata_get_stats()
1131 s->era = md->current_era; in metadata_get_stats()
1136 /*----------------------------------------------------------------*/
1173 /*----------------------------------------------------------------
1175 *---------------------------------------------------------------*/
1178 return era->sectors_per_block_shift >= 0; in block_size_is_power_of_two()
1183 sector_t block_nr = bio->bi_iter.bi_sector; in get_block()
1186 (void) sector_div(block_nr, era->sectors_per_block); in get_block()
1188 block_nr >>= era->sectors_per_block_shift; in get_block()
1195 bio_set_dev(bio, era->origin_dev->bdev); in remap_to_origin()
1198 /*----------------------------------------------------------------
1200 *--------------------------------------------------------------*/
1203 if (!atomic_read(&era->suspended)) in wake_worker()
1204 queue_work(era->wq, &era->worker); in wake_worker()
1211 if (!era->digest.step) in process_old_eras()
1214 r = era->digest.step(era->md, &era->digest); in process_old_eras()
1217 era->digest.step = NULL; in process_old_eras()
1219 } else if (era->digest.step) in process_old_eras()
1234 spin_lock(&era->deferred_lock); in process_deferred_bios()
1235 bio_list_merge(&deferred_bios, &era->deferred_bios); in process_deferred_bios()
1236 bio_list_init(&era->deferred_bios); in process_deferred_bios()
1237 spin_unlock(&era->deferred_lock); in process_deferred_bios()
1240 r = writeset_test_and_set(&era->md->bitset_info, in process_deferred_bios()
1241 era->md->current_writeset, in process_deferred_bios()
1257 r = metadata_commit(era->md); in process_deferred_bios()
1278 spin_lock(&era->rpc_lock); in process_rpc_calls()
1279 list_splice_init(&era->rpc_calls, &calls); in process_rpc_calls()
1280 spin_unlock(&era->rpc_lock); in process_rpc_calls()
1283 rpc->result = rpc->fn0 ? rpc->fn0(era->md) : rpc->fn1(era->md, rpc->arg); in process_rpc_calls()
1288 r = metadata_commit(era->md); in process_rpc_calls()
1291 rpc->result = r; in process_rpc_calls()
1295 complete(&rpc->complete); in process_rpc_calls()
1300 if (era->md->archived_writesets) { in kick_off_digest()
1301 era->md->archived_writesets = false; in kick_off_digest()
1302 metadata_digest_start(era->md, &era->digest); in kick_off_digest()
1318 spin_lock(&era->deferred_lock); in defer_bio()
1319 bio_list_add(&era->deferred_bios, bio); in defer_bio()
1320 spin_unlock(&era->deferred_lock); in defer_bio()
1330 rpc->result = 0; in perform_rpc()
1331 init_completion(&rpc->complete); in perform_rpc()
1333 spin_lock(&era->rpc_lock); in perform_rpc()
1334 list_add(&rpc->list, &era->rpc_calls); in perform_rpc()
1335 spin_unlock(&era->rpc_lock); in perform_rpc()
1338 wait_for_completion(&rpc->complete); in perform_rpc()
1340 return rpc->result; in perform_rpc()
1365 atomic_set(&era->suspended, 0); in start_worker()
1370 atomic_set(&era->suspended, 1); in stop_worker()
1371 flush_workqueue(era->wq); in stop_worker()
1374 /*----------------------------------------------------------------
1376 *--------------------------------------------------------------*/
1379 if (era->md) in era_destroy()
1380 metadata_close(era->md); in era_destroy()
1382 if (era->wq) in era_destroy()
1383 destroy_workqueue(era->wq); in era_destroy()
1385 if (era->origin_dev) in era_destroy()
1386 dm_put_device(era->ti, era->origin_dev); in era_destroy()
1388 if (era->metadata_dev) in era_destroy()
1389 dm_put_device(era->ti, era->metadata_dev); in era_destroy()
1396 return dm_sector_div_up(era->ti->len, era->sectors_per_block); in calc_nr_blocks()
1402 bool multiple_of_min_block_size = (block_size & (MIN_BLOCK_SIZE - 1)) == 0; in valid_block_size()
1418 ti->error = "Invalid argument count"; in era_ctr()
1419 return -EINVAL; in era_ctr()
1424 ti->error = "Error allocating era structure"; in era_ctr()
1425 return -ENOMEM; in era_ctr()
1428 era->ti = ti; in era_ctr()
1430 r = dm_get_device(ti, argv[0], FMODE_READ | FMODE_WRITE, &era->metadata_dev); in era_ctr()
1432 ti->error = "Error opening metadata device"; in era_ctr()
1434 return -EINVAL; in era_ctr()
1437 r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &era->origin_dev); in era_ctr()
1439 ti->error = "Error opening data device"; in era_ctr()
1441 return -EINVAL; in era_ctr()
1444 r = sscanf(argv[2], "%u%c", &era->sectors_per_block, &dummy); in era_ctr()
1446 ti->error = "Error parsing block size"; in era_ctr()
1448 return -EINVAL; in era_ctr()
1451 r = dm_set_target_max_io_len(ti, era->sectors_per_block); in era_ctr()
1453 ti->error = "could not set max io len"; in era_ctr()
1455 return -EINVAL; in era_ctr()
1458 if (!valid_block_size(era->sectors_per_block)) { in era_ctr()
1459 ti->error = "Invalid block size"; in era_ctr()
1461 return -EINVAL; in era_ctr()
1463 if (era->sectors_per_block & (era->sectors_per_block - 1)) in era_ctr()
1464 era->sectors_per_block_shift = -1; in era_ctr()
1466 era->sectors_per_block_shift = __ffs(era->sectors_per_block); in era_ctr()
1468 md = metadata_open(era->metadata_dev->bdev, era->sectors_per_block, true); in era_ctr()
1470 ti->error = "Error reading metadata"; in era_ctr()
1474 era->md = md; in era_ctr()
1476 era->nr_blocks = calc_nr_blocks(era); in era_ctr()
1478 r = metadata_resize(era->md, &era->nr_blocks); in era_ctr()
1480 ti->error = "couldn't resize metadata"; in era_ctr()
1482 return -ENOMEM; in era_ctr()
1485 era->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM); in era_ctr()
1486 if (!era->wq) { in era_ctr()
1487 ti->error = "could not create workqueue for metadata object"; in era_ctr()
1489 return -ENOMEM; in era_ctr()
1491 INIT_WORK(&era->worker, do_work); in era_ctr()
1493 spin_lock_init(&era->deferred_lock); in era_ctr()
1494 bio_list_init(&era->deferred_bios); in era_ctr()
1496 spin_lock_init(&era->rpc_lock); in era_ctr()
1497 INIT_LIST_HEAD(&era->rpc_calls); in era_ctr()
1499 ti->private = era; in era_ctr()
1500 ti->num_flush_bios = 1; in era_ctr()
1501 ti->flush_supported = true; in era_ctr()
1503 ti->num_discard_bios = 1; in era_ctr()
1510 era_destroy(ti->private); in era_dtr()
1515 struct era *era = ti->private; in era_map()
1528 if (!(bio->bi_opf & REQ_PREFLUSH) && in era_map()
1530 !metadata_current_marked(era->md, block)) { in era_map()
1541 struct era *era = ti->private; in era_postsuspend()
1555 struct era *era = ti->private; in era_preresume()
1558 if (era->nr_blocks != new_size) { in era_preresume()
1563 era->nr_blocks = new_size; in era_preresume()
1581 * <current era> <held metadata root | '-'>
1587 struct era *era = ti->private; in era_status()
1607 DMEMIT(" -"); in era_status()
1611 format_dev_t(buf, era->metadata_dev->bdev->bd_dev); in era_status()
1613 format_dev_t(buf, era->origin_dev->bdev->bd_dev); in era_status()
1614 DMEMIT("%s %u", buf, era->sectors_per_block); in era_status()
1627 struct era *era = ti->private; in era_message()
1631 return -EINVAL; in era_message()
1644 return -EINVAL; in era_message()
1649 return i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT; in get_dev_size()
1655 struct era *era = ti->private; in era_iterate_devices()
1656 return fn(ti, era->origin_dev, 0, get_dev_size(era->origin_dev), data); in era_iterate_devices()
1661 struct era *era = ti->private; in era_io_hints()
1662 uint64_t io_opt_sectors = limits->io_opt >> SECTOR_SHIFT; in era_io_hints()
1665 * If the system-determined stacked limits are compatible with the in era_io_hints()
1668 if (io_opt_sectors < era->sectors_per_block || in era_io_hints()
1669 do_div(io_opt_sectors, era->sectors_per_block)) { in era_io_hints()
1671 blk_limits_io_opt(limits, era->sectors_per_block << SECTOR_SHIFT); in era_io_hints()
1675 /*----------------------------------------------------------------*/