diff options
author | Brian Foster <bfoster@redhat.com> | 2014-04-24 02:00:52 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-04-24 02:00:52 -0400 |
commit | aafc3c24652924ea951d215d04a3f42e832e9d7d (patch) | |
tree | f043c4c8dc0e307e6ed7e99acb284f8363a3e5c4 /fs/xfs/xfs_ialloc.c | |
parent | 8e2c84df20aa66ae9a6ee32831a9c622f4823118 (diff) |
xfs: support the XFS_BTNUM_FINOBT free inode btree type
Define the AGI fields for the finobt root/level and add magic
numbers. Update the btree code to add support for the new
XFS_BTNUM_FINOBT inode btree.
The finobt root block is reserved immediately following the inobt
root block in the AG. Update XFS_PREALLOC_BLOCKS() to determine the
starting AG data block based on whether finobt support is enabled.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index e67657288b9a..a0aead57a341 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -1488,7 +1488,16 @@ xfs_ialloc_compute_maxlevels( | |||
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | /* | 1490 | /* |
1491 | * Log specified fields for the ag hdr (inode section) | 1491 | * Log specified fields for the ag hdr (inode section). The growth of the agi |
1492 | * structure over time requires that we interpret the buffer as two logical | ||
1493 | * regions delineated by the end of the unlinked list. This is due to the size | ||
1494 | * of the hash table and its location in the middle of the agi. | ||
1495 | * | ||
1496 | * For example, a request to log a field before agi_unlinked and a field after | ||
1497 | * agi_unlinked could cause us to log the entire hash table and use an excessive | ||
1498 | * amount of log space. To avoid this behavior, log the region up through | ||
1499 | * agi_unlinked in one call and the region after agi_unlinked through the end of | ||
1500 | * the structure in another. | ||
1492 | */ | 1501 | */ |
1493 | void | 1502 | void |
1494 | xfs_ialloc_log_agi( | 1503 | xfs_ialloc_log_agi( |
@@ -1511,6 +1520,8 @@ xfs_ialloc_log_agi( | |||
1511 | offsetof(xfs_agi_t, agi_newino), | 1520 | offsetof(xfs_agi_t, agi_newino), |
1512 | offsetof(xfs_agi_t, agi_dirino), | 1521 | offsetof(xfs_agi_t, agi_dirino), |
1513 | offsetof(xfs_agi_t, agi_unlinked), | 1522 | offsetof(xfs_agi_t, agi_unlinked), |
1523 | offsetof(xfs_agi_t, agi_free_root), | ||
1524 | offsetof(xfs_agi_t, agi_free_level), | ||
1514 | sizeof(xfs_agi_t) | 1525 | sizeof(xfs_agi_t) |
1515 | }; | 1526 | }; |
1516 | #ifdef DEBUG | 1527 | #ifdef DEBUG |
@@ -1519,15 +1530,30 @@ xfs_ialloc_log_agi( | |||
1519 | agi = XFS_BUF_TO_AGI(bp); | 1530 | agi = XFS_BUF_TO_AGI(bp); |
1520 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); | 1531 | ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC)); |
1521 | #endif | 1532 | #endif |
1533 | |||
1534 | xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF); | ||
1535 | |||
1522 | /* | 1536 | /* |
1523 | * Compute byte offsets for the first and last fields. | 1537 | * Compute byte offsets for the first and last fields in the first |
1538 | * region and log the agi buffer. This only logs up through | ||
1539 | * agi_unlinked. | ||
1524 | */ | 1540 | */ |
1525 | xfs_btree_offsets(fields, offsets, XFS_AGI_NUM_BITS, &first, &last); | 1541 | if (fields & XFS_AGI_ALL_BITS_R1) { |
1542 | xfs_btree_offsets(fields, offsets, XFS_AGI_NUM_BITS_R1, | ||
1543 | &first, &last); | ||
1544 | xfs_trans_log_buf(tp, bp, first, last); | ||
1545 | } | ||
1546 | |||
1526 | /* | 1547 | /* |
1527 | * Log the allocation group inode header buffer. | 1548 | * Mask off the bits in the first region and calculate the first and |
1549 | * last field offsets for any bits in the second region. | ||
1528 | */ | 1550 | */ |
1529 | xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF); | 1551 | fields &= ~XFS_AGI_ALL_BITS_R1; |
1530 | xfs_trans_log_buf(tp, bp, first, last); | 1552 | if (fields) { |
1553 | xfs_btree_offsets(fields, offsets, XFS_AGI_NUM_BITS_R2, | ||
1554 | &first, &last); | ||
1555 | xfs_trans_log_buf(tp, bp, first, last); | ||
1556 | } | ||
1531 | } | 1557 | } |
1532 | 1558 | ||
1533 | #ifdef DEBUG | 1559 | #ifdef DEBUG |