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: Jim Harris <james.r.harris@intel.com> Change-Id: I96d6804d61dfbf6030b3cc78ea59981301417421 Reviewed-on: https://review.gerrithub.io/415539 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
ef1402a0f0
commit
ddc63f077a
@ -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.
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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 *
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include "spdk/bdev_module.h"
|
||||
#include "spdk/env.h"
|
||||
|
||||
DEFINE_STUB(spdk_bdev_free_io, int, (struct spdk_bdev_io *bdev_io), 0);
|
||||
DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *bdev_io));
|
||||
DEFINE_STUB(spdk_bdev_readv, int, (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb,
|
||||
void *cb_arg), 0);
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "spdk/env.h"
|
||||
|
||||
|
||||
DEFINE_STUB(spdk_bdev_free_io, int, (struct spdk_bdev_io *bdev_io), 0);
|
||||
DEFINE_STUB_V(spdk_bdev_free_io, (struct spdk_bdev_io *bdev_io));
|
||||
DEFINE_STUB(spdk_bdev_readv, int, (struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
struct iovec *iov, int iovcnt, uint64_t offset, uint64_t nbytes, spdk_bdev_io_completion_cb cb,
|
||||
void *cb_arg), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user