[XFS] stop using xfs_itobp in xfs_bulkstat
[safe/jmp/linux-2.6] / fs / xfs / xfs_itable.c
index 4feda54..3511803 100644 (file)
@@ -59,7 +59,6 @@ xfs_bulkstat_one_iget(
 {
        xfs_icdinode_t  *dic;   /* dinode core info pointer */
        xfs_inode_t     *ip;            /* incore inode pointer */
-       bhv_vnode_t     *vp;
        int             error;
 
        error = xfs_iget(mp, NULL, ino,
@@ -72,7 +71,6 @@ xfs_bulkstat_one_iget(
        ASSERT(ip != NULL);
        ASSERT(ip->i_blkno != (xfs_daddr_t)0);
 
-       vp = VFS_I(ip);
        dic = &ip->i_d;
 
        /* xfs_iget returns the following without needing
@@ -85,7 +83,7 @@ xfs_bulkstat_one_iget(
        buf->bs_uid = dic->di_uid;
        buf->bs_gid = dic->di_gid;
        buf->bs_size = dic->di_size;
-       vn_atime_to_bstime(vp, &buf->bs_atime);
+       vn_atime_to_bstime(VFS_I(ip), &buf->bs_atime);
        buf->bs_mtime.tv_sec = dic->di_mtime.t_sec;
        buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec;
        buf->bs_ctime.tv_sec = dic->di_ctime.t_sec;
@@ -361,7 +359,6 @@ xfs_bulkstat(
        int                     ubused; /* bytes used by formatter */
        xfs_buf_t               *bp;    /* ptr to on-disk inode cluster buf */
        xfs_dinode_t            *dip;   /* ptr into bp for specific inode */
-       xfs_inode_t             *ip;    /* ptr to in-core inode struct */
 
        /*
         * Get the last inode value, see if there's nothing to do.
@@ -418,8 +415,7 @@ xfs_bulkstat(
                /*
                 * Allocate and initialize a btree cursor for ialloc btree.
                 */
-               cur = xfs_btree_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_INO,
-                                               (xfs_inode_t *)0, 0);
+               cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno);
                irbp = irbuf;
                irbufend = irbuf + nirbuf;
                end_of_ag = 0;
@@ -474,7 +470,7 @@ xfs_bulkstat(
                         * In any case, increment to the next record.
                         */
                        if (!error)
-                               error = xfs_inobt_increment(cur, 0, &tmp);
+                               error = xfs_btree_increment(cur, 0, &tmp);
                } else {
                        /*
                         * Start of ag.  Lookup the first inode chunk.
@@ -541,7 +537,7 @@ xfs_bulkstat(
                         * Set agino to after this chunk and bump the cursor.
                         */
                        agino = gino + XFS_INODES_PER_CHUNK;
-                       error = xfs_inobt_increment(cur, 0, &tmp);
+                       error = xfs_btree_increment(cur, 0, &tmp);
                        cond_resched();
                }
                /*
@@ -588,6 +584,8 @@ xfs_bulkstat(
 
                                        if (flags & (BULKSTAT_FG_QUICK |
                                                     BULKSTAT_FG_INLINE)) {
+                                               int offset;
+
                                                ino = XFS_AGINO_TO_INO(mp, agno,
                                                                       agino);
                                                bno = XFS_AGB_TO_DADDR(mp, agno,
@@ -596,21 +594,15 @@ xfs_bulkstat(
                                                /*
                                                 * Get the inode cluster buffer
                                                 */
-                                               ASSERT(xfs_inode_zone != NULL);
-                                               ip = kmem_zone_zalloc(xfs_inode_zone,
-                                                                     KM_SLEEP);
-                                               ip->i_ino = ino;
-                                               ip->i_mount = mp;
-                                               spin_lock_init(&ip->i_flags_lock);
                                                if (bp)
                                                        xfs_buf_relse(bp);
-                                               error = xfs_itobp(mp, NULL, ip,
-                                                               &dip, &bp, bno,
-                                                               XFS_IMAP_BULKSTAT,
-                                                               XFS_BUF_LOCK);
+
+                                               error = xfs_inotobp(mp, NULL, ino, &dip,
+                                                                   &bp, &offset,
+                                                                   XFS_IMAP_BULKSTAT);
+
                                                if (!error)
-                                                       clustidx = ip->i_boffset / mp->m_sb.sb_inodesize;
-                                               kmem_zone_free(xfs_inode_zone, ip);
+                                                       clustidx = offset / mp->m_sb.sb_inodesize;
                                                if (XFS_TEST_ERROR(error != 0,
                                                                   mp, XFS_ERRTAG_BULKSTAT_READ_CHUNK,
                                                                   XFS_RANDOM_BULKSTAT_READ_CHUNK)) {
@@ -844,8 +836,7 @@ xfs_inumbers(
                                agino = 0;
                                continue;
                        }
-                       cur = xfs_btree_init_cursor(mp, NULL, agbp, agno,
-                               XFS_BTNUM_INO, (xfs_inode_t *)0, 0);
+                       cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno);
                        error = xfs_inobt_lookup_ge(cur, agino, 0, 0, &tmp);
                        if (error) {
                                xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
@@ -889,7 +880,7 @@ xfs_inumbers(
                        bufidx = 0;
                }
                if (left) {
-                       error = xfs_inobt_increment(cur, 0, &tmp);
+                       error = xfs_btree_increment(cur, 0, &tmp);
                        if (error) {
                                xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
                                cur = NULL;