Commit 35875d53 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

bdev/rbd: combine readv and writev functions



These are identical now that the spdk_bdev_io I/O-specific unions were
combined.

Change-Id: I2579f4fd100c5ebb3550b806c7fdac38c6160a69
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382373


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 847c1c3a
Loading
Loading
Loading
Loading
+18 −30
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ SPDK_BDEV_MODULE_REGISTER(rbd, bdev_rbd_library_init, bdev_rbd_library_fini, NUL
			  bdev_rbd_get_ctx_size, NULL)

static int64_t
bdev_rbd_readv(struct bdev_rbd *disk, struct spdk_io_channel *ch,
bdev_rbd_rw(struct bdev_rbd *disk, struct spdk_io_channel *ch,
	    struct spdk_bdev_io *bdev_io, struct iovec *iov,
	    int iovcnt, size_t len, uint64_t offset)
{
@@ -223,19 +223,6 @@ bdev_rbd_readv(struct bdev_rbd *disk, struct spdk_io_channel *ch,
	return bdev_rbd_start_aio(rbdio_ch->image, bdev_io, iov->iov_base, offset, len);
}

static int64_t
bdev_rbd_writev(struct bdev_rbd *disk, struct spdk_io_channel *ch,
		struct spdk_bdev_io *bdev_io, struct iovec *iov,
		int iovcnt, size_t len, uint64_t offset)
{
	struct bdev_rbd_io_channel *rbdio_ch = spdk_io_channel_get_ctx(ch);

	if ((iovcnt != 1) || (iov->iov_len != len))
		return -1;

	return bdev_rbd_start_aio(rbdio_ch->image, bdev_io, (void *)iov->iov_base, offset, len);
}

static int64_t
bdev_rbd_flush(struct bdev_rbd *disk, struct spdk_io_channel *ch,
	       struct spdk_bdev_io *bdev_io, uint64_t offset, uint64_t nbytes)
@@ -255,7 +242,7 @@ static void bdev_rbd_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io
{
	int ret;

	ret = bdev_rbd_readv(bdev_io->bdev->ctxt,
	ret = bdev_rbd_rw(bdev_io->bdev->ctxt,
			  ch,
			  bdev_io,
			  bdev_io->u.bdev.iovs,
@@ -277,13 +264,14 @@ static int _bdev_rbd_submit_request(struct spdk_io_channel *ch, struct spdk_bdev
		return 0;

	case SPDK_BDEV_IO_TYPE_WRITE:
		return bdev_rbd_writev((struct bdev_rbd *)bdev_io->bdev->ctxt,
		return bdev_rbd_rw((struct bdev_rbd *)bdev_io->bdev->ctxt,
				   ch,
				   bdev_io,
				   bdev_io->u.bdev.iovs,
				   bdev_io->u.bdev.iovcnt,
				   bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen,
				   bdev_io->u.bdev.offset_blocks * bdev_io->bdev->blocklen);

	case SPDK_BDEV_IO_TYPE_FLUSH:
		return bdev_rbd_flush((struct bdev_rbd *)bdev_io->bdev->ctxt,
				      ch,