Loading block/test-iosched.c +4 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,10 @@ void check_test_completion(void) if (!ptd) if (!ptd) goto exit; goto exit; if (ptd->test_info.check_test_completion_fn && !ptd->test_info.check_test_completion_fn()) goto exit; list_for_each_entry(test_rq, &ptd->dispatched_queue, queuelist) list_for_each_entry(test_rq, &ptd->dispatched_queue, queuelist) if (!test_rq->req_completed) if (!test_rq->req_completed) goto exit; goto exit; Loading drivers/scsi/ufs/ufs_test.c +13 −16 Original line number Original line Diff line number Diff line Loading @@ -179,20 +179,6 @@ static void ufs_test_pseudo_rnd_size(unsigned int *seed, *num_of_bios = DEFAULT_NUM_OF_BIOS; *num_of_bios = DEFAULT_NUM_OF_BIOS; } } static void ufs_test_write_read_test_end_io_fn(struct request *rq, int err) { struct test_request *test_rq = (struct test_request *)rq->elv.priv[0]; BUG_ON(!test_rq); test_pr_info("%s: request %d completed, err=%d", __func__, test_rq->req_id, err); test_rq->req_completed = 1; test_rq->req_result = err; utd->write_completed = true; wake_up(&utd->wait_q); } static int ufs_test_show(struct seq_file *file, int test_case) static int ufs_test_show(struct seq_file *file, int test_case) { { char *test_description; char *test_description; Loading Loading @@ -260,6 +246,16 @@ exit: return gd; return gd; } } static bool ufs_write_read_completion(void) { if (!utd->write_completed) { utd->write_completed = true; wake_up(&utd->wait_q); return false; } return true; } static int ufs_test_run_write_read_test(struct test_data *td) static int ufs_test_run_write_read_test(struct test_data *td) { { int ret = 0; int ret = 0; Loading @@ -282,8 +278,7 @@ static int ufs_test_run_write_read_test(struct test_data *td) utd->write_completed = false; utd->write_completed = false; ret = test_iosched_add_wr_rd_test_req(0, WRITE, start_sec, num_bios, ret = test_iosched_add_wr_rd_test_req(0, WRITE, start_sec, num_bios, TEST_PATTERN_5A, TEST_PATTERN_5A, NULL); ufs_test_write_read_test_end_io_fn); if (ret) { if (ret) { test_pr_err("%s: failed to add a write request", __func__); test_pr_err("%s: failed to add a write request", __func__); Loading Loading @@ -454,6 +449,8 @@ static ssize_t ufs_test_write(struct file *file, const char __user *buf, switch (test_case) { switch (test_case) { case UFS_TEST_WRITE_READ_TEST: case UFS_TEST_WRITE_READ_TEST: utd->test_info.run_test_fn = ufs_test_run_write_read_test; utd->test_info.run_test_fn = ufs_test_run_write_read_test; utd->test_info.check_test_completion_fn = ufs_write_read_completion; break; break; case UFS_TEST_LONG_SEQUENTIAL_READ: case UFS_TEST_LONG_SEQUENTIAL_READ: case UFS_TEST_LONG_SEQUENTIAL_WRITE: case UFS_TEST_LONG_SEQUENTIAL_WRITE: Loading include/linux/test-iosched.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ typedef char* (get_test_case_str_fn) (struct test_data *); typedef void (blk_dev_test_init_fn) (void); typedef void (blk_dev_test_init_fn) (void); typedef void (blk_dev_test_exit_fn) (void); typedef void (blk_dev_test_exit_fn) (void); typedef struct gendisk* (get_rq_disk_fn) (void); typedef struct gendisk* (get_rq_disk_fn) (void); typedef bool (check_test_completion_fn) (void); /** /** * enum test_state - defines the state of the test * enum test_state - defines the state of the test Loading Loading @@ -145,6 +146,7 @@ struct test_info { get_test_case_str_fn *get_test_case_str_fn; get_test_case_str_fn *get_test_case_str_fn; ktime_t test_duration; ktime_t test_duration; get_rq_disk_fn *get_rq_disk_fn; get_rq_disk_fn *get_rq_disk_fn; check_test_completion_fn *check_test_completion_fn; void *data; void *data; unsigned long test_byte_count; unsigned long test_byte_count; }; }; Loading Loading
block/test-iosched.c +4 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,10 @@ void check_test_completion(void) if (!ptd) if (!ptd) goto exit; goto exit; if (ptd->test_info.check_test_completion_fn && !ptd->test_info.check_test_completion_fn()) goto exit; list_for_each_entry(test_rq, &ptd->dispatched_queue, queuelist) list_for_each_entry(test_rq, &ptd->dispatched_queue, queuelist) if (!test_rq->req_completed) if (!test_rq->req_completed) goto exit; goto exit; Loading
drivers/scsi/ufs/ufs_test.c +13 −16 Original line number Original line Diff line number Diff line Loading @@ -179,20 +179,6 @@ static void ufs_test_pseudo_rnd_size(unsigned int *seed, *num_of_bios = DEFAULT_NUM_OF_BIOS; *num_of_bios = DEFAULT_NUM_OF_BIOS; } } static void ufs_test_write_read_test_end_io_fn(struct request *rq, int err) { struct test_request *test_rq = (struct test_request *)rq->elv.priv[0]; BUG_ON(!test_rq); test_pr_info("%s: request %d completed, err=%d", __func__, test_rq->req_id, err); test_rq->req_completed = 1; test_rq->req_result = err; utd->write_completed = true; wake_up(&utd->wait_q); } static int ufs_test_show(struct seq_file *file, int test_case) static int ufs_test_show(struct seq_file *file, int test_case) { { char *test_description; char *test_description; Loading Loading @@ -260,6 +246,16 @@ exit: return gd; return gd; } } static bool ufs_write_read_completion(void) { if (!utd->write_completed) { utd->write_completed = true; wake_up(&utd->wait_q); return false; } return true; } static int ufs_test_run_write_read_test(struct test_data *td) static int ufs_test_run_write_read_test(struct test_data *td) { { int ret = 0; int ret = 0; Loading @@ -282,8 +278,7 @@ static int ufs_test_run_write_read_test(struct test_data *td) utd->write_completed = false; utd->write_completed = false; ret = test_iosched_add_wr_rd_test_req(0, WRITE, start_sec, num_bios, ret = test_iosched_add_wr_rd_test_req(0, WRITE, start_sec, num_bios, TEST_PATTERN_5A, TEST_PATTERN_5A, NULL); ufs_test_write_read_test_end_io_fn); if (ret) { if (ret) { test_pr_err("%s: failed to add a write request", __func__); test_pr_err("%s: failed to add a write request", __func__); Loading Loading @@ -454,6 +449,8 @@ static ssize_t ufs_test_write(struct file *file, const char __user *buf, switch (test_case) { switch (test_case) { case UFS_TEST_WRITE_READ_TEST: case UFS_TEST_WRITE_READ_TEST: utd->test_info.run_test_fn = ufs_test_run_write_read_test; utd->test_info.run_test_fn = ufs_test_run_write_read_test; utd->test_info.check_test_completion_fn = ufs_write_read_completion; break; break; case UFS_TEST_LONG_SEQUENTIAL_READ: case UFS_TEST_LONG_SEQUENTIAL_READ: case UFS_TEST_LONG_SEQUENTIAL_WRITE: case UFS_TEST_LONG_SEQUENTIAL_WRITE: Loading
include/linux/test-iosched.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ typedef char* (get_test_case_str_fn) (struct test_data *); typedef void (blk_dev_test_init_fn) (void); typedef void (blk_dev_test_init_fn) (void); typedef void (blk_dev_test_exit_fn) (void); typedef void (blk_dev_test_exit_fn) (void); typedef struct gendisk* (get_rq_disk_fn) (void); typedef struct gendisk* (get_rq_disk_fn) (void); typedef bool (check_test_completion_fn) (void); /** /** * enum test_state - defines the state of the test * enum test_state - defines the state of the test Loading Loading @@ -145,6 +146,7 @@ struct test_info { get_test_case_str_fn *get_test_case_str_fn; get_test_case_str_fn *get_test_case_str_fn; ktime_t test_duration; ktime_t test_duration; get_rq_disk_fn *get_rq_disk_fn; get_rq_disk_fn *get_rq_disk_fn; check_test_completion_fn *check_test_completion_fn; void *data; void *data; unsigned long test_byte_count; unsigned long test_byte_count; }; }; Loading