ftl: core structure
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com> Change-Id: I5360b43348c8eb7bdfcbc394bb1ac83768dec49f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13408 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
parent
81dca28884
commit
769984a925
24
include/spdk/ftl.h
Normal file
24
include/spdk/ftl.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/* 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 */
|
@ -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 \
|
log lvol rpc sock thread trace util nvme vmd nvmf scsi \
|
||||||
ioat ut_mock iscsi notify init trace_parser
|
ioat ut_mock iscsi notify init trace_parser
|
||||||
ifeq ($(OS),Linux)
|
ifeq ($(OS),Linux)
|
||||||
DIRS-y += nbd
|
DIRS-y += nbd ftl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DIRS-$(CONFIG_OCF) += env_ocf
|
DIRS-$(CONFIG_OCF) += env_ocf
|
||||||
|
@ -6,11 +6,12 @@
|
|||||||
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
||||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||||
|
|
||||||
SO_VER := 4
|
SO_VER := 5
|
||||||
SO_MINOR := 0
|
SO_MINOR := 0
|
||||||
|
|
||||||
C_SRCS = ftl_band.c ftl_core.c ftl_debug.c ftl_io.c ftl_reloc.c \
|
CFLAGS += -I.
|
||||||
ftl_restore.c ftl_init.c ftl_trace.c
|
|
||||||
|
C_SRCS = ftl_core.c
|
||||||
|
|
||||||
SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_ftl.map)
|
SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_ftl.map)
|
||||||
|
|
||||||
|
17
lib/ftl/ftl_core.c
Normal file
17
lib/ftl/ftl_core.c
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/* 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)
|
93
lib/ftl/ftl_core.h
Normal file
93
lib/ftl/ftl_core.h
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/* 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 */
|
5
lib/ftl/spdk_ftl.map
Normal file
5
lib/ftl/spdk_ftl.map
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
# public functions
|
||||||
|
|
||||||
|
local: *;
|
||||||
|
};
|
@ -60,7 +60,7 @@ DEPDIRS-blobfs := log thread blob trace util
|
|||||||
DEPDIRS-event := log util thread $(JSON_LIBS) trace init
|
DEPDIRS-event := log util thread $(JSON_LIBS) trace init
|
||||||
DEPDIRS-init := jsonrpc json log rpc thread util
|
DEPDIRS-init := jsonrpc json log rpc thread util
|
||||||
|
|
||||||
DEPDIRS-ftl := log util thread trace bdev
|
DEPDIRS-ftl := log
|
||||||
DEPDIRS-nbd := log util thread $(JSON_LIBS) bdev
|
DEPDIRS-nbd := log util thread $(JSON_LIBS) bdev
|
||||||
DEPDIRS-nvmf := accel log sock util nvme thread $(JSON_LIBS) trace bdev
|
DEPDIRS-nvmf := accel log sock util nvme thread $(JSON_LIBS) trace bdev
|
||||||
ifeq ($(CONFIG_RDMA),y)
|
ifeq ($(CONFIG_RDMA),y)
|
||||||
|
@ -50,6 +50,7 @@ ifeq ($(OS),Linux)
|
|||||||
BLOCKDEV_MODULES_LIST += bdev_aio
|
BLOCKDEV_MODULES_LIST += bdev_aio
|
||||||
BLOCKDEV_MODULES_PRIVATE_LIBS += -laio
|
BLOCKDEV_MODULES_PRIVATE_LIBS += -laio
|
||||||
INTR_BLOCKDEV_MODULES_LIST += bdev_aio
|
INTR_BLOCKDEV_MODULES_LIST += bdev_aio
|
||||||
|
BLOCKDEV_MODULES_LIST += ftl
|
||||||
ifeq ($(CONFIG_VIRTIO),y)
|
ifeq ($(CONFIG_VIRTIO),y)
|
||||||
BLOCKDEV_MODULES_LIST += bdev_virtio virtio
|
BLOCKDEV_MODULES_LIST += bdev_virtio virtio
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user