Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f03fdde authored by Gilad Broner's avatar Gilad Broner Committed by Matt Wagantall
Browse files

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: default avatarGilad Broner <gbroner@codeaurora.org>
parent ed7ad60f
Loading
Loading
Loading
Loading
+11 −21
Original line number Diff line number Diff line
@@ -662,20 +662,6 @@ static int post_test(struct test_data *td)
	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)
{
	if (td->test_info.timeout_msec)
@@ -754,8 +740,6 @@ int test_iosched_start_test(struct test_info *t_info)
		msleep(2000);

		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)
			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__);

		wait_event(ptd->wait_q, ptd->test_state == TEST_COMPLETED);
		del_timer_sync(&ptd->timeout_timer);
		ret = wait_event_interruptible_timeout(ptd->wait_q,
			(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));

@@ -1144,9 +1137,6 @@ static int test_init_queue(struct request_queue *q, struct elevator_type *e)
	q->elevator = eq;
	spin_unlock_irq(q->queue_lock);

	setup_timer(&ptd->timeout_timer, test_timeout_handler,
		    (unsigned long)ptd);

	spin_lock_init(&ptd->lock);

	if (test_debugfs_init(ptd)) {
+0 −3
Original line number Diff line number Diff line
@@ -191,8 +191,6 @@ struct blk_dev_test_type {
 *			new BIOs.
 * @start_sector:	The address of the first sector that can
 *			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
 *			request to ease the debugging of the
 *			test cases
@@ -225,7 +223,6 @@ struct test_data {
	struct request_queue *req_q;
	int num_of_write_bios;
	u32 start_sector;
	struct timer_list timeout_timer;
	int wr_rd_next_req_id;
	int unique_next_req_id;
	spinlock_t lock;