Skip to content

Commit

Permalink
block: Add test-iosched scheduler
Browse files Browse the repository at this point in the history
The test scheduler allows testing a block device by dispatching
specific requests according to the test case and declare PASS/FAIL
according to the requests completion error code

Change-Id: Ief91f9fed6e3c3c75627d27264d5252ea14f10ad
Signed-off-by: Maya Erez <merez@codeaurora.org>
  • Loading branch information
Maya Erez authored and David Keitel committed Mar 22, 2016
1 parent 5904916 commit 395df99
Show file tree
Hide file tree
Showing 6 changed files with 1,306 additions and 2 deletions.
39 changes: 39 additions & 0 deletions Documentation/block/test-iosched.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Test IO scheduler
==================

The test scheduler allows testing a block device by dispatching
specific requests according to the test case and declare PASS/FAIL
according to the requests completion error code.

The test IO scheduler implements the no-op scheduler operations, and uses
them in order to dispatch the non-test requests when no test is running.
This will allow to keep a normal FS operation in parallel to the test
capability.
The test IO scheduler keeps two different queues, one for real-world requests
(inserted by the FS) and the other for the test requests.
The test IO scheduler chooses the queue for dispatch requests according to the
test state (IDLE/RUNNING).

the test IO scheduler is compiled by default as a dynamic module and enabled
only if CONFIG_DEBUG_FS is defined.

Each block device test utility that would like to use the test-iosched test
services, should register as a blk_dev_test_type and supply an init and exit
callbacks. Those callback are called upon selection (or removal) of the
test-iosched as the active scheduler. From that point the block device test
can start a test and supply its own callbacks for preparing, running, result
checking and cleanup of the test.

Each test is exposed via debugfs and can be triggered by writing to
the debugfs file. In order to add a new test one should expose a new debugfs
file for the new test.

Selecting IO schedulers
-----------------------
Refer to Documentation/block/switching-sched.txt for information on
selecting an io scheduler on a per-device basis.


May 10 2012, maya Erez <merez@codeaurora.org>


11 changes: 11 additions & 0 deletions block/Kconfig.iosched
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ config IOSCHED_NOOP
that do their own scheduling and require only minimal assistance from
the kernel.

config IOSCHED_TEST
tristate "Test I/O scheduler"
depends on DEBUG_FS
default m
---help---
The test I/O scheduler is a duplicate of the noop scheduler with
addition of test utlity.
It allows testing a block device by dispatching specific requests
according to the test case and declare PASS/FAIL according to the
requests completion error code.

config IOSCHED_DEADLINE
tristate "Deadline I/O scheduler"
default y
Expand Down
1 change: 1 addition & 0 deletions block/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ obj-$(CONFIG_BLK_DEV_THROTTLING) += blk-throttle.o
obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o
obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o
obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o
obj-$(CONFIG_IOSCHED_TEST) += test-iosched.o

obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o
obj-$(CONFIG_BLK_CMDLINE_PARSER) += cmdline-parser.o
Expand Down
3 changes: 1 addition & 2 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,6 @@ static struct request *blk_old_get_request(struct request_queue *q, int rw,
{
struct request *rq;

BUG_ON(rw != READ && rw != WRITE);

/* create ioc upfront */
create_io_context(gfp_mask, q->node);

Expand Down Expand Up @@ -1696,6 +1694,7 @@ void init_request_from_bio(struct request *req, struct bio *bio)
req->ioprio = bio_prio(bio);
blk_rq_bio_prep(req->q, req, bio);
}
EXPORT_SYMBOL(init_request_from_bio);

static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
{
Expand Down
Loading

0 comments on commit 395df99

Please sign in to comment.