bdev: set bdev_io->iovs for all direct IO types

This patch allows unmap bdev_io to
be used with spdk_bdev_io_get_buf.

bdev_io->iovs/iovcnt has been zeroed-out for other
I/O types to overwrite any previous values/pointers.

Change-Id: I570a4d82d9e4db6630a6831b1aab3259fb46cdd8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377687
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-08 15:07:10 +02:00 committed by Jim Harris
parent 3735f2d08e
commit e2e6fd3744

View File

@ -1069,6 +1069,8 @@ spdk_bdev_write_zeroes_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channe
}
bdev_io->ch = channel;
bdev_io->u.bdev.iovs = NULL;
bdev_io->u.bdev.iovcnt = 0;
bdev_io->u.bdev.num_blocks = num_blocks;
bdev_io->u.bdev.offset_blocks = offset_blocks;
bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE_ZEROES;
@ -1123,6 +1125,8 @@ spdk_bdev_unmap_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
bdev_io->ch = channel;
bdev_io->type = SPDK_BDEV_IO_TYPE_UNMAP;
bdev_io->u.bdev.iovs = &bdev_io->u.bdev.iov;
bdev_io->u.bdev.iovcnt = 1;
bdev_io->u.bdev.offset_blocks = offset_blocks;
bdev_io->u.bdev.num_blocks = num_blocks;
spdk_bdev_io_init(bdev_io, bdev, cb_arg, cb);
@ -1170,6 +1174,8 @@ spdk_bdev_flush_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
bdev_io->ch = channel;
bdev_io->type = SPDK_BDEV_IO_TYPE_FLUSH;
bdev_io->u.bdev.iovs = NULL;
bdev_io->u.bdev.iovcnt = 0;
bdev_io->u.bdev.offset_blocks = offset_blocks;
bdev_io->u.bdev.num_blocks = num_blocks;
spdk_bdev_io_init(bdev_io, bdev, cb_arg, cb);