diff --git a/lib/ftl/ftl_core.h b/lib/ftl/ftl_core.h index bdb6b75a5..cdb877c08 100644 --- a/lib/ftl/ftl_core.h +++ b/lib/ftl/ftl_core.h @@ -75,12 +75,6 @@ struct ftl_stats { uint64_t limits[SPDK_FTL_LIMIT_MAX]; }; -struct ftl_punit { - struct spdk_ftl_dev *dev; - - struct ftl_addr start_addr; -}; - struct ftl_thread { /* Owner */ struct spdk_ftl_dev *dev; @@ -183,9 +177,6 @@ struct spdk_ftl_dev { /* Statistics */ struct ftl_stats stats; - /* Array of parallel units */ - struct ftl_punit *punits; - /* Current sequence number */ uint64_t seq; diff --git a/lib/ftl/ftl_init.c b/lib/ftl/ftl_init.c index cd9cd6823..f8ddd7be5 100644 --- a/lib/ftl/ftl_init.c +++ b/lib/ftl/ftl_init.c @@ -200,12 +200,12 @@ ftl_retrieve_chunk_info(struct spdk_ftl_dev *dev, struct ftl_addr addr, } static int -ftl_retrieve_punit_chunk_info(struct spdk_ftl_dev *dev, const struct ftl_punit *punit, +ftl_retrieve_punit_chunk_info(struct spdk_ftl_dev *dev, unsigned int punit, struct spdk_ocssd_chunk_information_entry *info) { uint32_t i = 0; unsigned int num_entries = FTL_BLOCK_SIZE / sizeof(*info); - struct ftl_addr chunk_addr = punit->start_addr; + struct ftl_addr chunk_addr = { .pu = punit }; char addr_buf[128]; for (i = 0; i < dev->geo.num_chk; i += num_entries, chunk_addr.zone_id += num_entries) { @@ -266,10 +266,8 @@ ftl_dev_init_bands(struct spdk_ftl_dev *dev) { struct spdk_ocssd_chunk_information_entry *info; struct ftl_band *band, *pband; - struct ftl_punit *punit; struct ftl_zone *zone; unsigned int i, j; - char buf[128]; int rc = 0; LIST_INIT(&dev->free_bands); @@ -322,13 +320,8 @@ ftl_dev_init_bands(struct spdk_ftl_dev *dev) } for (i = 0; i < ftl_dev_num_punits(dev); ++i) { - punit = &dev->punits[i]; - - rc = ftl_retrieve_punit_chunk_info(dev, punit, info); + rc = ftl_retrieve_punit_chunk_info(dev, i, info); if (rc) { - SPDK_ERRLOG("Failed to retrieve bbt for @addr: %s [%lu]\n", - ftl_addr2str(punit->start_addr, buf, sizeof(buf)), - ftl_addr_addr_pack(dev, punit->start_addr)); goto out; } @@ -359,25 +352,6 @@ out: return rc; } -static int -ftl_dev_init_punits(struct spdk_ftl_dev *dev) -{ - size_t i; - - dev->punits = calloc(ftl_dev_num_punits(dev), sizeof(*dev->punits)); - if (!dev->punits) { - return -1; - } - - for (i = 0; i < ftl_dev_num_punits(dev); ++i) { - dev->punits[i].dev = dev; - dev->punits[i].start_addr.addr = 0; - dev->punits[i].start_addr.pu = i; - } - - return 0; -} - static int ftl_dev_retrieve_geo(struct spdk_ftl_dev *dev) { @@ -1090,11 +1064,6 @@ spdk_ftl_dev_init(const struct spdk_ftl_dev_init_opts *_opts, spdk_ftl_init_fn c goto fail_sync; } - if (ftl_dev_init_punits(dev)) { - SPDK_ERRLOG("Unable to initialize LUNs\n"); - goto fail_sync; - } - if (ftl_init_lba_map_pools(dev)) { SPDK_ERRLOG("Unable to init LBA map pools\n"); goto fail_sync; @@ -1225,7 +1194,6 @@ ftl_dev_free_sync(struct spdk_ftl_dev *dev) ftl_reloc_free(dev->reloc); free(dev->name); - free(dev->punits); free(dev->bands); free(dev->l2p); free(dev); diff --git a/test/unit/lib/ftl/common/utils.c b/test/unit/lib/ftl/common/utils.c index aa2de32a3..c6caa2b81 100644 --- a/test/unit/lib/ftl/common/utils.c +++ b/test/unit/lib/ftl/common/utils.c @@ -58,19 +58,11 @@ test_init_ftl_dev(const struct spdk_ocssd_geometry_data *geo) dev->bands = calloc(geo->num_chk, sizeof(*dev->bands)); SPDK_CU_ASSERT_FATAL(dev->bands != NULL); - dev->punits = calloc(ftl_dev_num_punits(dev), sizeof(*dev->punits)); - SPDK_CU_ASSERT_FATAL(dev->punits != NULL); - dev->lba_pool = spdk_mempool_create("ftl_ut", 2, 0x18000, SPDK_MEMPOOL_DEFAULT_CACHE_SIZE, SPDK_ENV_SOCKET_ID_ANY); SPDK_CU_ASSERT_FATAL(dev->lba_pool != NULL); - for (size_t i = 0; i < ftl_dev_num_punits(dev); ++i) { - dev->punits[i].dev = dev; - dev->punits[i].start_addr.pu = i; - } - LIST_INIT(&dev->free_bands); LIST_INIT(&dev->shut_bands); @@ -107,7 +99,7 @@ test_init_ftl_band(struct spdk_ftl_dev *dev, size_t id) zone = &band->zone_buf[i]; zone->pos = i; zone->state = SPDK_BDEV_ZONE_STATE_CLOSED; - zone->start_addr = dev->punits[i].start_addr; + zone->start_addr.pu = i; zone->start_addr.zone_id = band->id; CIRCLEQ_INSERT_TAIL(&band->zones, zone, circleq); band->num_zones++; @@ -125,7 +117,6 @@ test_free_ftl_dev(struct spdk_ftl_dev *dev) spdk_thread_exit(dev->core_thread.thread); spdk_thread_destroy(dev->core_thread.thread); spdk_mempool_free(dev->lba_pool); - free(dev->punits); free(dev->bands); free(dev); }