From 734de2606625cee83069b7299f638fa275598a0e Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Fri, 14 May 2021 18:24:44 +0800 Subject: [PATCH] bdev: use the same macro for both unmap and write zeroes Change-Id: Id76d65dd84ac6377ca14b1671142c856c7d83b7e Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7874 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto --- lib/bdev/bdev.c | 8 ++++---- test/unit/lib/bdev/bdev.c/bdev_ut.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index f1651fdaad..636d42bfb1 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -84,10 +84,10 @@ int __itt_init_ittlib(const char *, __itt_group_id); #define SPDK_BDEV_POOL_ALIGNMENT 512 -/* The maximum number of children requests for a UNMAP command when splitting - * into children requests at a time. +/* The maximum number of children requests for a UNMAP or WRITE ZEROES command + * when splitting into children requests at a time. */ -#define SPDK_BDEV_MAX_CHILDREN_UNMAP_REQS (8) +#define SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS (8) static const char *qos_rpc_type[] = {"rw_ios_per_sec", "rw_mbytes_per_sec", "r_mbytes_per_sec", "w_mbytes_per_sec" @@ -2279,7 +2279,7 @@ bdev_unmap_split(struct spdk_bdev_io *bdev_io) remaining = bdev_io->u.bdev.split_remaining_num_blocks; max_unmap_blocks = bdev_io->bdev->max_unmap * bdev_io->bdev->max_unmap_segments; - while (remaining && (num_children_reqs < SPDK_BDEV_MAX_CHILDREN_UNMAP_REQS)) { + while (remaining && (num_children_reqs < SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS)) { unmap_blocks = spdk_min(remaining, max_unmap_blocks); rc = bdev_io_split_submit(bdev_io, NULL, 0, NULL, unmap_blocks, diff --git a/test/unit/lib/bdev/bdev.c/bdev_ut.c b/test/unit/lib/bdev/bdev.c/bdev_ut.c index 3061cf839b..3028a7222f 100644 --- a/test/unit/lib/bdev/bdev.c/bdev_ut.c +++ b/test/unit/lib/bdev/bdev.c/bdev_ut.c @@ -4553,7 +4553,7 @@ bdev_unmap(void) CU_ASSERT(g_io_done == false); while (num_children > 0) { - num_outstanding = spdk_min(num_children, SPDK_BDEV_MAX_CHILDREN_UNMAP_REQS); + num_outstanding = spdk_min(num_children, SPDK_BDEV_MAX_CHILDREN_UNMAP_WRITE_ZEROES_REQS); CU_ASSERT(g_bdev_ut_channel->outstanding_io_count == num_outstanding); stub_complete_io(num_outstanding); num_children -= num_outstanding;