ftl: Added initialization module

This patch adds OCSSD device initialization consisting of the
following:
 * retrieving SSD's geometry and its state
 * verifying configuration
 * initializing core structures (L2P, bands, write buffer, write
 pointers, bad block tables, etc)
 * initializing threads

Change-Id: Ieb643f78035702e834b9ef7830a3db215e35bfb7
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Signed-off-by: Jakub Radtke <jakub.radtke@intel.com>
Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/431326
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Wojciech Malikowski 2018-10-29 09:59:34 -04:00 committed by Jim Harris
parent 8b9ccc1419
commit 5c3591c72e
6 changed files with 1060 additions and 8 deletions

View File

@ -72,9 +72,6 @@ struct spdk_ftl_conf {
/* Trace enabled flag */ /* Trace enabled flag */
int trace; int trace;
/* Trace file name */
const char *trace_path;
/* Maximum IO depth per band relocate */ /* Maximum IO depth per band relocate */
size_t max_reloc_qdepth; size_t max_reloc_qdepth;

View File

@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = ftl_band.c ftl_core.c ftl_debug.c ftl_io.c ftl_rwb.c ftl_reloc.c \ C_SRCS = ftl_band.c ftl_core.c ftl_debug.c ftl_io.c ftl_rwb.c ftl_reloc.c \
ftl_anm.c ftl_restore.c ftl_anm.c ftl_restore.c ftl_init.c
LIBNAME = ftl LIBNAME = ftl

View File

@ -321,13 +321,13 @@ _ftl_io_erase(void *ctx)
static bool static bool
ftl_check_core_thread(const struct spdk_ftl_dev *dev) ftl_check_core_thread(const struct spdk_ftl_dev *dev)
{ {
return dev->core_thread.tid == pthread_self(); return dev->core_thread.thread == spdk_get_thread();
} }
static bool static bool
ftl_check_read_thread(const struct spdk_ftl_dev *dev) ftl_check_read_thread(const struct spdk_ftl_dev *dev)
{ {
return dev->read_thread.tid == pthread_self(); return dev->read_thread.thread == spdk_get_thread();
} }
int int

View File

@ -86,8 +86,6 @@ struct ftl_thread {
/* Thread on which the poller is running */ /* Thread on which the poller is running */
struct spdk_thread *thread; struct spdk_thread *thread;
/* Thread id */
pthread_t tid;
/* Poller */ /* Poller */
struct spdk_poller *poller; struct spdk_poller *poller;

1055
lib/ftl/ftl_init.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -106,6 +106,8 @@ void ftl_trace_limits(struct ftl_trace *trace, const size_t *limits, size_t num_
#else #else
#define ftl_trace(fn, trace, ...) #define ftl_trace(fn, trace, ...)
#define ftl_trace_alloc_group(trace) FTL_TRACE_INVALID_ID #define ftl_trace_alloc_group(trace) FTL_TRACE_INVALID_ID
#define ftl_trace_init() NULL
#define ftl_trace_free(t)
#endif #endif
#endif /* FTL_TRACE_H */ #endif /* FTL_TRACE_H */