aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 01:57:51 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 01:57:51 -0400
commitd4b3a4b7dd62f2e111d4d0afa9ef3f9b6cd955c0 (patch)
treecd0b5a46d81fa9d9b0253c489f64ad698e3a0fa9 /fs/xfs/xfs_alloc_btree.c
parent4b22a57188d87e873346b73c227607715be96399 (diff)
[XFS] move xfs_bmbt_killroot to common code
xfs_bmbt_killroot is a mostly generic implementation of moving from a real block based root to an inode based root. So move it to xfs_btree.c where it can use all the nice infrastructure there and make it pointer size agnostic The new name for it is xfs_btree_kill_iroot, following the old naming but making it clear we're dealing with the root in inode case here, and to avoid confusion with xfs_btree_new_root which is used for the not inode rooted case. I've also added a comment describing what it does and why it's named the way it is. SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32203a 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_alloc_btree.c')
-rw-r--r--fs/xfs/xfs_alloc_btree.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index 818adca77fc6..f124ddd91c08 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -834,6 +834,37 @@ xfs_allocbt_alloc_block(
834 return 0; 834 return 0;
835} 835}
836 836
837STATIC int
838xfs_allocbt_free_block(
839 struct xfs_btree_cur *cur,
840 struct xfs_buf *bp)
841{
842 struct xfs_buf *agbp = cur->bc_private.a.agbp;
843 struct xfs_agf *agf = XFS_BUF_TO_AGF(agbp);
844 xfs_agblock_t bno;
845 int error;
846
847 bno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(bp));
848 error = xfs_alloc_put_freelist(cur->bc_tp, agbp, NULL, bno, 1);
849 if (error)
850 return error;
851
852 /*
853 * Since blocks move to the free list without the coordination used in
854 * xfs_bmap_finish, we can't allow block to be available for
855 * reallocation and non-transaction writing (user data) until we know
856 * that the transaction that moved it to the free list is permanently
857 * on disk. We track the blocks by declaring these blocks as "busy";
858 * the busy list is maintained on a per-ag basis and each transaction
859 * records which entries should be removed when the iclog commits to
860 * disk. If a busy block is allocated, the iclog is pushed up to the
861 * LSN that freed the block.
862 */
863 xfs_alloc_mark_busy(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1);
864 xfs_trans_agbtree_delta(cur->bc_tp, -1);
865 return 0;
866}
867
837/* 868/*
838 * Update the longest extent in the AGF 869 * Update the longest extent in the AGF
839 */ 870 */
@@ -1025,6 +1056,7 @@ static const struct xfs_btree_ops xfs_allocbt_ops = {
1025 .dup_cursor = xfs_allocbt_dup_cursor, 1056 .dup_cursor = xfs_allocbt_dup_cursor,
1026 .set_root = xfs_allocbt_set_root, 1057 .set_root = xfs_allocbt_set_root,
1027 .alloc_block = xfs_allocbt_alloc_block, 1058 .alloc_block = xfs_allocbt_alloc_block,
1059 .free_block = xfs_allocbt_free_block,
1028 .update_lastrec = xfs_allocbt_update_lastrec, 1060 .update_lastrec = xfs_allocbt_update_lastrec,
1029 .get_maxrecs = xfs_allocbt_get_maxrecs, 1061 .get_maxrecs = xfs_allocbt_get_maxrecs,
1030 .init_key_from_rec = xfs_allocbt_init_key_from_rec, 1062 .init_key_from_rec = xfs_allocbt_init_key_from_rec,