diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf53d836..ad8c161bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index 3c82cef97..ac6bc014a 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -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;