scsi: ufs: fix's to ufs_lun_depth unit test
This patch fixes the ufs unit test case "lun_depth" to work properly. In cases where nutrs == lun_qdepth, 0 was an argument for the random number generating function, which returned bogus numbers as a result. In this patch we distinguish between equality and inequality cases, where in the equality case we remove the irrelevant test cases. Change-Id: Id7967e894e9d4d0fa1e250852895debcefcbf818 Signed-off-by: Lee Susman <lsusman@codeaurora.org>
This commit is contained in:
parent
c5761a4b7a
commit
0f26d7cf9a
1 changed files with 17 additions and 12 deletions
|
@ -653,7 +653,8 @@ static void ufs_test_run_scenario(void *data, async_cookie_t cookie)
|
||||||
* We want to run the queue every run_q requests, or,
|
* We want to run the queue every run_q requests, or,
|
||||||
* when the requests pool is exhausted
|
* when the requests pool is exhausted
|
||||||
*/
|
*/
|
||||||
if (ts->td->test_count >= QUEUE_MAX_REQUESTS ||
|
|
||||||
|
if (ts->td->dispatched_count >= QUEUE_MAX_REQUESTS ||
|
||||||
(ts->run_q && !(i % ts->run_q)))
|
(ts->run_q && !(i % ts->run_q)))
|
||||||
blk_run_queue(ts->td->req_q);
|
blk_run_queue(ts->td->req_q);
|
||||||
}
|
}
|
||||||
|
@ -748,15 +749,12 @@ static int ufs_test_run_lun_depth_test(struct test_data *td)
|
||||||
struct scsi_device *sdev;
|
struct scsi_device *sdev;
|
||||||
bool changed_seed = false;
|
bool changed_seed = false;
|
||||||
int i = 0, num_req[LUN_DEPTH_TEST_SIZE];
|
int i = 0, num_req[LUN_DEPTH_TEST_SIZE];
|
||||||
int lun_qdepth, nutrs;
|
int lun_qdepth, nutrs, num_scenarios;
|
||||||
|
|
||||||
BUG_ON(!td || !td->req_q || !td->req_q->queuedata);
|
BUG_ON(!td || !td->req_q || !td->req_q->queuedata);
|
||||||
sdev = (struct scsi_device *)td->req_q->queuedata;
|
sdev = (struct scsi_device *)td->req_q->queuedata;
|
||||||
lun_qdepth = sdev->max_queue_depth;
|
lun_qdepth = sdev->max_queue_depth;
|
||||||
nutrs = sdev->host->can_queue;
|
nutrs = sdev->host->can_queue;
|
||||||
/* in case there is no specific queue size per LU */
|
|
||||||
if (lun_qdepth == nutrs)
|
|
||||||
lun_qdepth = lun_qdepth >> 2;
|
|
||||||
|
|
||||||
/* allow randomness even if user forgot */
|
/* allow randomness even if user forgot */
|
||||||
if (utd->random_test_seed <= 0) {
|
if (utd->random_test_seed <= 0) {
|
||||||
|
@ -770,22 +768,29 @@ static int ufs_test_run_lun_depth_test(struct test_data *td)
|
||||||
num_req[i++] = lun_qdepth - 1;
|
num_req[i++] = lun_qdepth - 1;
|
||||||
num_req[i++] = lun_qdepth;
|
num_req[i++] = lun_qdepth;
|
||||||
num_req[i++] = lun_qdepth + 1;
|
num_req[i++] = lun_qdepth + 1;
|
||||||
num_req[i++] = lun_qdepth + 1 + ufs_test_pseudo_random_seed(
|
/* if (nutrs-lun_qdepth-2 <= 0), do not run this scenario */
|
||||||
|
if (nutrs - lun_qdepth - 2 > 0)
|
||||||
|
num_req[i++] = lun_qdepth + 1 + ufs_test_pseudo_random_seed(
|
||||||
&utd->random_test_seed, 1, nutrs - lun_qdepth - 2);
|
&utd->random_test_seed, 1, nutrs - lun_qdepth - 2);
|
||||||
num_req[i++] = nutrs - 1;
|
|
||||||
num_req[i++] = nutrs;
|
/* if nutrs == lun_qdepth, do not run these three scenarios */
|
||||||
num_req[i++] = nutrs + 1;
|
if (nutrs != lun_qdepth) {
|
||||||
|
num_req[i++] = nutrs - 1;
|
||||||
|
num_req[i++] = nutrs;
|
||||||
|
num_req[i++] = nutrs + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* a random number up to 10, not to cause overflow or timeout */
|
/* a random number up to 10, not to cause overflow or timeout */
|
||||||
num_req[i++] = nutrs + 1 + ufs_test_pseudo_random_seed(
|
num_req[i++] = nutrs + 1 + ufs_test_pseudo_random_seed(
|
||||||
&utd->random_test_seed, 1, 10);
|
&utd->random_test_seed, 1, 10);
|
||||||
|
|
||||||
|
num_scenarios = i;
|
||||||
utd->test_stage = UFS_TEST_LUN_DEPTH_TEST_RUNNING;
|
utd->test_stage = UFS_TEST_LUN_DEPTH_TEST_RUNNING;
|
||||||
utd->fail_threads = 0;
|
utd->fail_threads = 0;
|
||||||
read_data = get_scenario(td, SCEN_RANDOM_READ_32_NO_FLUSH);
|
read_data = get_scenario(td, SCEN_RANDOM_READ_32_NO_FLUSH);
|
||||||
write_data = get_scenario(td, SCEN_RANDOM_READ_32_NO_FLUSH);
|
write_data = get_scenario(td, SCEN_RANDOM_WRITE_32_NO_FLUSH);
|
||||||
|
|
||||||
for (i = 0; i < LUN_DEPTH_TEST_SIZE; i++) {
|
for (i = 0; i < num_scenarios; i++) {
|
||||||
int reqs = num_req[i];
|
int reqs = num_req[i];
|
||||||
|
|
||||||
read_data->total_req = reqs;
|
read_data->total_req = reqs;
|
||||||
|
|
Loading…
Add table
Reference in a new issue