diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-09-10 17:27:42 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-11 00:56:43 -0500 |
commit | 5ceaaad7047745c1c02150c39d3fb623b7948d48 (patch) | |
tree | c03201ceda61314a0ec4b521e5d2d4d89bb1f0c2 /drivers/md/bcache/request.c | |
parent | 098fb25498214069e6bbf908515f2952dd7654d0 (diff) |
bcache: Bypass torture test
More testing ftw! Also, now verify mode doesn't break if you read dirty
data.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/request.c')
-rw-r--r-- | drivers/md/bcache/request.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 9f5a1386f77a..fbcc851ed5a5 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -528,6 +528,13 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio) | |||
528 | goto skip; | 528 | goto skip; |
529 | } | 529 | } |
530 | 530 | ||
531 | if (bypass_torture_test(dc)) { | ||
532 | if ((get_random_int() & 3) == 3) | ||
533 | goto skip; | ||
534 | else | ||
535 | goto rescale; | ||
536 | } | ||
537 | |||
531 | if (!congested && !dc->sequential_cutoff) | 538 | if (!congested && !dc->sequential_cutoff) |
532 | goto rescale; | 539 | goto rescale; |
533 | 540 | ||
@@ -601,6 +608,7 @@ struct search { | |||
601 | unsigned recoverable:1; | 608 | unsigned recoverable:1; |
602 | unsigned unaligned_bvec:1; | 609 | unsigned unaligned_bvec:1; |
603 | unsigned write:1; | 610 | unsigned write:1; |
611 | unsigned read_dirty_data:1; | ||
604 | 612 | ||
605 | unsigned long start_time; | 613 | unsigned long start_time; |
606 | 614 | ||
@@ -669,6 +677,9 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) | |||
669 | 677 | ||
670 | PTR_BUCKET(b->c, k, ptr)->prio = INITIAL_PRIO; | 678 | PTR_BUCKET(b->c, k, ptr)->prio = INITIAL_PRIO; |
671 | 679 | ||
680 | if (KEY_DIRTY(k)) | ||
681 | s->read_dirty_data = true; | ||
682 | |||
672 | n = bch_bio_split(bio, min_t(uint64_t, INT_MAX, | 683 | n = bch_bio_split(bio, min_t(uint64_t, INT_MAX, |
673 | KEY_OFFSET(k) - bio->bi_sector), | 684 | KEY_OFFSET(k) - bio->bi_sector), |
674 | GFP_NOIO, s->d->bio_split); | 685 | GFP_NOIO, s->d->bio_split); |
@@ -894,7 +905,8 @@ static void cached_dev_read_done(struct closure *cl) | |||
894 | s->cache_miss = NULL; | 905 | s->cache_miss = NULL; |
895 | } | 906 | } |
896 | 907 | ||
897 | if (verify(dc, &s->bio.bio) && s->recoverable && !s->unaligned_bvec) | 908 | if (verify(dc, &s->bio.bio) && s->recoverable && |
909 | !s->unaligned_bvec && !s->read_dirty_data) | ||
898 | bch_data_verify(dc, s->orig_bio); | 910 | bch_data_verify(dc, s->orig_bio); |
899 | 911 | ||
900 | bio_complete(s); | 912 | bio_complete(s); |