copy: Create a separate copy subsystem library

This removes the strict dependency on the SPDK
event framework.

Change-Id: Ie6b6f9585d09ab1df0f25bf33d53e7cdecd83faa
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365281
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-06-12 14:41:05 -07:00
parent 4c0eaac47a
commit 4808ff7957
13 changed files with 96 additions and 12 deletions

View File

@ -46,7 +46,7 @@ CFLAGS += -I$(SPDK_ROOT_DIR)/lib
C_SRCS := iscsi_tgt.c
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev iscsi scsi net copy trace conf
SPDK_LIB_LIST += util log log_rpc event app_rpc

View File

@ -42,7 +42,7 @@ CFLAGS += $(ENV_CFLAGS)
C_SRCS := conf.c nvmf_main.c nvmf_tgt.c nvmf_rpc.c
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += nvmf event log trace conf util bdev copy rpc jsonrpc json
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc

View File

@ -42,7 +42,7 @@ CFLAGS += $(ENV_CFLAGS)
C_SRCS := vhost.c
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev scsi net copy trace conf
SPDK_LIB_LIST += util log log_rpc event app_rpc
SPDK_LIB_LIST += vhost rte_vhost

View File

@ -46,6 +46,9 @@ struct spdk_io_channel;
struct spdk_copy_task;
void spdk_copy_engine_initialize(void);
int spdk_copy_engine_finish(void);
struct spdk_io_channel *spdk_copy_engine_get_io_channel(void);
int64_t spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch, void *dst,
void *src, uint64_t nbytes, spdk_copy_completion_cb cb);

View File

@ -237,7 +237,7 @@ spdk_copy_engine_module_finish(void)
}
}
static void
void
spdk_copy_engine_initialize(void)
{
spdk_copy_engine_module_initialize();
@ -251,7 +251,7 @@ spdk_copy_engine_initialize(void)
spdk_subsystem_init_next(0);
}
static int
int
spdk_copy_engine_finish(void)
{
spdk_copy_engine_module_finish();
@ -259,4 +259,3 @@ spdk_copy_engine_finish(void)
}
SPDK_COPY_MODULE_REGISTER(copy_engine_mem_init, NULL, NULL, copy_engine_mem_get_ctx_size)
SPDK_SUBSYSTEM_REGISTER(copy, spdk_copy_engine_initialize, spdk_copy_engine_finish, NULL)

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += bdev
DIRS-y += bdev copy
.PHONY: all clean $(DIRS-y)

View File

@ -0,0 +1,41 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += $(ENV_CFLAGS) -I.
C_SRCS = copy.c
LIBNAME = event_copy
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -0,0 +1,41 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk/copy_engine.h"
#include "spdk_internal/event.h"
SPDK_SUBSYSTEM_REGISTER(copy, spdk_copy_engine_initialize, spdk_copy_engine_finish, NULL)
SPDK_SUBSYSTEM_DEPEND(bdev, copy)

View File

@ -49,7 +49,7 @@ CXXFLAGS += -fno-profile-arcs -fno-test-coverage
CXXFLAGS += -fno-sanitize=undefined
CXXFLAGS += -fno-sanitize=address
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += blobfs blob bdev blob_bdev copy event util conf trace \
log jsonrpc json rpc

View File

@ -42,7 +42,7 @@ C_SRCS := bdevio.c
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += bdev copy event trace log conf util rpc jsonrpc json
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \

View File

@ -42,7 +42,7 @@ C_SRCS := bdevperf.c
CFLAGS += -I. $(ENV_CFLAGS)
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += bdev copy event trace log conf util rpc jsonrpc json
LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \

View File

@ -41,7 +41,7 @@ APP = fuse
C_SRCS := fuse.c
CFLAGS += $(DPDK_INC)
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += blobfs blob bdev blob_bdev copy event util conf trace \
log jsonrpc json rpc

View File

@ -41,7 +41,7 @@ APP = mkfs
C_SRCS := mkfs.c
CFLAGS += $(DPDK_INC)
SPDK_LIB_LIST = event_bdev
SPDK_LIB_LIST = event_bdev event_copy
SPDK_LIB_LIST += blobfs blob bdev blob_bdev copy event util conf trace \
log jsonrpc json rpc