diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 01:56:32 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 01:56:32 -0400 |
commit | 278d0ca14e889c3932a05d1a68675252a12b3466 (patch) | |
tree | a228d171d4aded60b27639e30eca1bf58ed7daa6 /fs/xfs/xfs_ialloc_btree.c | |
parent | 38bb74237d2d94c1aced2ec626d7d0f317e360da (diff) |
[XFS] implement generic xfs_btree_update
From: Dave Chinner <dgc@sgi.com>
The most complicated part here is the lastrec tracking for the alloc
btree. Most logic is in the update_lastrec method which has to do some
hopefully good enough dirty magic to maintain it.
[hch: split out from bigger patch and a rework of the lastrec
logic]
SGI-PV: 985583
SGI-Modid: xfs-linux-melb:xfs-kern:32194a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Bill O'Donnell <billodo@sgi.com>
Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_ialloc_btree.c')
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c index cd8bb519cb5f..d080a6833a8d 100644 --- a/fs/xfs/xfs_ialloc_btree.c +++ b/fs/xfs/xfs_ialloc_btree.c | |||
@@ -1551,58 +1551,6 @@ xfs_inobt_insert( | |||
1551 | return 0; | 1551 | return 0; |
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | /* | ||
1555 | * Update the record referred to by cur, to the value given | ||
1556 | * by [ino, fcnt, free]. | ||
1557 | * This either works (return 0) or gets an EFSCORRUPTED error. | ||
1558 | */ | ||
1559 | int /* error */ | ||
1560 | xfs_inobt_update( | ||
1561 | xfs_btree_cur_t *cur, /* btree cursor */ | ||
1562 | xfs_agino_t ino, /* starting inode of chunk */ | ||
1563 | __int32_t fcnt, /* free inode count */ | ||
1564 | xfs_inofree_t free) /* free inode mask */ | ||
1565 | { | ||
1566 | xfs_inobt_block_t *block; /* btree block to update */ | ||
1567 | xfs_buf_t *bp; /* buffer containing btree block */ | ||
1568 | int error; /* error return value */ | ||
1569 | int ptr; /* current record number (updating) */ | ||
1570 | xfs_inobt_rec_t *rp; /* pointer to updated record */ | ||
1571 | |||
1572 | /* | ||
1573 | * Pick up the current block. | ||
1574 | */ | ||
1575 | bp = cur->bc_bufs[0]; | ||
1576 | block = XFS_BUF_TO_INOBT_BLOCK(bp); | ||
1577 | #ifdef DEBUG | ||
1578 | if ((error = xfs_btree_check_sblock(cur, block, 0, bp))) | ||
1579 | return error; | ||
1580 | #endif | ||
1581 | /* | ||
1582 | * Get the address of the rec to be updated. | ||
1583 | */ | ||
1584 | ptr = cur->bc_ptrs[0]; | ||
1585 | rp = XFS_INOBT_REC_ADDR(block, ptr, cur); | ||
1586 | /* | ||
1587 | * Fill in the new contents and log them. | ||
1588 | */ | ||
1589 | rp->ir_startino = cpu_to_be32(ino); | ||
1590 | rp->ir_freecount = cpu_to_be32(fcnt); | ||
1591 | rp->ir_free = cpu_to_be64(free); | ||
1592 | xfs_inobt_log_recs(cur, bp, ptr, ptr); | ||
1593 | /* | ||
1594 | * Updating first record in leaf. Pass new key value up to our parent. | ||
1595 | */ | ||
1596 | if (ptr == 1) { | ||
1597 | xfs_inobt_key_t key; /* key containing [ino] */ | ||
1598 | |||
1599 | key.ir_startino = cpu_to_be32(ino); | ||
1600 | if ((error = xfs_btree_updkey(cur, (union xfs_btree_key *)&key, 1))) | ||
1601 | return error; | ||
1602 | } | ||
1603 | return 0; | ||
1604 | } | ||
1605 | |||
1606 | STATIC struct xfs_btree_cur * | 1554 | STATIC struct xfs_btree_cur * |
1607 | xfs_inobt_dup_cursor( | 1555 | xfs_inobt_dup_cursor( |
1608 | struct xfs_btree_cur *cur) | 1556 | struct xfs_btree_cur *cur) |