bdev/nvme: do not use DSM to emulate write zeroes
We cannot rely on DSM/DEALLOCATE as a write zeroes alternative, even if DLFEAT reports that deallocated blocks will be read as all zeroes. DEALLOCATE is advisory, meaning that blocks may not actually be deallocated. In cases where they are not deallocated, they will not be read back later as zeroes. QEMU 6.0 started reporting DLFEAT as returning zeroes for deallocated blocks but for some of our write zeroes tests, blocks aren't actually deallocated. We may be able to add quirks in the future if we know that a controller reliably deallocates blocks, but for now we need to revert this completely. Note that since bdev/nvme module now does not support write zeroes in any cases, we need to disable the write zeroes call in the unit tests. Fixes issue #1932. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I79f0673774b621a9ffcc46891728cc7719e34cdb Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7723 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
bbfbcc1967
commit
3faf457f56
@ -803,13 +803,6 @@ _bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_
|
||||
bdev_io->u.bdev.offset_blocks,
|
||||
bdev->dif_check_flags);
|
||||
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
return bdev_nvme_unmap(nvme_ns->ns,
|
||||
qpair,
|
||||
nbdev_io,
|
||||
bdev_io->u.bdev.offset_blocks,
|
||||
bdev_io->u.bdev.num_blocks);
|
||||
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
return bdev_nvme_unmap(nvme_ns->ns,
|
||||
qpair,
|
||||
@ -939,20 +932,11 @@ bdev_nvme_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
|
||||
return cdata->oncs.dsm;
|
||||
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
cdata = spdk_nvme_ctrlr_get_data(ctrlr);
|
||||
/*
|
||||
* If an NVMe controller guarantees reading unallocated blocks returns zero,
|
||||
* we can implement WRITE_ZEROES as an NVMe deallocate command.
|
||||
*/
|
||||
if (cdata->oncs.dsm &&
|
||||
spdk_nvme_ns_get_dealloc_logical_block_read_value(ns) ==
|
||||
SPDK_NVME_DEALLOC_READ_00) {
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* The NVMe controller write_zeroes function is currently not used by our driver.
|
||||
* If a user submits an arbitrarily large write_zeroes request to the controller, the request will fail.
|
||||
* Until this is resolved, we only claim support for write_zeroes if deallocated blocks return 0's when read.
|
||||
* NVMe write zeroes is limited to 16-bit block count, and the bdev layer currently
|
||||
* has no mechanism for reporting a max write zeroes block count, nor ability to
|
||||
* split a write zeroes request.
|
||||
*/
|
||||
return false;
|
||||
|
||||
|
@ -1875,7 +1875,6 @@ test_submit_nvme_cmd(void)
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_READ);
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_WRITE);
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_COMPARE);
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_WRITE_ZEROES);
|
||||
ut_test_submit_nvme_cmd(ch, bdev_io, SPDK_BDEV_IO_TYPE_UNMAP);
|
||||
|
||||
ut_test_submit_nop(ch, bdev_io, SPDK_BDEV_IO_TYPE_FLUSH);
|
||||
|
Loading…
Reference in New Issue
Block a user