summaryrefslogtreecommitdiff
path: root/drivers/scsi/ufs
diff options
context:
space:
mode:
authorLee Susman <lsusman@codeaurora.org>2013-11-27 08:34:48 +0200
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 10:59:15 -0700
commitc5761a4b7a1bc2bf762b075b58181efb1b1dbe21 (patch)
treeb4d686cd069d97dfdf1be31fb957d975a1a01970 /drivers/scsi/ufs
parentd5098866baf709dd8ede775f529659c2985b24a7 (diff)
scsi: ufs: fix's to ufs_parallel test
This patch fixes the ufs unit test case "parallel_read_write_test" to work properly. Changes are mainly in the logic deciding on the toggle of request direction. Change-Id: I3ba60421de1afb05dca780d82fcf10b9910a0bc1 Signed-off-by: Lee Susman <lsusman@codeaurora.org>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r--drivers/scsi/ufs/ufs_test.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/scsi/ufs/ufs_test.c b/drivers/scsi/ufs/ufs_test.c
index 1d41a355abb8..063c24be2804 100644
--- a/drivers/scsi/ufs/ufs_test.c
+++ b/drivers/scsi/ufs/ufs_test.c
@@ -201,9 +201,9 @@ static struct test_scenario test_scenario[SCEN_RANDOM_MAX] = {
{NULL, WRITE, 0, 50, true, 5}, /* SCEN_RANDOM_WRITE_50 */
/* SCEN_RANDOM_READ_32_NO_FLUSH */
- {NULL, READ, 1, 32, true, 64},
+ {NULL, READ, 0, 32, true, 64},
/* SCEN_RANDOM_WRITE_32_NO_FLUSH */
- {NULL, WRITE, 1, 32, true, 64},
+ {NULL, WRITE, 0, 32, true, 64},
};
static
@@ -602,15 +602,21 @@ static bool ufs_test_multi_thread_completion(void)
}
/**
- * ufs_test_do_toggling() - decides whether toggling is needed
- * toggle_factor - iteration to toggle
- * iteration - what is the current iteration
+ * ufs_test_toggle_direction() - decides whether toggling is
+ * needed. Toggle factor zero means no toggling.
+ *
+ * toggle_factor - iteration to toggle = toggling frequency
+ * iteration - the current request iteration
+ *
+ * Returns nonzero if toggling is needed, and 0 when toggling is
+ * not needed.
*/
static inline int ufs_test_toggle_direction(int toggle_factor, int iteration)
{
- if (toggle_factor)
- return 1;
- return iteration % toggle_factor;
+ if (!toggle_factor)
+ return 0;
+
+ return !(iteration % toggle_factor);
}
static void ufs_test_run_scenario(void *data, async_cookie_t cookie)
@@ -704,7 +710,7 @@ static int ufs_test_run_parallel_read_and_write_test(struct test_data *td)
utd->fail_threads = 0;
init_completion(&utd->outstanding_complete);
- for (i = 0; i < (RANDOM_REQUEST_THREADS % 2); i++) {
+ for (i = 0; i < (RANDOM_REQUEST_THREADS / 2); i++) {
async_schedule(ufs_test_run_scenario, read_data);
async_schedule(ufs_test_run_scenario, write_data);
atomic_add(2, &utd->outstanding_threads);