From a766dd00f415d132dd2f07895b63136997e58d1a Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 11 Sep 2019 13:31:30 +0900 Subject: [PATCH] nvme/fio_plugin: Fix the issue that PRACT doesn't work when metadata size is 8 bytes When PRACT is set, if metadata size is 8 bytes, PI is stripped (read) or inserted (write). Hence block size must not include metadata size for extended LBA payload. This patch fixes the issue by reducing metadata size from block size for this case. On the other hand, When PRACT is set, if metadata size is larger than 8 bytes, PI is passed (read) or replaced (write). So block size is not necessary to change for this case. Signed-off-by: James Bergsten Signed-off-by: Changpeng Liu Signed-off-by: Shuhei Matsumoto Change-Id: I930c8a07519a4742c44240801b068fac2c4802a7 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465708 Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- examples/nvme/fio_plugin/fio_plugin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index a7e39077f..3958c4ba4 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -788,6 +788,14 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u) fio_req->fio_qpair = fio_qpair; block_size = spdk_nvme_ns_get_extended_sector_size(ns); + if ((fio_qpair->io_flags & g_spdk_pract_flag) && (spdk_nvme_ns_get_md_size(ns) == 8)) { + /* If metadata size = 8 bytes, PI is stripped (read) or inserted (write), and + * so reduce metadata size from block size. (If metadata size > 8 bytes, PI + * is passed (read) or replaced (write). So block size is not necessary to + * change.) + */ + block_size = spdk_nvme_ns_get_sector_size(ns); + } lba = io_u->offset / block_size; lba_count = io_u->xfer_buflen / block_size;