bdev/rbd: Still use rbd_aio_read/write if iovcnt=1
In most cases, there is single element for iov array, so using rbd_aio_read/write is enough. Signed-off-by: Ziye Yang <ziye.yang@intel.com> Change-Id: Id3ccbb4a4ff10be9d4546c8e89e6dc596d0f3a72 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4122 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
90477acc7c
commit
e699355434
@ -47,6 +47,7 @@
|
||||
#include "spdk/json.h"
|
||||
#include "spdk/string.h"
|
||||
#include "spdk/util.h"
|
||||
#include "spdk/likely.h"
|
||||
|
||||
#include "spdk/bdev_module.h"
|
||||
#include "spdk_internal/log.h"
|
||||
@ -255,9 +256,17 @@ bdev_rbd_start_aio(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
||||
if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
|
||||
rbd_io = (struct bdev_rbd_io *)bdev_io->driver_ctx;
|
||||
rbd_io->total_len = len;
|
||||
ret = rbd_aio_readv(image, iov, iovcnt, offset, comp);
|
||||
if (spdk_likely(iovcnt == 1)) {
|
||||
ret = rbd_aio_read(image, offset, iov[0].iov_len, iov[0].iov_base, comp);
|
||||
} else {
|
||||
ret = rbd_aio_readv(image, iov, iovcnt, offset, comp);
|
||||
}
|
||||
} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_WRITE) {
|
||||
ret = rbd_aio_writev(image, iov, iovcnt, offset, comp);
|
||||
if (spdk_likely(iovcnt == 1)) {
|
||||
ret = rbd_aio_write(image, offset, iov[0].iov_len, iov[0].iov_base, comp);
|
||||
} else {
|
||||
ret = rbd_aio_writev(image, iov, iovcnt, offset, comp);
|
||||
}
|
||||
} else if (bdev_io->type == SPDK_BDEV_IO_TYPE_FLUSH) {
|
||||
ret = rbd_aio_flush(image, comp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user