Commit 5b63b8a4 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

copy_engine: rename spdk_copy_module_get_max_ctx_size() to spdk_copy_task_size()



Make the public API clearer - if the user wants to allocate a
spdk_copy_task directly, they need to allocate spdk_copy_task_size()
bytes.

Also change the return type to size_t for consistency.

Change-Id: I0f3757056757c510421d680c5b4532edd9bc2561
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 945217d2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#ifndef SPDK_COPY_ENGINE_H
#define SPDK_COPY_ENGINE_H

#include <stddef.h>
#include <stdint.h>

typedef void (*spdk_copy_completion_cb)(void *ref, int status);
@@ -51,6 +52,6 @@ int64_t spdk_copy_submit(struct spdk_copy_task *copy_req, struct spdk_io_channel
			 void *src, uint64_t nbytes, spdk_copy_completion_cb cb);
int64_t spdk_copy_submit_fill(struct spdk_copy_task *copy_req, struct spdk_io_channel *ch,
			      void *dst, uint8_t fill, uint64_t nbytes, spdk_copy_completion_cb cb);
int spdk_copy_module_get_max_ctx_size(void);
size_t spdk_copy_task_size(void);

#endif
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ struct spdk_copy_module_if {
	 */
	void	(*config_text)(FILE *fp);

	int	(*get_ctx_size)(void);
	size_t	(*get_ctx_size)(void);
	TAILQ_ENTRY(spdk_copy_module_if)	tailq;
};

+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ static void blockdev_malloc_get_spdk_running_config(FILE *fp);
static int
blockdev_malloc_get_ctx_size(void)
{
	return sizeof(struct malloc_task) + spdk_copy_module_get_max_ctx_size();
	return sizeof(struct malloc_task) + spdk_copy_task_size();
}

SPDK_BDEV_MODULE_REGISTER(blockdev_malloc_initialize, blockdev_malloc_finish,
+4 −3
Original line number Diff line number Diff line
@@ -154,16 +154,17 @@ static struct spdk_io_channel *mem_get_io_channel(uint32_t priority)
	return spdk_get_io_channel(&memcpy_copy_engine, priority, false, NULL);
}

static int
static size_t
copy_engine_mem_get_ctx_size(void)
{
	return sizeof(struct spdk_copy_task);
}

int spdk_copy_module_get_max_ctx_size(void)
size_t
spdk_copy_task_size(void)
{
	struct spdk_copy_module_if *copy_engine;
	int max_copy_module_size = 0;
	size_t max_copy_module_size = 0;

	TAILQ_FOREACH(copy_engine, &spdk_copy_module_list, tailq) {
		if (copy_engine->get_ctx_size && copy_engine->get_ctx_size() > max_copy_module_size) {
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ struct ioat_task {
static int copy_engine_ioat_init(void);
static void copy_engine_ioat_exit(void);

static int
static size_t
copy_engine_ioat_get_ctx_size(void)
{
	return sizeof(struct ioat_task) + sizeof(struct spdk_copy_task);