From 49cf3861d157a8ea19550aa7cd0c78b4e98035b0 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 15 Sep 2017 16:46:53 -0700 Subject: [PATCH] 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 Change-Id: I0a66dd6bfac9053e0fd6103dee1ea36b20d902df Reviewed-on: https://review.gerrithub.io/378856 Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu Tested-by: SPDK Automated Test System --- lib/bdev/nvme/bdev_nvme.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/bdev/nvme/bdev_nvme.c b/lib/bdev/nvme/bdev_nvme.c index 20bf2db36..a9bb41b35 100644 --- a/lib/bdev/nvme/bdev_nvme.c +++ b/lib/bdev/nvme/bdev_nvme.c @@ -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); } }