block: test-iosched: remove test timeout timer
When running a test, a timer was set to detect test timeout and to unblock the wait_event() function which is waiting for the test to finish. This is redundant as wait_event timeout variant gives the same functionality without the overhead of managing a timer for this purpose and improve code readability. Change-Id: Icbd3cb0f3fcb5854673f4506b102b0c80e97d6bb Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
This commit is contained in:
parent
e355904bbf
commit
2e5c505a50
2 changed files with 11 additions and 24 deletions
|
@ -662,20 +662,6 @@ static int post_test(struct test_data *td)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The timer verifies that the test will be completed even if we don't get
|
|
||||||
* the completion callback for all the requests.
|
|
||||||
*/
|
|
||||||
static void test_timeout_handler(unsigned long data)
|
|
||||||
{
|
|
||||||
struct test_data *td = (struct test_data *)data;
|
|
||||||
|
|
||||||
pr_info("%s: TIMEOUT timer expired", __func__);
|
|
||||||
td->test_state = TEST_COMPLETED;
|
|
||||||
wake_up(&td->wait_q);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned int get_timeout_msec(struct test_data *td)
|
static unsigned int get_timeout_msec(struct test_data *td)
|
||||||
{
|
{
|
||||||
if (td->test_info.timeout_msec)
|
if (td->test_info.timeout_msec)
|
||||||
|
@ -754,8 +740,6 @@ int test_iosched_start_test(struct test_info *t_info)
|
||||||
msleep(2000);
|
msleep(2000);
|
||||||
|
|
||||||
timeout_msec = get_timeout_msec(ptd);
|
timeout_msec = get_timeout_msec(ptd);
|
||||||
mod_timer(&ptd->timeout_timer, jiffies +
|
|
||||||
msecs_to_jiffies(timeout_msec));
|
|
||||||
|
|
||||||
if (ptd->test_info.get_test_case_str_fn)
|
if (ptd->test_info.get_test_case_str_fn)
|
||||||
test_name = ptd->test_info.get_test_case_str_fn(ptd);
|
test_name = ptd->test_info.get_test_case_str_fn(ptd);
|
||||||
|
@ -779,8 +763,17 @@ int test_iosched_start_test(struct test_info *t_info)
|
||||||
|
|
||||||
pr_info("%s: Waiting for the test completion", __func__);
|
pr_info("%s: Waiting for the test completion", __func__);
|
||||||
|
|
||||||
wait_event(ptd->wait_q, ptd->test_state == TEST_COMPLETED);
|
ret = wait_event_interruptible_timeout(ptd->wait_q,
|
||||||
del_timer_sync(&ptd->timeout_timer);
|
(ptd->test_state == TEST_COMPLETED),
|
||||||
|
msecs_to_jiffies(timeout_msec));
|
||||||
|
if (ret <= 0) {
|
||||||
|
ptd->test_state = TEST_COMPLETED;
|
||||||
|
if (!ret)
|
||||||
|
pr_info("%s: Test timeout\n", __func__);
|
||||||
|
else
|
||||||
|
pr_err("%s: Test error=%d\n", __func__, ret);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(t_info, &ptd->test_info, sizeof(struct test_info));
|
memcpy(t_info, &ptd->test_info, sizeof(struct test_info));
|
||||||
|
|
||||||
|
@ -1144,9 +1137,6 @@ static int test_init_queue(struct request_queue *q, struct elevator_type *e)
|
||||||
q->elevator = eq;
|
q->elevator = eq;
|
||||||
spin_unlock_irq(q->queue_lock);
|
spin_unlock_irq(q->queue_lock);
|
||||||
|
|
||||||
setup_timer(&ptd->timeout_timer, test_timeout_handler,
|
|
||||||
(unsigned long)ptd);
|
|
||||||
|
|
||||||
spin_lock_init(&ptd->lock);
|
spin_lock_init(&ptd->lock);
|
||||||
|
|
||||||
if (test_debugfs_init(ptd)) {
|
if (test_debugfs_init(ptd)) {
|
||||||
|
|
|
@ -191,8 +191,6 @@ struct blk_dev_test_type {
|
||||||
* new BIOs.
|
* new BIOs.
|
||||||
* @start_sector: The address of the first sector that can
|
* @start_sector: The address of the first sector that can
|
||||||
* be accessed by the test
|
* be accessed by the test
|
||||||
* @timeout_timer: A timer to verify test completion in
|
|
||||||
* case of non-completed requests
|
|
||||||
* @wr_rd_next_req_id: A unique ID to identify WRITE/READ
|
* @wr_rd_next_req_id: A unique ID to identify WRITE/READ
|
||||||
* request to ease the debugging of the
|
* request to ease the debugging of the
|
||||||
* test cases
|
* test cases
|
||||||
|
@ -225,7 +223,6 @@ struct test_data {
|
||||||
struct request_queue *req_q;
|
struct request_queue *req_q;
|
||||||
int num_of_write_bios;
|
int num_of_write_bios;
|
||||||
u32 start_sector;
|
u32 start_sector;
|
||||||
struct timer_list timeout_timer;
|
|
||||||
int wr_rd_next_req_id;
|
int wr_rd_next_req_id;
|
||||||
int unique_next_req_id;
|
int unique_next_req_id;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
Loading…
Add table
Reference in a new issue