Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[safe/jmp/linux-2.6] / fs / xfs / xfs_dir2_leaf.c
index b503651..db14ea7 100644 (file)
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_da_btree.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
@@ -135,8 +133,7 @@ xfs_dir2_block_to_leaf(
         */
        block->hdr.magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
        if (needscan)
-               xfs_dir2_data_freescan(mp, (xfs_dir2_data_t *)block, &needlog,
-                       NULL);
+               xfs_dir2_data_freescan(mp, (xfs_dir2_data_t *)block, &needlog);
        /*
         * Set up leaf tail and bests table.
         */
@@ -407,7 +404,7 @@ xfs_dir2_leaf_addname(
         * Initialize our new entry (at last).
         */
        dep = (xfs_dir2_data_entry_t *)dup;
-       INT_SET(dep->inumber, ARCH_CONVERT, args->inumber);
+       dep->inumber = cpu_to_be64(args->inumber);
        dep->namelen = args->namelen;
        memcpy(dep->name, args->name, dep->namelen);
        tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
@@ -416,7 +413,7 @@ xfs_dir2_leaf_addname(
         * Need to scan fix up the bestfree table.
         */
        if (needscan)
-               xfs_dir2_data_freescan(mp, data, &needlog, NULL);
+               xfs_dir2_data_freescan(mp, data, &needlog);
        /*
         * Need to log the data block's header.
         */
@@ -515,7 +512,7 @@ xfs_dir2_leaf_addname(
                        ASSERT(be32_to_cpu(leaf->ents[highstale].address) ==
                               XFS_DIR2_NULL_DATAPTR);
                        /*
-                        * Copy entries down to copver the stale entry
+                        * Copy entries down to cover the stale entry
                         * and make room for the new entry.
                         */
                        if (highstale - index > 0)
@@ -564,7 +561,7 @@ xfs_dir2_leaf_check(
 
        leaf = bp->data;
        mp = dp->i_mount;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
        /*
         * This value is not restrictive enough.
         * Should factor in the size of the bests table as well.
@@ -884,7 +881,7 @@ xfs_dir2_leaf_getdents(
                                        XFS_DIR2_BYTE_TO_DA(mp,
                                                XFS_DIR2_LEAF_OFFSET) - map_off,
                                        XFS_BMAPI_METADATA, NULL, 0,
-                                       &map[map_valid], &nmap, NULL);
+                                       &map[map_valid], &nmap, NULL, NULL);
                                /*
                                 * Don't know if we should ignore this or
                                 * try to return an error.
@@ -1098,7 +1095,7 @@ xfs_dir2_leaf_getdents(
 
                p->cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length);
 
-               p->ino = INT_GET(dep->inumber, ARCH_CONVERT);
+               p->ino = be64_to_cpu(dep->inumber);
 #if XFS_BIG_INUMS
                p->ino += mp->m_inoadd;
 #endif
@@ -1172,7 +1169,7 @@ xfs_dir2_leaf_init(
        /*
         * Initialize the header.
         */
-       INT_SET(leaf->hdr.info.magic, ARCH_CONVERT, magic);
+       leaf->hdr.info.magic = cpu_to_be16(magic);
        leaf->hdr.info.forw = 0;
        leaf->hdr.info.back = 0;
        leaf->hdr.count = 0;
@@ -1208,7 +1205,7 @@ xfs_dir2_leaf_log_bests(
        xfs_dir2_leaf_tail_t    *ltp;           /* leaf tail structure */
 
        leaf = bp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
        ltp = XFS_DIR2_LEAF_TAIL_P(tp->t_mountp, leaf);
        firstb = XFS_DIR2_LEAF_BESTS_P(ltp) + first;
        lastb = XFS_DIR2_LEAF_BESTS_P(ltp) + last;
@@ -1231,8 +1228,8 @@ xfs_dir2_leaf_log_ents(
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
 
        leaf = bp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC ||
-              INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
+              be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
        firstlep = &leaf->ents[first];
        lastlep = &leaf->ents[last];
        xfs_da_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf),
@@ -1250,8 +1247,8 @@ xfs_dir2_leaf_log_header(
        xfs_dir2_leaf_t         *leaf;          /* leaf structure */
 
        leaf = bp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC ||
-              INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
+              be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
        xfs_da_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf),
                (uint)(sizeof(leaf->hdr) - 1));
 }
@@ -1270,7 +1267,7 @@ xfs_dir2_leaf_log_tail(
 
        mp = tp->t_mountp;
        leaf = bp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
        ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
        xfs_da_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf),
                (uint)(mp->m_dirblksize - 1));
@@ -1319,7 +1316,7 @@ xfs_dir2_leaf_lookup(
        /*
         * Return the found inode number.
         */
-       args->inumber = INT_GET(dep->inumber, ARCH_CONVERT);
+       args->inumber = be64_to_cpu(dep->inumber);
        xfs_da_brelse(tp, dbp);
        xfs_da_brelse(tp, lbp);
        return XFS_ERROR(EEXIST);
@@ -1498,7 +1495,7 @@ xfs_dir2_leaf_removename(
         * log the data block header if necessary.
         */
        if (needscan)
-               xfs_dir2_data_freescan(mp, data, &needlog, NULL);
+               xfs_dir2_data_freescan(mp, data, &needlog);
        if (needlog)
                xfs_dir2_data_log_header(tp, dbp);
        /*
@@ -1606,11 +1603,11 @@ xfs_dir2_leaf_replace(
        dep = (xfs_dir2_data_entry_t *)
              ((char *)dbp->data +
               XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
-       ASSERT(args->inumber != INT_GET(dep->inumber, ARCH_CONVERT));
+       ASSERT(args->inumber != be64_to_cpu(dep->inumber));
        /*
         * Put the new inode number in, log it.
         */
-       INT_SET(dep->inumber, ARCH_CONVERT, args->inumber);
+       dep->inumber = cpu_to_be64(args->inumber);
        tp = args->trans;
        xfs_dir2_data_log_entry(tp, dbp, dep);
        xfs_da_buf_done(dbp);
@@ -1806,7 +1803,7 @@ xfs_dir2_node_to_leaf(
                return 0;
        lbp = state->path.blk[0].bp;
        leaf = lbp->data;
-       ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC);
+       ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
        /*
         * Read the freespace block.
         */
@@ -1837,7 +1834,7 @@ xfs_dir2_node_to_leaf(
                xfs_dir2_leaf_compact(args, lbp);
        else
                xfs_dir2_leaf_log_header(tp, lbp);
-       INT_SET(leaf->hdr.info.magic, ARCH_CONVERT, XFS_DIR2_LEAF1_MAGIC);
+       leaf->hdr.info.magic = cpu_to_be16(XFS_DIR2_LEAF1_MAGIC);
        /*
         * Set up the leaf tail from the freespace block.
         */