summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/test-iosched.c26
-rw-r--r--include/linux/test-iosched.h6
2 files changed, 23 insertions, 9 deletions
diff --git a/block/test-iosched.c b/block/test-iosched.c
index f19945c36b91..d405bbcdc236 100644
--- a/block/test-iosched.c
+++ b/block/test-iosched.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -44,7 +44,6 @@ static LIST_HEAD(blk_dev_test_list);
static struct test_data *ptd;
-
/**
* test_iosched_get_req_queue() - returns the request queue
* served by the scheduler
@@ -76,17 +75,20 @@ void test_iosched_mark_test_completion(void)
}
EXPORT_SYMBOL(test_iosched_mark_test_completion);
-/* Check if all the queued test requests were completed */
-static void check_test_completion(void)
+/**
+ * check_test_completion() - Check if all the queued test
+ * requests were completed
+ */
+void check_test_completion(void)
{
struct test_request *test_rq;
if (!ptd)
- return;
+ goto exit;
list_for_each_entry(test_rq, &ptd->dispatched_queue, queuelist)
if (!test_rq->req_completed)
- return;
+ goto exit;
if (!list_empty(&ptd->test_queue)
|| !list_empty(&ptd->reinsert_queue)
@@ -96,7 +98,7 @@ static void check_test_completion(void)
__func__, ptd->test_count, ptd->reinsert_count);
test_pr_info("%s: dispatched_count=%d, urgent_count=%d",
__func__, ptd->dispatched_count, ptd->urgent_count);
- return;
+ goto exit;
}
ptd->test_info.test_duration = jiffies -
@@ -108,7 +110,11 @@ static void check_test_completion(void)
__func__, ptd->dispatched_count);
test_iosched_mark_test_completion();
+
+exit:
+ return;
}
+EXPORT_SYMBOL(check_test_completion);
/*
* A callback to be called per bio completion.
@@ -345,7 +351,7 @@ struct test_request *test_iosched_create_test_req(int is_err_expcted,
rq->end_io = end_test_req;
rq->__sector = start_sec;
rq->cmd_type |= REQ_TYPE_FS;
- rq->cmd_flags |= REQ_SORTED; /* do we need this?*/
+ rq->cmd_flags |= REQ_SORTED;
if (rq->bio) {
rq->bio->bi_sector = start_sec;
@@ -681,6 +687,8 @@ static unsigned int get_timeout_msec(struct test_data *td)
/**
* test_iosched_start_test() - Prepares and runs the test.
+ * The members test_duration and test_byte_count of the input
+ * parameter t_info are modified by this function.
* @t_info: the current test testcase and callbacks
* functions
*
@@ -774,6 +782,7 @@ int test_iosched_start_test(struct test_info *t_info)
wait_event(ptd->wait_q, ptd->test_state == TEST_COMPLETED);
t_info->test_duration = ptd->test_info.test_duration;
+ t_info->test_byte_count = ptd->test_info.test_byte_count;
del_timer_sync(&ptd->timeout_timer);
ret = check_test_result(ptd);
@@ -1008,6 +1017,7 @@ static int test_dispatch_from(struct request_queue *q,
print_req(rq);
elv_dispatch_sort(q, rq);
+ ptd->test_info.test_byte_count += test_rq->buf_size;
ret = 1;
goto err;
}
diff --git a/include/linux/test-iosched.h b/include/linux/test-iosched.h
index fda835a6f7a4..d69dcea4978b 100644
--- a/include/linux/test-iosched.h
+++ b/include/linux/test-iosched.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -132,6 +132,8 @@ struct test_request {
* @test_duration: A jiffies value saved for timing
* calculations
* @data: Test specific private data
+ * @test_byte_count: Total number of bytes dispatched in
+ * the test
*/
struct test_info {
int testcase;
@@ -144,6 +146,7 @@ struct test_info {
unsigned long test_duration;
get_rq_disk_fn *get_rq_disk_fn;
void *data;
+ unsigned long test_byte_count;
};
/**
@@ -231,6 +234,7 @@ struct test_data {
extern int test_iosched_start_test(struct test_info *t_info);
extern void test_iosched_mark_test_completion(void);
+extern void check_test_completion(void);
extern int test_iosched_add_unique_test_req(int is_err_expcted,
enum req_unique_type req_unique,
int start_sec, int nr_sects, rq_end_io_fn *end_req_io);