lib/bdev: Removed ZCOPY emulation
ZCOPY emulation is not required. Modules can check if the bdev module supports ZCOPY. If not supported the module uses the existing READ and WRITE operations. Signed-off-by: matthewb <matthew.burbridge@hpe.com> Change-Id: Idac0a4d27a79a6c7e567c420e15637e826c347c8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6815 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
b333f00627
commit
51d7f9b13f
@ -46,6 +46,11 @@ to create a rbd bdev with an already registered Rados Cluster Object.
|
||||
New RPC `bdev_rbd_get_clusters_info` was added, it allows to get the info of the registered
|
||||
Rados Cluster names.
|
||||
|
||||
### bdev
|
||||
|
||||
Removed ZCOPY emulation: The bdev module can be checked to see if it supports ZCOPY
|
||||
and if not supported then use existing READ/WRITE commands.
|
||||
|
||||
## v21.04:
|
||||
|
||||
### accel
|
||||
|
@ -2574,11 +2574,6 @@ spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_ty
|
||||
/* The bdev layer will emulate write zeroes as long as write is supported. */
|
||||
supported = bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE);
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_ZCOPY:
|
||||
/* Zero copy can be emulated with regular read and write */
|
||||
supported = bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_READ) &&
|
||||
bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_WRITE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4318,29 +4313,6 @@ spdk_bdev_comparev_and_writev_blocks(struct spdk_bdev_desc *desc, struct spdk_io
|
||||
bdev_comparev_and_writev_blocks_locked, bdev_io);
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_zcopy_get_buf(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io, bool success)
|
||||
{
|
||||
if (!success) {
|
||||
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_NOMEM;
|
||||
bdev_io->internal.cb(bdev_io, success, bdev_io->internal.caller_ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bdev_io->u.bdev.zcopy.populate) {
|
||||
/* Read the real data into the buffer */
|
||||
bdev_io->type = SPDK_BDEV_IO_TYPE_READ;
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
|
||||
bdev_io_submit(bdev_io);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
|
||||
bdev_io->internal.cb(bdev_io, success, bdev_io->internal.caller_ctx);
|
||||
}
|
||||
|
||||
int
|
||||
spdk_bdev_zcopy_start(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
uint64_t offset_blocks, uint64_t num_blocks,
|
||||
@ -4381,13 +4353,7 @@ spdk_bdev_zcopy_start(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
|
||||
bdev_io->u.bdev.zcopy.start = 1;
|
||||
bdev_io_init(bdev_io, bdev, cb_arg, cb);
|
||||
|
||||
if (bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_ZCOPY)) {
|
||||
bdev_io_submit(bdev_io);
|
||||
} else {
|
||||
/* Emulate zcopy by allocating a buffer */
|
||||
spdk_bdev_io_get_buf(bdev_io, bdev_zcopy_get_buf,
|
||||
bdev_io->u.bdev.num_blocks * bdev->blocklen);
|
||||
}
|
||||
bdev_io_submit(bdev_io);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -4396,16 +4362,6 @@ int
|
||||
spdk_bdev_zcopy_end(struct spdk_bdev_io *bdev_io, bool commit,
|
||||
spdk_bdev_io_completion_cb cb, void *cb_arg)
|
||||
{
|
||||
struct spdk_bdev *bdev = bdev_io->bdev;
|
||||
|
||||
if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
|
||||
/* This can happen if the zcopy was emulated in start */
|
||||
if (bdev_io->u.bdev.zcopy.start != 1) {
|
||||
return -EINVAL;
|
||||
}
|
||||
bdev_io->type = SPDK_BDEV_IO_TYPE_ZCOPY;
|
||||
}
|
||||
|
||||
if (bdev_io->type != SPDK_BDEV_IO_TYPE_ZCOPY) {
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -4416,19 +4372,6 @@ spdk_bdev_zcopy_end(struct spdk_bdev_io *bdev_io, bool commit,
|
||||
bdev_io->internal.cb = cb;
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
|
||||
|
||||
if (bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_ZCOPY)) {
|
||||
bdev_io_submit(bdev_io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!bdev_io->u.bdev.zcopy.commit) {
|
||||
/* Don't use spdk_bdev_io_complete here - this bdev_io was never actually submitted. */
|
||||
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
|
||||
bdev_io->internal.cb(bdev_io, true, bdev_io->internal.caller_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bdev_io->type = SPDK_BDEV_IO_TYPE_WRITE;
|
||||
bdev_io_submit(bdev_io);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user