Lines Matching refs:stripe
65 /* while we're doing rmw on a stripe
67 * lock the stripe and merge more rbios
73 * LRU list for the stripe cache
84 * to add more bios into the stripe
93 * stripe locking code also uses it to hand off
94 * the stripe lock to the next pending IO
104 /* size of each individual stripe on disk */
121 /* first bad stripe */
124 /* second bad stripe (for raid6 use) */
130 * stripe
137 * stripe or not
166 * bitmap to record which horizontal stripe has data
198 * the stripe hash table is used for locking, and to collect
199 * bios in hopes of making a full stripe
244 * use the page uptodate bit in the stripe cache array
278 * we hash on the first logical address of the stripe
296 * stealing an rbio means taking all the uptodate pages from the stripe
456 * insert an rbio into the stripe cache. It
527 * Returns true if the bio list inside this rbio covers an entire stripe (no
548 * the same stripe and if they are both going in the same
581 * We've need read the full stripe from the drive.
586 * change this stripe needs to do their own rmw.
616 static int rbio_stripe_page_index(struct btrfs_raid_bio *rbio, int stripe,
619 return stripe * rbio->stripe_npages + index;
626 static struct page *rbio_stripe_page(struct btrfs_raid_bio *rbio, int stripe,
629 return rbio->stripe_pages[rbio_stripe_page_index(rbio, stripe, index)];
652 * The first stripe in the table for a logical address
655 * 1) Nobody has the stripe locked yet. The rbio is given
659 * 2) Someone has the stripe locked, but we're able to merge
663 * 3) Someone has the stripe locked, but we're not able to merge.
755 * rbios waiting for this stripe, the next one on the list will be started
792 * waiting for the chance to lock this stripe.
906 * get here, we've written a full stripe
936 * else. This function decides if a given index (stripe number)
937 * and page number in that stripe fall inside the original bio
968 * number of pages we need for the entire stripe across all the
1083 * add a single page from a specific stripe into our list of bios for IO
1097 struct btrfs_bio_stripe *stripe;
1100 stripe = &rbio->bbio->stripes[stripe_nr];
1101 disk_start = stripe->physical + (page_index << PAGE_SHIFT);
1103 /* if the device is missing, just fail this stripe */
1104 if (!stripe->dev->bdev)
1117 last->bi_disk == stripe->dev->bdev->bd_disk &&
1118 last->bi_partno == stripe->dev->bdev->bd_partno) {
1127 btrfs_io_bio(bio)->device = stripe->dev;
1129 bio_set_dev(bio, stripe->dev->bdev);
1157 * searching through the bio list as we setup the IO in finish_rmw or stripe
1192 * have a full stripe from the higher layers, or we've read all
1203 int stripe;
1222 /* at this point we either have a full stripe,
1223 * or we've read the full stripe from the drive.
1228 * change this stripe needs to do their own rmw.
1253 /* first collect one page from each data stripe */
1254 for (stripe = 0; stripe < nr_data; stripe++) {
1255 p = page_in_rbio(rbio, stripe, pagenr, 0);
1256 pointers[stripe] = kmap(p);
1259 /* then add the parity stripe */
1262 pointers[stripe++] = kmap(p);
1272 pointers[stripe++] = kmap(p);
1283 for (stripe = 0; stripe < rbio->real_stripes; stripe++)
1284 kunmap(page_in_rbio(rbio, stripe, pagenr, 0));
1292 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1296 /* This vertical stripe has no data, skip it. */
1300 if (stripe < rbio->nr_data) {
1301 page = page_in_rbio(rbio, stripe, pagenr, 1);
1305 page = rbio_stripe_page(rbio, stripe, pagenr);
1309 page, stripe, pagenr, rbio->stripe_len);
1318 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1319 if (!bbio->tgtdev_map[stripe])
1325 /* This vertical stripe has no data, skip it. */
1329 if (stripe < rbio->nr_data) {
1330 page = page_in_rbio(rbio, stripe, pagenr, 1);
1334 page = rbio_stripe_page(rbio, stripe, pagenr);
1338 rbio->bbio->tgtdev_map[stripe],
1366 * helper to find the stripe number for a given bio. Used to figure out which
1367 * stripe has failed. This expects the bio to correspond to a physical disk,
1375 struct btrfs_bio_stripe *stripe;
1380 stripe = &rbio->bbio->stripes[i];
1381 if (in_range(physical, stripe->physical, rbio->stripe_len) &&
1382 stripe->dev->bdev &&
1383 bio->bi_disk == stripe->dev->bdev->bd_disk &&
1384 bio->bi_partno == stripe->dev->bdev->bd_partno) {
1392 * helper to find the stripe number for a given
1393 * bio (before mapping). Used to figure out which stripe has
1421 /* we already know this stripe is bad, move on */
1443 * helper to fail a stripe based on a physical disk
1474 * stripe bios we've read from the disk so we can recalculate the parity of the
1475 * stripe.
1511 * the stripe must be locked by the caller. It will
1520 int stripe;
1534 * stripe
1536 for (stripe = 0; stripe < rbio->nr_data; stripe++) {
1543 * we don't need to read it off the stripe.
1545 page = page_in_rbio(rbio, stripe, pagenr, 1);
1549 page = rbio_stripe_page(rbio, stripe, pagenr);
1558 stripe, pagenr, rbio->stripe_len);
1570 * safe to do the full stripe write yet.
1606 * if the upper layers pass in a full stripe, we thank them by only allocating
1626 * partial stripe writes get handed over to async helpers.
1643 * a full stripe. So we do a check here to see if we can
1648 /* head off into rmw land if we don't have a full stripe */
1656 * Any time we get a partial stripe write while plugged
1707 /* we have a full stripe, send it down */
1838 int pagenr, stripe;
1873 * from each stripe
1875 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1882 (stripe == faila || stripe == failb)) {
1883 page = page_in_rbio(rbio, stripe, pagenr, 0);
1885 page = rbio_stripe_page(rbio, stripe, pagenr);
1887 pointers[stripe] = kmap(page);
1899 * Just the P stripe has failed, without
1900 * a bad data or Q stripe.
1917 /* if the q stripe is failed, do a pstripe reconstruction
1919 * If both the q stripe and the P stripe are failed, we're
1930 * otherwise we have one bad data stripe and
1931 * a good P stripe. raid5!
1947 /* rebuild from P stripe here (raid5 or raid6) */
1955 for (stripe = faila; stripe < rbio->nr_data - 1; stripe++)
1956 pointers[stripe] = pointers[stripe + 1];
1980 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1987 (stripe == faila || stripe == failb)) {
1988 page = page_in_rbio(rbio, stripe, pagenr, 0);
1990 page = rbio_stripe_page(rbio, stripe, pagenr);
2053 * we only read stripe pages off the disk, set them
2085 int stripe;
2104 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
2105 if (rbio->faila == stripe || rbio->failb == stripe) {
2112 rbio_stripe_page(rbio, stripe, pagenr),
2113 stripe, pagenr, rbio->stripe_len);
2193 "%s could not find the bad stripe in raid56 so that we cannot recover any more (bio has logical %llu len %llu, bbio has map_type %llu)",
2212 * for 'mirror_num > 2', select a stripe to fail on every retry.
2216 * 'mirror == 3' is to fail the p stripe and
2217 * reconstruct from the q stripe. 'mirror > 3' is to
2218 * fail a data stripe and reconstruct from p+q stripe.
2263 * The following code is used to scrub/replace the parity stripe
2295 * stripe.
2367 int stripe;
2407 /* RAID6, allocate and map temp space for the Q stripe */
2419 /* Map the parity stripe just once */
2425 /* first collect one page from each data stripe */
2426 for (stripe = 0; stripe < nr_data; stripe++) {
2427 p = page_in_rbio(rbio, stripe, pagenr, 0);
2428 pointers[stripe] = kmap(p);
2451 for (stripe = 0; stripe < nr_data; stripe++)
2452 kunmap(page_in_rbio(rbio, stripe, pagenr, 0));
2518 static inline int is_data_stripe(struct btrfs_raid_bio *rbio, int stripe)
2520 if (stripe >= 0 && stripe < rbio->nr_data)
2568 * Here means we got one corrupted data stripe and one
2571 * the data, or we can not repair the data stripe.
2588 * stripe bios we've read from the disk so we can recalculate the parity of the
2589 * stripe.
2622 int stripe;
2634 * stripe
2636 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
2643 * we don't need to read it off the stripe.
2645 page = page_in_rbio(rbio, stripe, pagenr, 1);
2649 page = rbio_stripe_page(rbio, stripe, pagenr);
2658 stripe, pagenr, rbio->stripe_len);
2670 * safe to do the full stripe write yet.