vserver 1.9.5.x5
[linux-2.6.git] / fs / xfs / xfs_rtalloc.c
index 524d8b2..2c37822 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -100,7 +100,9 @@ STATIC int
 xfs_lowbit32(
        __uint32_t      v)
 {
-       return ffs(v)-1;
+       if (v)
+               return ffs(v) - 1;
+       return -1;
 }
 
 /*
@@ -147,7 +149,7 @@ xfs_growfs_rt_alloc(
                /*
                 * Lock the inode.
                 */
-               if ((error = xfs_trans_iget(mp, tp, ino, XFS_ILOCK_EXCL, &ip)))
+               if ((error = xfs_trans_iget(mp, tp, ino, 0, XFS_ILOCK_EXCL, &ip)))
                        goto error_exit;
                XFS_BMAP_INIT(&flist, &firstblock);
                /*
@@ -187,7 +189,7 @@ xfs_growfs_rt_alloc(
                        /*
                         * Lock the bitmap inode.
                         */
-                       if ((error = xfs_trans_iget(mp, tp, ino, XFS_ILOCK_EXCL,
+                       if ((error = xfs_trans_iget(mp, tp, ino, 0, XFS_ILOCK_EXCL,
                                        &ip)))
                                goto error_exit;
                        /*
@@ -1964,7 +1966,8 @@ xfs_growfs_rt(
        /*
         * Calculate new parameters.  These are the final values to be reached.
         */
-       nrextents = do_div(nrblocks, in->extsize);
+       nrextents = nrblocks;
+       do_div(nrextents, in->extsize);
        nrbmblocks = roundup_64(nrextents, NBBY * sbp->sb_blocksize);
        nrextslog = xfs_highbit32(nrextents);
        nrsumlevels = nrextslog + 1;
@@ -2019,7 +2022,8 @@ xfs_growfs_rt(
                        XFS_RTMIN(nrblocks,
                                  nsbp->sb_rbmblocks * NBBY *
                                  nsbp->sb_blocksize * nsbp->sb_rextsize);
-               nsbp->sb_rextents = do_div(nsbp->sb_rblocks, nsbp->sb_rextsize);
+               nsbp->sb_rextents = nsbp->sb_rblocks;
+               do_div(nsbp->sb_rextents, nsbp->sb_rextsize);
                nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents);
                nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1;
                nrsumsize =
@@ -2038,7 +2042,7 @@ xfs_growfs_rt(
                /*
                 * Lock out other callers by grabbing the bitmap inode lock.
                 */
-               if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino,
+               if ((error = xfs_trans_iget(mp, tp, 0, mp->m_sb.sb_rbmino,
                                XFS_ILOCK_EXCL, &ip)))
                        goto error_exit;
                ASSERT(ip == mp->m_rbmip);
@@ -2053,7 +2057,7 @@ xfs_growfs_rt(
                 * Get the summary inode into the transaction.
                 */
                if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino,
-                               XFS_ILOCK_EXCL, &ip)))
+                               0, XFS_ILOCK_EXCL, &ip)))
                        goto error_exit;
                ASSERT(ip == mp->m_rsumip);
                /*
@@ -2173,7 +2177,7 @@ xfs_rtallocate_extent(
        /*
         * Lock out other callers by grabbing the bitmap inode lock.
         */
-       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, XFS_ILOCK_EXCL, &ip);
+       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip);
        if (error) {
                return error;
        }
@@ -2236,7 +2240,7 @@ xfs_rtfree_extent(
        /*
         * Synchronize by locking the bitmap inode.
         */
-       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, XFS_ILOCK_EXCL, &ip);
+       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip);
        if (error) {
                return error;
        }
@@ -2344,20 +2348,14 @@ xfs_rtmount_inodes(
        sbp = &mp->m_sb;
        if (sbp->sb_rbmino == NULLFSINO)
                return 0;
-       error = xfs_iget(mp, NULL, sbp->sb_rbmino, 0, &mp->m_rbmip, 0);
+       error = xfs_iget(mp, NULL, sbp->sb_rbmino, 0, 0, &mp->m_rbmip, 0);
        if (error)
                return error;
        ASSERT(mp->m_rbmip != NULL);
        ASSERT(sbp->sb_rsumino != NULLFSINO);
-       error = xfs_iget(mp, NULL, sbp->sb_rsumino, 0, &mp->m_rsumip, 0);
+       error = xfs_iget(mp, NULL, sbp->sb_rsumino, 0, 0, &mp->m_rsumip, 0);
        if (error) {
-               vnode_t         *rbmvp;         /* vnode for bitmap file */
-               vmap_t          vmap;           /* vmap to delete vnode */
-
-               rbmvp = XFS_ITOV(mp->m_rbmip);
-               VMAP(rbmvp, vmap);
-               VN_RELE(rbmvp);
-               vn_purge(rbmvp, &vmap);
+               VN_RELE(XFS_ITOV(mp->m_rbmip));
                return error;
        }
        ASSERT(mp->m_rsumip != NULL);
@@ -2386,7 +2384,7 @@ xfs_rtpick_extent(
        __uint64_t      seq;            /* sequence number of file creation */
        __uint64_t      *seqp;          /* pointer to seqno in inode */
 
-       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, XFS_ILOCK_EXCL, &ip);
+       error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, XFS_ILOCK_EXCL, &ip);
        if (error)
                return error;
        ASSERT(ip == mp->m_rbmip);