Commit 0e33da49 authored by Kozlowski Mateusz's avatar Kozlowski Mateusz Committed by Jim Harris
Browse files

ftl: fast shutdown



Adds API for fast shutdown - the ability for FTL to skip most
of the metadata persists made during clean shutdown, and relying
on their representation in shared memory instead. This allows for
faster update of SPDK (or just FTL, assuming no metadata changes),
with downtime reduction from 2-5 seconds to 500-1000 ms (for
14TiB+800GiB base and cache drives).

Signed-off-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: default avatarKozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: I5999d31698a81512db8d5893eabee7b505c80d06
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13348


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 811a027e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4742,6 +4742,7 @@ cache | Required | string | Name of the cache device
uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load

#### Result

@@ -4796,6 +4797,7 @@ cache | Required | string | Name of the cache device
uuid                    | Required | string      | UUID of restored bdev
core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load

#### Result

@@ -4845,6 +4847,7 @@ This RPC is subject to change.
Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Required | string      | Bdev name
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data during deletion and rely on shared memory during next load

#### Example

@@ -4882,6 +4885,7 @@ This RPC is subject to change.
Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Required | string      | Bdev name
fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data during deletion and rely on shared memory during next load

#### Example

+10 −0
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ struct spdk_ftl_conf {

	/* Name of cache block device (must support extended metadata) */
	char					*cache_bdev;
	/* Enable fast shutdown path */
	bool					fast_shutdown;
};

enum spdk_ftl_mode {
@@ -205,6 +207,14 @@ int spdk_ftl_writev(struct spdk_ftl_dev *dev, struct ftl_io *io, struct spdk_io_
 */
size_t spdk_ftl_io_size(void);

/**
 * Enable fast shutdown.
 *
 * During fast shutdown FTL will keep the necessary metadata in shared memory instead
 * of serializing it to storage. This allows for shorter downtime during upgrade process.
 */
void spdk_ftl_dev_set_fast_shutdown(struct spdk_ftl_dev *dev, bool fast_shutdown);

#ifdef __cplusplus
}
#endif
+7 −0
Original line number Diff line number Diff line
@@ -564,6 +564,13 @@ spdk_ftl_fini(void)
	spdk_free(g_ftl_read_buf);
}

void
spdk_ftl_dev_set_fast_shutdown(struct spdk_ftl_dev *dev, bool fast_shutdown)
{
	assert(dev);
	dev->conf.fast_shutdown = fast_shutdown;
}

struct spdk_io_channel *
spdk_ftl_get_io_channel(struct spdk_ftl_dev *dev)
{
+6 −5
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ ftl_mngt_deinit_md(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mngt)

	for (i = 0; i < FTL_LAYOUT_REGION_TYPE_MAX; i++, region++) {
		if (layout->md[i]) {
			ftl_md_destroy(layout->md[i]);
			ftl_md_destroy(layout->md[i], ftl_md_destroy_region_flags(dev, layout->region[i].type));
			layout->md[i] = NULL;
		}
	}
@@ -238,7 +238,7 @@ ftl_mngt_md_deinit_vss_emu(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mn
	struct ftl_layout *layout = &dev->layout;

	if (layout->md[FTL_LAYOUT_REGION_TYPE_VSS]) {
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_VSS]);
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_VSS], 0);
		layout->md[FTL_LAYOUT_REGION_TYPE_VSS] = NULL;
	}

@@ -314,16 +314,17 @@ ftl_mngt_superblock_deinit(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mn
	struct ftl_layout *layout = &dev->layout;

	if (layout->md[FTL_LAYOUT_REGION_TYPE_SB]) {
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_SB]);
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_SB],
			       ftl_md_destroy_region_flags(dev, FTL_LAYOUT_REGION_TYPE_SB));
		layout->md[FTL_LAYOUT_REGION_TYPE_SB] = NULL;
	}

	if (layout->md[FTL_LAYOUT_REGION_TYPE_SB_BASE]) {
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_SB_BASE]);
		ftl_md_destroy(layout->md[FTL_LAYOUT_REGION_TYPE_SB_BASE], 0);
		layout->md[FTL_LAYOUT_REGION_TYPE_SB_BASE] = NULL;
	}

	ftl_md_destroy(dev->sb_shm_md);
	ftl_md_destroy(dev->sb_shm_md, ftl_md_destroy_shm_flags(dev));
	dev->sb_shm_md = NULL;
	dev->sb_shm = NULL;

+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ ftl_mngt_deinit_mem_pools(struct spdk_ftl_dev *dev, struct ftl_mngt_process *mng
	}

	if (dev->p2l_pool_md) {
		ftl_md_destroy(dev->p2l_pool_md);
		ftl_md_destroy(dev->p2l_pool_md, ftl_md_destroy_shm_flags(dev));
		dev->p2l_pool_md = NULL;
	}

Loading