raid56.c (2c8cdd6ee4e7f637b0486c6798117e7859dee586) | raid56.c (7603597690147a16b5cc77047d7570fa22a22673) |
---|---|
1/* 2 * Copyright (C) 2012 Fusion-io All rights reserved. 3 * Copyright (C) 2012 Intel Corp. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public 7 * License v2 as published by the Free Software Foundation. 8 * --- 2304 unchanged lines hidden (view full) --- 2313 err = -EIO; 2314 2315 rbio_orig_end_io(rbio, err, 0); 2316} 2317 2318static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, 2319 int need_check) 2320{ | 1/* 2 * Copyright (C) 2012 Fusion-io All rights reserved. 3 * Copyright (C) 2012 Intel Corp. All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public 7 * License v2 as published by the Free Software Foundation. 8 * --- 2304 unchanged lines hidden (view full) --- 2313 err = -EIO; 2314 2315 rbio_orig_end_io(rbio, err, 0); 2316} 2317 2318static noinline void finish_parity_scrub(struct btrfs_raid_bio *rbio, 2319 int need_check) 2320{ |
2321 struct btrfs_bio *bbio = rbio->bbio; |
|
2321 void *pointers[rbio->real_stripes]; | 2322 void *pointers[rbio->real_stripes]; |
2323 DECLARE_BITMAP(pbitmap, rbio->stripe_npages); |
|
2322 int nr_data = rbio->nr_data; 2323 int stripe; 2324 int pagenr; 2325 int p_stripe = -1; 2326 int q_stripe = -1; 2327 struct page *p_page = NULL; 2328 struct page *q_page = NULL; 2329 struct bio_list bio_list; 2330 struct bio *bio; | 2324 int nr_data = rbio->nr_data; 2325 int stripe; 2326 int pagenr; 2327 int p_stripe = -1; 2328 int q_stripe = -1; 2329 struct page *p_page = NULL; 2330 struct page *q_page = NULL; 2331 struct bio_list bio_list; 2332 struct bio *bio; |
2333 int is_replace = 0; |
|
2331 int ret; 2332 2333 bio_list_init(&bio_list); 2334 2335 if (rbio->real_stripes - rbio->nr_data == 1) { 2336 p_stripe = rbio->real_stripes - 1; 2337 } else if (rbio->real_stripes - rbio->nr_data == 2) { 2338 p_stripe = rbio->real_stripes - 2; 2339 q_stripe = rbio->real_stripes - 1; 2340 } else { 2341 BUG(); 2342 } 2343 | 2334 int ret; 2335 2336 bio_list_init(&bio_list); 2337 2338 if (rbio->real_stripes - rbio->nr_data == 1) { 2339 p_stripe = rbio->real_stripes - 1; 2340 } else if (rbio->real_stripes - rbio->nr_data == 2) { 2341 p_stripe = rbio->real_stripes - 2; 2342 q_stripe = rbio->real_stripes - 1; 2343 } else { 2344 BUG(); 2345 } 2346 |
2347 if (bbio->num_tgtdevs && bbio->tgtdev_map[rbio->scrubp]) { 2348 is_replace = 1; 2349 bitmap_copy(pbitmap, rbio->dbitmap, rbio->stripe_npages); 2350 } 2351 |
|
2344 /* 2345 * Because the higher layers(scrubber) are unlikely to 2346 * use this area of the disk again soon, so don't cache 2347 * it. 2348 */ 2349 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags); 2350 2351 if (!need_check) --- 72 unchanged lines hidden (view full) --- 2424 2425 page = rbio_stripe_page(rbio, rbio->scrubp, pagenr); 2426 ret = rbio_add_io_page(rbio, &bio_list, 2427 page, rbio->scrubp, pagenr, rbio->stripe_len); 2428 if (ret) 2429 goto cleanup; 2430 } 2431 | 2352 /* 2353 * Because the higher layers(scrubber) are unlikely to 2354 * use this area of the disk again soon, so don't cache 2355 * it. 2356 */ 2357 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags); 2358 2359 if (!need_check) --- 72 unchanged lines hidden (view full) --- 2432 2433 page = rbio_stripe_page(rbio, rbio->scrubp, pagenr); 2434 ret = rbio_add_io_page(rbio, &bio_list, 2435 page, rbio->scrubp, pagenr, rbio->stripe_len); 2436 if (ret) 2437 goto cleanup; 2438 } 2439 |
2440 if (!is_replace) 2441 goto submit_write; 2442 2443 for_each_set_bit(pagenr, pbitmap, rbio->stripe_npages) { 2444 struct page *page; 2445 2446 page = rbio_stripe_page(rbio, rbio->scrubp, pagenr); 2447 ret = rbio_add_io_page(rbio, &bio_list, page, 2448 bbio->tgtdev_map[rbio->scrubp], 2449 pagenr, rbio->stripe_len); 2450 if (ret) 2451 goto cleanup; 2452 } 2453 2454submit_write: |
|
2432 nr_data = bio_list_size(&bio_list); 2433 if (!nr_data) { 2434 /* Every parity is right */ 2435 rbio_orig_end_io(rbio, 0, 0); 2436 return; 2437 } 2438 2439 atomic_set(&rbio->stripes_pending, nr_data); --- 226 unchanged lines hidden --- | 2455 nr_data = bio_list_size(&bio_list); 2456 if (!nr_data) { 2457 /* Every parity is right */ 2458 rbio_orig_end_io(rbio, 0, 0); 2459 return; 2460 } 2461 2462 atomic_set(&rbio->stripes_pending, nr_data); --- 226 unchanged lines hidden --- |