Commit 6b8415a4 authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Tomasz Zawadzki
Browse files

lib/ftl: Add is_chunk_active to NV cache device



Using the new function, the implementation of the NV cache can
deactivate chunks that cannot be used for caching. For example, when
they will be used to store metadata.

Change-Id: I4a4c25ce276cbbf364a57587494e76e1b90eeec1
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/+/19598


Reviewed-by: default avatarArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 26f3b551
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@ is_bdev_compatible(struct spdk_ftl_dev *dev, struct spdk_bdev *bdev)
	return true;
}

static bool
is_chunk_active(struct spdk_ftl_dev *dev, struct ftl_nv_cache_chunk *chunk)
{
	return true;
}

static void
md_region_setup(struct spdk_ftl_dev *dev, enum ftl_layout_region_type reg_type,
		struct ftl_layout_region *region)
@@ -112,7 +118,7 @@ struct ftl_nv_cache_device_type nvc_bdev_vss = {
	},
	.ops = {
		.is_bdev_compatible = is_bdev_compatible,

		.is_chunk_active = is_chunk_active,
		.md_layout_ops = {
			.region_create = md_region_create,
			.region_open = md_region_open,
+12 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@

struct spdk_ftl_dev;
struct ftl_mngt_process;
struct ftl_nv_cache_chunk;

/**
 * @brief NV Cache device features and capabilities
@@ -36,6 +37,17 @@ struct ftl_nv_cache_device_ops {
	 */
	bool (*is_bdev_compatible)(struct spdk_ftl_dev *dev, struct spdk_bdev *bdev);

	/**
	 * @brief Check if chunk is active and can be used for NV Cache
	 *
	 * @param dev FTL device
	 * @param chunk chunk to be checked
	 *
	 * @retval true if chunk is active
	 * @retval false if chunk is not active
	 */
	bool (*is_chunk_active)(struct spdk_ftl_dev *dev, struct ftl_nv_cache_chunk *chunk);

	struct ftl_md_layout_ops md_layout_ops;
};