diff options
Diffstat (limited to 'drivers/md/bcache/debug.c')
-rw-r--r-- | drivers/md/bcache/debug.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index 88e6411eab4f..d9ccb3169aa2 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include "bcache.h" | 8 | #include "bcache.h" |
9 | #include "btree.h" | 9 | #include "btree.h" |
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | #include "request.h" | ||
12 | 11 | ||
13 | #include <linux/console.h> | 12 | #include <linux/console.h> |
14 | #include <linux/debugfs.h> | 13 | #include <linux/debugfs.h> |
@@ -176,42 +175,25 @@ void bch_btree_verify(struct btree *b, struct bset *new) | |||
176 | mutex_unlock(&b->c->verify_lock); | 175 | mutex_unlock(&b->c->verify_lock); |
177 | } | 176 | } |
178 | 177 | ||
179 | static void data_verify_endio(struct bio *bio, int error) | 178 | void bch_data_verify(struct cached_dev *dc, struct bio *bio) |
180 | { | ||
181 | struct closure *cl = bio->bi_private; | ||
182 | closure_put(cl); | ||
183 | } | ||
184 | |||
185 | void bch_data_verify(struct search *s) | ||
186 | { | 179 | { |
187 | char name[BDEVNAME_SIZE]; | 180 | char name[BDEVNAME_SIZE]; |
188 | struct cached_dev *dc = container_of(s->d, struct cached_dev, disk); | ||
189 | struct closure *cl = &s->cl; | ||
190 | struct bio *check; | 181 | struct bio *check; |
191 | struct bio_vec *bv; | 182 | struct bio_vec *bv; |
192 | int i; | 183 | int i; |
193 | 184 | ||
194 | if (!s->unaligned_bvec) | 185 | check = bio_clone(bio, GFP_NOIO); |
195 | bio_for_each_segment(bv, s->orig_bio, i) | ||
196 | bv->bv_offset = 0, bv->bv_len = PAGE_SIZE; | ||
197 | |||
198 | check = bio_clone(s->orig_bio, GFP_NOIO); | ||
199 | if (!check) | 186 | if (!check) |
200 | return; | 187 | return; |
201 | 188 | ||
202 | if (bio_alloc_pages(check, GFP_NOIO)) | 189 | if (bio_alloc_pages(check, GFP_NOIO)) |
203 | goto out_put; | 190 | goto out_put; |
204 | 191 | ||
205 | check->bi_rw = READ_SYNC; | 192 | submit_bio_wait(READ_SYNC, check); |
206 | check->bi_private = cl; | ||
207 | check->bi_end_io = data_verify_endio; | ||
208 | |||
209 | closure_bio_submit(check, cl, &dc->disk); | ||
210 | closure_sync(cl); | ||
211 | 193 | ||
212 | bio_for_each_segment(bv, s->orig_bio, i) { | 194 | bio_for_each_segment(bv, bio, i) { |
213 | void *p1 = kmap(bv->bv_page); | 195 | void *p1 = kmap_atomic(bv->bv_page); |
214 | void *p2 = kmap(check->bi_io_vec[i].bv_page); | 196 | void *p2 = page_address(check->bi_io_vec[i].bv_page); |
215 | 197 | ||
216 | if (memcmp(p1 + bv->bv_offset, | 198 | if (memcmp(p1 + bv->bv_offset, |
217 | p2 + bv->bv_offset, | 199 | p2 + bv->bv_offset, |
@@ -219,13 +201,11 @@ void bch_data_verify(struct search *s) | |||
219 | printk(KERN_ERR | 201 | printk(KERN_ERR |
220 | "bcache (%s): verify failed at sector %llu\n", | 202 | "bcache (%s): verify failed at sector %llu\n", |
221 | bdevname(dc->bdev, name), | 203 | bdevname(dc->bdev, name), |
222 | (uint64_t) s->orig_bio->bi_sector); | 204 | (uint64_t) bio->bi_sector); |
223 | 205 | kunmap_atomic(p1); | |
224 | kunmap(bv->bv_page); | ||
225 | kunmap(check->bi_io_vec[i].bv_page); | ||
226 | } | 206 | } |
227 | 207 | ||
228 | __bio_for_each_segment(bv, check, i, 0) | 208 | bio_for_each_segment_all(bv, check, i) |
229 | __free_page(bv->bv_page); | 209 | __free_page(bv->bv_page); |
230 | out_put: | 210 | out_put: |
231 | bio_put(check); | 211 | bio_put(check); |