bdev/nvme: clean up submit_request return codes

Some of the internal functions used to return the
number of bytes associated with a successfully submitted
IO, but that was changed a while ago to just return 0
for success.

So change some of the callers of these functions to
just look for != 0 for failure rather than < 0.  This
preps for some upcoming ENOMEM handling changes.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0a66dd6bfac9053e0fd6103dee1ea36b20d902df

Reviewed-on: https://review.gerrithub.io/378856
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2017-09-15 16:46:53 -07:00
parent d5b441e0dd
commit 49cf3861d1

View File

@ -43,6 +43,7 @@
#include "spdk/nvme.h"
#include "spdk/io_channel.h"
#include "spdk/string.h"
#include "spdk/likely.h"
#include "spdk_internal/bdev.h"
#include "spdk_internal/log.h"
@ -345,7 +346,7 @@ bdev_nvme_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
bdev_io->u.bdev.num_blocks,
bdev_io->u.bdev.offset_blocks);
if (ret < 0) {
if (ret != 0) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
}
}
@ -422,7 +423,9 @@ _bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_
static void
bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
{
if (_bdev_nvme_submit_request(ch, bdev_io) < 0) {
int rc = _bdev_nvme_submit_request(ch, bdev_io);
if (spdk_unlikely(rc != 0)) {
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
}
}