diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-12-08 05:39:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:02 -0500 |
commit | c17bb4951752d3e0f49cd1ea9d2e868422f9e0d6 (patch) | |
tree | dcd23ef706ba09edae462528dc11a507b1d17af6 /fs/partitions/check.c | |
parent | 933e312e73f8fc39652bd4d216a5393cc3a014b9 (diff) |
[PATCH] fault-injection capability for disk IO
This patch provides fault-injection capability for disk IO.
Boot option:
fail_make_request=<probability>,<interval>,<space>,<times>
<interval> -- specifies the interval of failures.
<probability> -- specifies how often it should fail in percent.
<space> -- specifies the size of free space where disk IO can be issued
safely in bytes.
<times> -- specifies how many times failures may happen at most.
Debugfs:
/debug/fail_make_request/interval
/debug/fail_make_request/probability
/debug/fail_make_request/specifies
/debug/fail_make_request/times
Example:
fail_make_request=10,100,0,-1
echo 1 > /sys/blocks/hda/hda1/make-it-fail
generic_make_request() on /dev/hda1 fails once per 10 times.
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r-- | fs/partitions/check.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 1901137f4ec..3d73d94d93a 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -276,12 +276,39 @@ static struct part_attribute part_attr_stat = { | |||
276 | .show = part_stat_read | 276 | .show = part_stat_read |
277 | }; | 277 | }; |
278 | 278 | ||
279 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
280 | |||
281 | static ssize_t part_fail_store(struct hd_struct * p, | ||
282 | const char *buf, size_t count) | ||
283 | { | ||
284 | int i; | ||
285 | |||
286 | if (count > 0 && sscanf(buf, "%d", &i) > 0) | ||
287 | p->make_it_fail = (i == 0) ? 0 : 1; | ||
288 | |||
289 | return count; | ||
290 | } | ||
291 | static ssize_t part_fail_read(struct hd_struct * p, char *page) | ||
292 | { | ||
293 | return sprintf(page, "%d\n", p->make_it_fail); | ||
294 | } | ||
295 | static struct part_attribute part_attr_fail = { | ||
296 | .attr = {.name = "make-it-fail", .mode = S_IRUGO | S_IWUSR }, | ||
297 | .store = part_fail_store, | ||
298 | .show = part_fail_read | ||
299 | }; | ||
300 | |||
301 | #endif | ||
302 | |||
279 | static struct attribute * default_attrs[] = { | 303 | static struct attribute * default_attrs[] = { |
280 | &part_attr_uevent.attr, | 304 | &part_attr_uevent.attr, |
281 | &part_attr_dev.attr, | 305 | &part_attr_dev.attr, |
282 | &part_attr_start.attr, | 306 | &part_attr_start.attr, |
283 | &part_attr_size.attr, | 307 | &part_attr_size.attr, |
284 | &part_attr_stat.attr, | 308 | &part_attr_stat.attr, |
309 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
310 | &part_attr_fail.attr, | ||
311 | #endif | ||
285 | NULL, | 312 | NULL, |
286 | }; | 313 | }; |
287 | 314 | ||