From 3a598ea8465c8204688c6ccbc6d74003342f6651 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 15 Nov 2016 18:37:59 -0800 Subject: [PATCH] TESTS: Unmap. Clamp max number of unmap blocks to 256 if the target reports no limit Signed-off-by: Ronnie Sahlberg --- test-tool/test_unmap_simple.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test-tool/test_unmap_simple.c b/test-tool/test_unmap_simple.c index 835ac49..b4b71d9 100644 --- a/test-tool/test_unmap_simple.c +++ b/test-tool/test_unmap_simple.c @@ -72,6 +72,10 @@ test_unmap_simple(void) if (inq_bl->max_unmap_bdc > 0 && max_nr_bdc > (int)inq_bl->max_unmap_bdc) { max_nr_bdc = (int)inq_bl->max_unmap_bdc; } + if (max_nr_bdc < 0 || max_nr_bdc > 256) { + logging(LOG_VERBOSE, "Clamp max unmapped blocks to 256"); + max_nr_bdc = 256; + } logging(LOG_VERBOSE, "Test UNMAP of 1-%d blocks at the start of the " "LUN with one descriptor per block", max_nr_bdc);