Commit 3213962e authored by Jim Harris's avatar Jim Harris
Browse files

reduce: replace ziperrno with reduce_errno



ziperrno was left over from earlier versions of this
patch set that used "sbzip" instead of "reduce".

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I4159141b92727bb0a24db5f9aefcccaadc360d9e

Reviewed-on: https://review.gerrithub.io/436399


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent fdaea1fa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -96,12 +96,12 @@ int64_t spdk_reduce_get_backing_device_size(struct spdk_reduce_vol_params *param

struct spdk_reduce_vol;

typedef void (*spdk_reduce_vol_op_complete)(void *ctx, int ziperrno);
typedef void (*spdk_reduce_vol_op_complete)(void *ctx, int reduce_errno);
typedef void (*spdk_reduce_vol_op_with_handle_complete)(void *ctx,
		struct spdk_reduce_vol *vol,
		int ziperrno);
		int reduce_errno);

typedef void (*spdk_reduce_dev_cpl)(void *cb_arg, int ziperrno);
typedef void (*spdk_reduce_dev_cpl)(void *cb_arg, int reduce_errno);

struct spdk_reduce_vol_cb_args {
	spdk_reduce_dev_cpl	cb_fn;
+4 −4
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ _init_load_cleanup(struct spdk_reduce_vol *vol, struct reduce_init_load_ctx *ctx
}

static void
_init_write_super_cpl(void *cb_arg, int ziperrno)
_init_write_super_cpl(void *cb_arg, int reduce_errno)
{
	struct reduce_init_load_ctx *init_ctx = cb_arg;
	int rc;
@@ -307,7 +307,7 @@ _init_write_super_cpl(void *cb_arg, int ziperrno)
		return;
	}

	init_ctx->cb_fn(init_ctx->cb_arg, init_ctx->vol, ziperrno);
	init_ctx->cb_fn(init_ctx->cb_arg, init_ctx->vol, reduce_errno);
	/* Only clean up the ctx - the vol has been passed to the application
	 *  for use now that initialization was successful.
	 */
@@ -315,7 +315,7 @@ _init_write_super_cpl(void *cb_arg, int ziperrno)
}

static void
_init_write_path_cpl(void *cb_arg, int ziperrno)
_init_write_path_cpl(void *cb_arg, int reduce_errno)
{
	struct reduce_init_load_ctx *init_ctx = cb_arg;
	struct spdk_reduce_vol *vol = init_ctx->vol;
@@ -511,7 +511,7 @@ spdk_reduce_vol_init(struct spdk_reduce_vol_params *params,
}

static void
_load_read_super_and_path_cpl(void *cb_arg, int ziperrno)
_load_read_super_and_path_cpl(void *cb_arg, int reduce_errno)
{
	struct reduce_init_load_ctx *load_ctx = cb_arg;
	struct spdk_reduce_vol *vol = load_ctx->vol;
+27 −27
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
#include "common/lib/test_env.c"

static struct spdk_reduce_vol *g_vol;
static int g_ziperrno;
static int g_reduce_errno;
static char *g_volatile_pm_buf;
static size_t g_volatile_pm_buf_len;
static char *g_persistent_pm_buf;
@@ -199,23 +199,23 @@ persistent_pm_buf_destroy(void)
}

static void
init_cb(void *cb_arg, struct spdk_reduce_vol *vol, int ziperrno)
init_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno)
{
	g_vol = vol;
	g_ziperrno = ziperrno;
	g_reduce_errno = reduce_errno;
}

static void
load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int ziperrno)
load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno)
{
	g_vol = vol;
	g_ziperrno = ziperrno;
	g_reduce_errno = reduce_errno;
}

static void
unload_cb(void *cb_arg, int ziperrno)
unload_cb(void *cb_arg, int reduce_errno)
{
	g_ziperrno = ziperrno;
	g_reduce_errno = reduce_errno;
}

static void
@@ -233,9 +233,9 @@ init_failure(void)

	/* backing_dev and pm_file have an invalid size.  This should fail. */
	g_vol = NULL;
	g_ziperrno = 0;
	g_reduce_errno = 0;
	spdk_reduce_vol_init(&params, &backing_dev, TEST_MD_PATH, init_cb, NULL);
	CU_ASSERT(g_ziperrno == -EINVAL);
	CU_ASSERT(g_reduce_errno == -EINVAL);
	SPDK_CU_ASSERT_FATAL(g_vol == NULL);

	/* backing_dev now has valid size, but backing_dev still has null
@@ -244,9 +244,9 @@ init_failure(void)
	backing_dev.blockcnt = spdk_reduce_get_backing_device_size(&params) / backing_dev.blocklen;

	g_vol = NULL;
	g_ziperrno = 0;
	g_reduce_errno = 0;
	spdk_reduce_vol_init(&params, &backing_dev, TEST_MD_PATH, init_cb, NULL);
	CU_ASSERT(g_ziperrno == -EINVAL);
	CU_ASSERT(g_reduce_errno == -EINVAL);
	SPDK_CU_ASSERT_FATAL(g_vol == NULL);
}

@@ -341,9 +341,9 @@ init_md(void)
	backing_dev_init(&backing_dev, &params);

	g_vol = NULL;
	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_init(&params, &backing_dev, TEST_MD_PATH, init_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	SPDK_CU_ASSERT_FATAL(g_vol != NULL);
	/* Confirm that reduce persisted the params to metadata. */
	CU_ASSERT(memcmp(g_persistent_pm_buf, SPDK_REDUCE_SIGNATURE, 8) == 0);
@@ -367,10 +367,10 @@ init_md(void)
	CU_ASSERT(spdk_uuid_parse(&uuid, &g_path[strlen(TEST_MD_PATH) + 1]) == 0);
	CU_ASSERT(spdk_uuid_compare(&uuid, spdk_reduce_vol_get_uuid(g_vol)) == 0);

	g_ziperrno = -1;
	g_reduce_errno = -1;
	g_backing_dev_closed = false;
	spdk_reduce_vol_unload(g_vol, unload_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	CU_ASSERT(g_backing_dev_closed == true);
	CU_ASSERT(g_volatile_pm_buf == NULL);

@@ -395,9 +395,9 @@ init_backing_dev(void)

	g_vol = NULL;
	g_path = NULL;
	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_init(&params, &backing_dev, TEST_MD_PATH, init_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	SPDK_CU_ASSERT_FATAL(g_vol != NULL);
	SPDK_CU_ASSERT_FATAL(g_path != NULL);
	/* Confirm that libreduce persisted the params to the backing device. */
@@ -412,10 +412,10 @@ init_backing_dev(void)
			  g_backing_dev_buf + REDUCE_BACKING_DEV_PATH_OFFSET,
			  REDUCE_PATH_MAX) == 0);

	g_ziperrno = -1;
	g_reduce_errno = -1;
	g_backing_dev_closed = false;
	spdk_reduce_vol_unload(g_vol, unload_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	CU_ASSERT(g_backing_dev_closed == true);

	persistent_pm_buf_destroy();
@@ -438,22 +438,22 @@ load(void)
	backing_dev_init(&backing_dev, &params);

	g_vol = NULL;
	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_init(&params, &backing_dev, TEST_MD_PATH, init_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	SPDK_CU_ASSERT_FATAL(g_vol != NULL);
	SPDK_CU_ASSERT_FATAL(g_path != NULL);
	memcpy(pmem_file_path, g_path, sizeof(pmem_file_path));

	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_unload(g_vol, unload_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);

	g_vol = NULL;
	g_path = NULL;
	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_load(&backing_dev, load_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);
	SPDK_CU_ASSERT_FATAL(g_vol != NULL);
	SPDK_CU_ASSERT_FATAL(g_path != NULL);
	CU_ASSERT(strncmp(g_path, pmem_file_path, sizeof(pmem_file_path)) == 0);
@@ -461,9 +461,9 @@ load(void)
	CU_ASSERT(g_vol->params.chunk_size == params.chunk_size);
	CU_ASSERT(g_vol->params.backing_io_unit_size == params.backing_io_unit_size);

	g_ziperrno = -1;
	g_reduce_errno = -1;
	spdk_reduce_vol_unload(g_vol, unload_cb, NULL);
	CU_ASSERT(g_ziperrno == 0);
	CU_ASSERT(g_reduce_errno == 0);

	persistent_pm_buf_destroy();
	backing_dev_destroy(&backing_dev);