From 26c2f987f6eb8dfdf1157da5e540ce076f2b6684 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 26 Jan 2023 18:12:06 +0100 Subject: [PATCH] test/setup: Use hw_sector_size to convert size to sectors The {logical,physical}_block_size may actually differ (physical can be bigger than logical) so always use the smallest available unit - the hw_sector_size is an actual alias to logical_block_size and it's also clearly indicating what unit sgdisk is working with. In case the physical_block_size differs, the resulted partitions may have different size than expected. For instance, under nvme with 512/4096 layout, the partitions were ending up 128MB in size instead of 1GB causing the dmsetup to fail (as it expects to join partitions 1GB in size each). Signed-off-by: Michal Berger Change-Id: Ib6d3afd3471af2c2e9a5ced17004dd9c565708c8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16551 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Jim Harris --- test/setup/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/setup/common.sh b/test/setup/common.sh index 1d00848e6..f774e2548 100644 --- a/test/setup/common.sh +++ b/test/setup/common.sh @@ -48,7 +48,7 @@ partition_drive() { done # Convert size to sectors for more precise partitioning - ((size /= $(< "/sys/class/block/$disk/queue/physical_block_size"))) + ((size /= $(< "/sys/class/block/$disk/queue/hw_sector_size"))) "$rootdir/scripts/sync_dev_uevents.sh" block/partition "${parts[@]}" &