diff options
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
| -rw-r--r-- | fs/xfs/xfs_ialloc.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 5d7f105a1c82..8f711db61a0c 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
| @@ -363,6 +363,18 @@ xfs_ialloc_ag_alloc( | |||
| 363 | args.minleft = args.mp->m_in_maxlevels - 1; | 363 | args.minleft = args.mp->m_in_maxlevels - 1; |
| 364 | if ((error = xfs_alloc_vextent(&args))) | 364 | if ((error = xfs_alloc_vextent(&args))) |
| 365 | return error; | 365 | return error; |
| 366 | |||
| 367 | /* | ||
| 368 | * This request might have dirtied the transaction if the AG can | ||
| 369 | * satisfy the request, but the exact block was not available. | ||
| 370 | * If the allocation did fail, subsequent requests will relax | ||
| 371 | * the exact agbno requirement and increase the alignment | ||
| 372 | * instead. It is critical that the total size of the request | ||
| 373 | * (len + alignment + slop) does not increase from this point | ||
| 374 | * on, so reset minalignslop to ensure it is not included in | ||
| 375 | * subsequent requests. | ||
| 376 | */ | ||
| 377 | args.minalignslop = 0; | ||
| 366 | } else | 378 | } else |
| 367 | args.fsbno = NULLFSBLOCK; | 379 | args.fsbno = NULLFSBLOCK; |
| 368 | 380 | ||
| @@ -1568,18 +1580,17 @@ xfs_agi_read_verify( | |||
| 1568 | struct xfs_buf *bp) | 1580 | struct xfs_buf *bp) |
| 1569 | { | 1581 | { |
| 1570 | struct xfs_mount *mp = bp->b_target->bt_mount; | 1582 | struct xfs_mount *mp = bp->b_target->bt_mount; |
| 1571 | int agi_ok = 1; | ||
| 1572 | |||
| 1573 | if (xfs_sb_version_hascrc(&mp->m_sb)) | ||
| 1574 | agi_ok = xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length), | ||
| 1575 | offsetof(struct xfs_agi, agi_crc)); | ||
| 1576 | agi_ok = agi_ok && xfs_agi_verify(bp); | ||
| 1577 | 1583 | ||
| 1578 | if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI, | 1584 | if (xfs_sb_version_hascrc(&mp->m_sb) && |
| 1579 | XFS_RANDOM_IALLOC_READ_AGI))) { | 1585 | !xfs_buf_verify_cksum(bp, XFS_AGI_CRC_OFF)) |
| 1580 | XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr); | 1586 | xfs_buf_ioerror(bp, EFSBADCRC); |
| 1587 | else if (XFS_TEST_ERROR(!xfs_agi_verify(bp), mp, | ||
| 1588 | XFS_ERRTAG_IALLOC_READ_AGI, | ||
| 1589 | XFS_RANDOM_IALLOC_READ_AGI)) | ||
| 1581 | xfs_buf_ioerror(bp, EFSCORRUPTED); | 1590 | xfs_buf_ioerror(bp, EFSCORRUPTED); |
| 1582 | } | 1591 | |
| 1592 | if (bp->b_error) | ||
| 1593 | xfs_verifier_error(bp); | ||
| 1583 | } | 1594 | } |
| 1584 | 1595 | ||
| 1585 | static void | 1596 | static void |
| @@ -1590,8 +1601,8 @@ xfs_agi_write_verify( | |||
| 1590 | struct xfs_buf_log_item *bip = bp->b_fspriv; | 1601 | struct xfs_buf_log_item *bip = bp->b_fspriv; |
| 1591 | 1602 | ||
| 1592 | if (!xfs_agi_verify(bp)) { | 1603 | if (!xfs_agi_verify(bp)) { |
| 1593 | XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, bp->b_addr); | ||
| 1594 | xfs_buf_ioerror(bp, EFSCORRUPTED); | 1604 | xfs_buf_ioerror(bp, EFSCORRUPTED); |
| 1605 | xfs_verifier_error(bp); | ||
| 1595 | return; | 1606 | return; |
| 1596 | } | 1607 | } |
| 1597 | 1608 | ||
| @@ -1600,8 +1611,7 @@ xfs_agi_write_verify( | |||
| 1600 | 1611 | ||
| 1601 | if (bip) | 1612 | if (bip) |
| 1602 | XFS_BUF_TO_AGI(bp)->agi_lsn = cpu_to_be64(bip->bli_item.li_lsn); | 1613 | XFS_BUF_TO_AGI(bp)->agi_lsn = cpu_to_be64(bip->bli_item.li_lsn); |
| 1603 | xfs_update_cksum(bp->b_addr, BBTOB(bp->b_length), | 1614 | xfs_buf_update_cksum(bp, XFS_AGI_CRC_OFF); |
| 1604 | offsetof(struct xfs_agi, agi_crc)); | ||
| 1605 | } | 1615 | } |
| 1606 | 1616 | ||
| 1607 | const struct xfs_buf_ops xfs_agi_buf_ops = { | 1617 | const struct xfs_buf_ops xfs_agi_buf_ops = { |
