Commit 769984a9 authored by Artur Paszkiewicz's avatar Artur Paszkiewicz Committed by Tomasz Zawadzki
Browse files

ftl: core structure



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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent 81dca288
Loading
Loading
Loading
Loading

include/spdk/ftl.h

0 → 100644
+24 −0
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 */

#ifndef SPDK_FTL_H
#define SPDK_FTL_H

#include "spdk/stdinc.h"
#include "spdk/uuid.h"
#include "spdk/thread.h"
#include "spdk/bdev.h"

#ifdef __cplusplus
extern "C" {
#endif

struct spdk_ftl_dev;

#ifdef __cplusplus
}
#endif

#endif /* SPDK_FTL_H */
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ DIRS-y += bdev blob blobfs conf dma accel event json jsonrpc \
          log lvol rpc sock thread trace util nvme vmd nvmf scsi \
          ioat ut_mock iscsi notify init trace_parser
ifeq ($(OS),Linux)
DIRS-y += nbd
DIRS-y += nbd ftl
endif

DIRS-$(CONFIG_OCF) += env_ocf
+4 −3
Original line number Diff line number Diff line
@@ -6,11 +6,12 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 4
SO_VER := 5
SO_MINOR := 0

C_SRCS = ftl_band.c ftl_core.c ftl_debug.c ftl_io.c ftl_reloc.c \
	 ftl_restore.c ftl_init.c ftl_trace.c
CFLAGS += -I.

C_SRCS = ftl_core.c

SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_ftl.map)

lib/ftl/ftl_core.c

0 → 100644
+17 −0
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 */

#include "spdk/likely.h"
#include "spdk/stdinc.h"
#include "spdk/nvme.h"
#include "spdk/thread.h"
#include "spdk/bdev_module.h"
#include "spdk/string.h"
#include "spdk/ftl.h"
#include "spdk/crc32.h"

#include "ftl_core.h"

SPDK_LOG_REGISTER_COMPONENT(ftl_core)

lib/ftl/ftl_core.h

0 → 100644
+93 −0
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (c) Intel Corporation.
 *   All rights reserved.
 */

#ifndef FTL_CORE_H
#define FTL_CORE_H

#include "spdk/stdinc.h"
#include "spdk/uuid.h"
#include "spdk/thread.h"
#include "spdk/util.h"
#include "spdk/likely.h"
#include "spdk/queue.h"
#include "spdk/ftl.h"
#include "spdk/bdev.h"
#include "spdk/bdev_zone.h"
#include "spdk/log.h"

struct spdk_ftl_dev {
	/* Device instance */
	struct spdk_uuid		uuid;

	/* Device name */
	char				*name;

	/* Underlying device */
	struct spdk_bdev_desc		*base_bdev_desc;

	/* Cache device */
	struct spdk_bdev_desc		*cache_bdev_desc;

	/* Cache VSS metadata size */
	uint64_t			cache_md_size;

	/* Cached properties of the underlying device */
	uint64_t			num_blocks_in_band;
	uint64_t			num_zones_in_band;
	uint64_t			num_blocks_in_zone;
	bool				is_zoned;

	/* Indicates the device is fully initialized */
	bool				initialized;

	/* Indicates the device is about to be stopped */
	bool				halt;

	/* counters for poller busy, include
	   1. nv cache read/write
	   2. metadata read/write
	   3. base bdev read/write */
	uint64_t			io_activity_total;

	/* Number of operational bands */
	uint64_t			num_bands;

	/* Number of free bands */
	uint64_t			num_free;

	/* Size of the l2p table */
	uint64_t			num_lbas;

	/* Metadata size */
	uint64_t			md_size;

	/* Transfer unit size */
	uint64_t			xfer_size;

	/* Inflight IO operations */
	uint32_t			num_inflight;

	/* Thread on which the poller is running */
	struct spdk_thread		*core_thread;

	/* IO channel to the FTL device, used for internal management operations
	 * consuming FTL's external API
	 */
	struct spdk_io_channel		*ioch;

	/* Underlying device IO channel */
	struct spdk_io_channel		*base_ioch;

	/* Cache IO channel */
	struct spdk_io_channel		*cache_ioch;

	/* Read submission queue */
	TAILQ_HEAD(, ftl_io)		rd_sq;

	/* Write submission queue */
	TAILQ_HEAD(, ftl_io)		wr_sq;
};

#endif /* FTL_CORE_H */
Loading