Commit ddc63f07 authored by Jim Harris's avatar Jim Harris Committed by Changpeng Liu
Browse files

bdev: change spdk_bdev_free_io return type to void



Change the checks to asserts instead.  No callers ever
checked the return codes, and if they did, there's
nothing they can do to recover from an error status.

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

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


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent ef1402a0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -881,14 +881,13 @@ int spdk_bdev_nvme_io_passthru_md(struct spdk_bdev_desc *bdev_desc,
				  spdk_bdev_io_completion_cb cb, void *cb_arg);

/**
 * Free an I/O request. This should be called after the callback for the I/O has
 * been called and notifies the bdev layer that memory may now be released.
 * Free an I/O request. This should only be called after the completion callback
 * for the I/O has been called and notifies the bdev layer that memory may now
 * be released.
 *
 * \param bdev_io I/O request.
 *
 * \return -1 on failure, 0 on success.
 */
int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io);
void spdk_bdev_free_io(struct spdk_bdev_io *bdev_io);

/**
 * Return I/O statistics for this channel.
+5 −21
Original line number Diff line number Diff line
@@ -935,11 +935,14 @@ spdk_bdev_get_io(struct spdk_bdev_channel *channel)
	return bdev_io;
}

static void
spdk_bdev_put_io(struct spdk_bdev_io *bdev_io)
void
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
{
	struct spdk_bdev_mgmt_channel *ch = bdev_io->ch->shared_resource->mgmt_ch;

	assert(bdev_io != NULL);
	assert(bdev_io->status != SPDK_BDEV_IO_STATUS_PENDING);

	if (bdev_io->buf != NULL) {
		spdk_bdev_io_put_buf(bdev_io);
	}
@@ -2277,25 +2280,6 @@ spdk_bdev_nvme_io_passthru_md(struct spdk_bdev_desc *desc, struct spdk_io_channe
	return 0;
}

int
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
{
	if (!bdev_io) {
		SPDK_ERRLOG("bdev_io is NULL\n");
		return -1;
	}

	if (bdev_io->status == SPDK_BDEV_IO_STATUS_PENDING) {
		SPDK_ERRLOG("bdev_io is in pending state\n");
		assert(false);
		return -1;
	}

	spdk_bdev_put_io(bdev_io);

	return 0;
}

static void
_spdk_bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
{
+1 −2
Original line number Diff line number Diff line
@@ -164,9 +164,8 @@ spdk_bdev_nvme_io_passthru(struct spdk_bdev_desc *desc,
	return 0;
}

int spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
void spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
{
	return -1;
}

const char *spdk_nvmf_subsystem_get_nqn(struct spdk_nvmf_subsystem *subsystem)
+1 −2
Original line number Diff line number Diff line
@@ -123,11 +123,10 @@ spdk_dma_free(void *buf)
	free(buf);
}

int
void
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
{
	CU_ASSERT(0);
	return -1;
}

int
+1 −2
Original line number Diff line number Diff line
@@ -79,11 +79,10 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty
	return false;
}

int
void
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
{
	CU_ASSERT(0);
	return -1;
}

const char *
Loading