diff options
-rw-r--r-- | drivers/md/raid5.c | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7e1cc07f3177..0b66afef2d82 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1516,130 +1516,6 @@ static void copy_data(int frombio, struct bio *bio, | |||
1516 | } \ | 1516 | } \ |
1517 | } while(0) | 1517 | } while(0) |
1518 | 1518 | ||
1519 | |||
1520 | static void compute_block(struct stripe_head *sh, int dd_idx) | ||
1521 | { | ||
1522 | int i, count, disks = sh->disks; | ||
1523 | void *ptr[MAX_XOR_BLOCKS], *dest, *p; | ||
1524 | |||
1525 | pr_debug("compute_block, stripe %llu, idx %d\n", | ||
1526 | (unsigned long long)sh->sector, dd_idx); | ||
1527 | |||
1528 | dest = page_address(sh->dev[dd_idx].page); | ||
1529 | memset(dest, 0, STRIPE_SIZE); | ||
1530 | count = 0; | ||
1531 | for (i = disks ; i--; ) { | ||
1532 | if (i == dd_idx) | ||
1533 | continue; | ||
1534 | p = page_address(sh->dev[i].page); | ||
1535 | if (test_bit(R5_UPTODATE, &sh->dev[i].flags)) | ||
1536 | ptr[count++] = p; | ||
1537 | else | ||
1538 | printk(KERN_ERR "compute_block() %d, stripe %llu, %d" | ||
1539 | " not present\n", dd_idx, | ||
1540 | (unsigned long long)sh->sector, i); | ||
1541 | |||
1542 | check_xor(); | ||
1543 | } | ||
1544 | if (count) | ||
1545 | xor_blocks(count, STRIPE_SIZE, dest, ptr); | ||
1546 | set_bit(R5_UPTODATE, &sh->dev[dd_idx].flags); | ||
1547 | } | ||
1548 | |||
1549 | static void compute_parity5(struct stripe_head *sh, int method) | ||
1550 | { | ||
1551 | raid5_conf_t *conf = sh->raid_conf; | ||
1552 | int i, pd_idx = sh->pd_idx, disks = sh->disks, count; | ||
1553 | void *ptr[MAX_XOR_BLOCKS], *dest; | ||
1554 | struct bio *chosen; | ||
1555 | |||
1556 | pr_debug("compute_parity5, stripe %llu, method %d\n", | ||
1557 | (unsigned long long)sh->sector, method); | ||
1558 | |||
1559 | count = 0; | ||
1560 | dest = page_address(sh->dev[pd_idx].page); | ||
1561 | switch(method) { | ||
1562 | case READ_MODIFY_WRITE: | ||
1563 | BUG_ON(!test_bit(R5_UPTODATE, &sh->dev[pd_idx].flags)); | ||
1564 | for (i=disks ; i-- ;) { | ||
1565 | if (i==pd_idx) | ||
1566 | continue; | ||
1567 | if (sh->dev[i].towrite && | ||
1568 | test_bit(R5_UPTODATE, &sh->dev[i].flags)) { | ||
1569 | ptr[count++] = page_address(sh->dev[i].page); | ||
1570 | chosen = sh->dev[i].towrite; | ||
1571 | sh->dev[i].towrite = NULL; | ||
1572 | |||
1573 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | ||
1574 | wake_up(&conf->wait_for_overlap); | ||
1575 | |||
1576 | BUG_ON(sh->dev[i].written); | ||
1577 | sh->dev[i].written = chosen; | ||
1578 | check_xor(); | ||
1579 | } | ||
1580 | } | ||
1581 | break; | ||
1582 | case RECONSTRUCT_WRITE: | ||
1583 | memset(dest, 0, STRIPE_SIZE); | ||
1584 | for (i= disks; i-- ;) | ||
1585 | if (i!=pd_idx && sh->dev[i].towrite) { | ||
1586 | chosen = sh->dev[i].towrite; | ||
1587 | sh->dev[i].towrite = NULL; | ||
1588 | |||
1589 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | ||
1590 | wake_up(&conf->wait_for_overlap); | ||
1591 | |||
1592 | BUG_ON(sh->dev[i].written); | ||
1593 | sh->dev[i].written = chosen; | ||
1594 | } | ||
1595 | break; | ||
1596 | case CHECK_PARITY: | ||
1597 | break; | ||
1598 | } | ||
1599 | if (count) { | ||
1600 | xor_blocks(count, STRIPE_SIZE, dest, ptr); | ||
1601 | count = 0; | ||
1602 | } | ||
1603 | |||
1604 | for (i = disks; i--;) | ||
1605 | if (sh->dev[i].written) { | ||
1606 | sector_t sector = sh->dev[i].sector; | ||
1607 | struct bio *wbi = sh->dev[i].written; | ||
1608 | while (wbi && wbi->bi_sector < sector + STRIPE_SECTORS) { | ||
1609 | copy_data(1, wbi, sh->dev[i].page, sector); | ||
1610 | wbi = r5_next_bio(wbi, sector); | ||
1611 | } | ||
1612 | |||
1613 | set_bit(R5_LOCKED, &sh->dev[i].flags); | ||
1614 | set_bit(R5_UPTODATE, &sh->dev[i].flags); | ||
1615 | } | ||
1616 | |||
1617 | switch(method) { | ||
1618 | case RECONSTRUCT_WRITE: | ||
1619 | case CHECK_PARITY: | ||
1620 | for (i=disks; i--;) | ||
1621 | if (i != pd_idx) { | ||
1622 | ptr[count++] = page_address(sh->dev[i].page); | ||
1623 | check_xor(); | ||
1624 | } | ||
1625 | break; | ||
1626 | case READ_MODIFY_WRITE: | ||
1627 | for (i = disks; i--;) | ||
1628 | if (sh->dev[i].written) { | ||
1629 | ptr[count++] = page_address(sh->dev[i].page); | ||
1630 | check_xor(); | ||
1631 | } | ||
1632 | } | ||
1633 | if (count) | ||
1634 | xor_blocks(count, STRIPE_SIZE, dest, ptr); | ||
1635 | |||
1636 | if (method != CHECK_PARITY) { | ||
1637 | set_bit(R5_UPTODATE, &sh->dev[pd_idx].flags); | ||
1638 | set_bit(R5_LOCKED, &sh->dev[pd_idx].flags); | ||
1639 | } else | ||
1640 | clear_bit(R5_UPTODATE, &sh->dev[pd_idx].flags); | ||
1641 | } | ||
1642 | |||
1643 | static void compute_parity6(struct stripe_head *sh, int method) | 1519 | static void compute_parity6(struct stripe_head *sh, int method) |
1644 | { | 1520 | { |
1645 | raid6_conf_t *conf = sh->raid_conf; | 1521 | raid6_conf_t *conf = sh->raid_conf; |