Commit 17cf101b authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Jim Harris
Browse files

lib/ftl: Abandonment of FTL VSS EMU



Vss emulation was meant to allow for executing FTL on top of non-vss
drives with some caveats (not being power failure safe being the main
issue). However the following patches are adding the logic necessary to
run a fully functional FTL on such drives, so the code here is
abandoned.

Change-Id: I7da2af756662aa8549e979a4803848ed913e17e3
Signed-off-by: default avatarMariusz Barczak <Mariusz.Barczak@solidigmtechnology.com>
Signed-off-by: default avatarMateusz Kozlowski <mateusz.kozlowski@solidigm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18547


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
parent 20c3c166
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -179,8 +179,7 @@ Both interfaces require the same arguments which are described by the `--help` o

- bdev's name
- base bdev's name
- cache bdev's name (cache bdev must support VSS DIX mode - could be emulated by providing SPDK_FTL_VSS_EMU=1 flag to make;
 emulating VSS should be done for testing purposes only, it is not power-fail safe)
- cache bdev's name (cache bdev must support VSS DIX mode)
- UUID of the FTL device (if the FTL is to be restored from the SSD)

## FTL bdev stack {#ftl_bdev_stack}
+0 −4
Original line number Diff line number Diff line
@@ -9,10 +9,6 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 7
SO_MINOR := 0

ifdef SPDK_FTL_VSS_EMU
CFLAGS += -DSPDK_FTL_VSS_EMU
endif

ifdef SPDK_FTL_RETRY_ON_ERROR
CFLAGS += -DSPDK_FTL_RETRY_ON_ERROR
endif
+1 −47
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright 2023 Solidigm All Rights Reserved
 *   Copyright (C) 2022 Intel Corporation.
 *   All rights reserved.
 */
@@ -152,16 +153,6 @@ setup_layout_nvc(struct spdk_ftl_dev *dev)
		"p2l3"
	};

#ifdef SPDK_FTL_VSS_EMU
	/* Skip the already init`d VSS region */
	region = &layout->region[FTL_LAYOUT_REGION_TYPE_VSS];
	offset += region->current.blocks;

	if (offset >= layout->nvc.total_blocks) {
		goto error;
	}
#endif

	/* Skip the superblock region. Already init`d in ftl_layout_setup_superblock */
	region = &layout->region[FTL_LAYOUT_REGION_TYPE_SB];
	offset += region->current.blocks;
@@ -478,35 +469,6 @@ ftl_layout_setup(struct spdk_ftl_dev *dev)
	return 0;
}

#ifdef SPDK_FTL_VSS_EMU
void
ftl_layout_setup_vss_emu(struct spdk_ftl_dev *dev)
{
	const struct spdk_bdev *bdev;
	struct ftl_layout *layout = &dev->layout;
	struct ftl_layout_region *region = &layout->region[FTL_LAYOUT_REGION_TYPE_VSS];

	assert(layout->md[FTL_LAYOUT_REGION_TYPE_VSS] == NULL);

	region = &layout->region[FTL_LAYOUT_REGION_TYPE_VSS];
	region->type = FTL_LAYOUT_REGION_TYPE_VSS;
	region->name = "vss";
	region->current.version = region->prev.version = 0;
	region->current.offset = 0;

	bdev = spdk_bdev_desc_get_bdev(dev->nv_cache.bdev_desc);
	layout->nvc.total_blocks = spdk_bdev_get_num_blocks(bdev);
	region->current.blocks = blocks_region(dev, dev->nv_cache.md_size * layout->nvc.total_blocks);

	region->vss_blksz = 0;
	region->bdev_desc = dev->nv_cache.bdev_desc;
	region->ioch = dev->nv_cache.cache_ioch;

	assert(region->bdev_desc != NULL);
	assert(region->ioch != NULL);
}
#endif

int
ftl_layout_setup_superblock(struct spdk_ftl_dev *dev)
{
@@ -524,14 +486,6 @@ ftl_layout_setup_superblock(struct spdk_ftl_dev *dev)
	region->prev.version = FTL_SB_VERSION_CURRENT;
	region->current.offset = 0;

	/*
	 * VSS region must go first in case SB to make calculating its relative size easier
	 */
#ifdef SPDK_FTL_VSS_EMU
	region->current.offset = layout->region[FTL_LAYOUT_REGION_TYPE_VSS].current.offset +
				 layout->region[FTL_LAYOUT_REGION_TYPE_VSS].current.blocks;
#endif

	region->current.blocks = superblock_region_blocks(dev);
	region->vss_blksz = 0;
	region->bdev_desc = dev->nv_cache.bdev_desc;
+1 −13
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright 2023 Solidigm All Rights Reserved
 *   Copyright (C) 2022 Intel Corporation.
 *   All rights reserved.
 */
@@ -55,13 +56,7 @@ enum ftl_layout_region_type {
	/* Mirrored information about trim */
	FTL_LAYOUT_REGION_TYPE_TRIM_MD_MIRROR = 15,

#ifndef SPDK_FTL_VSS_EMU
	FTL_LAYOUT_REGION_TYPE_MAX = 16
#else
	/* VSS region for NV cache VSS emulation */
	FTL_LAYOUT_REGION_TYPE_VSS = 16,
	FTL_LAYOUT_REGION_TYPE_MAX = 17,
#endif
};

/* last nvc/base region in terms of lba address space */
@@ -173,13 +168,6 @@ int ftl_layout_setup(struct spdk_ftl_dev *dev);
 */
int ftl_layout_setup_superblock(struct spdk_ftl_dev *dev);

#ifdef SPDK_FTL_VSS_EMU
/**
 * @brief Setup FTL layout of VSS emu
 */
void ftl_layout_setup_vss_emu(struct spdk_ftl_dev *dev);
#endif

void ftl_layout_dump(struct spdk_ftl_dev *dev);
int ftl_validate_regions(struct spdk_ftl_dev *dev, struct ftl_layout *layout);

+4 −5
Original line number Diff line number Diff line
@@ -1066,8 +1066,7 @@ nv_cache_write(void *_io)
	struct ftl_nv_cache *nv_cache = &dev->nv_cache;
	int rc;

	rc = ftl_nv_cache_bdev_writev_blocks_with_md(dev,
			nv_cache->bdev_desc, nv_cache->cache_ioch,
	rc = spdk_bdev_writev_blocks_with_md(nv_cache->bdev_desc, nv_cache->cache_ioch,
					     io->iov, io->iov_cnt, io->md,
					     ftl_addr_to_nvc_offset(dev, io->addr), io->num_blocks,
					     ftl_nv_cache_submit_cb, io);
Loading