* the space before the first leaf entry needs to be free so it
                 * can be expanded to hold the pointer to the new entry.
                 */
-               if (INT_GET(enddup->freetag, ARCH_CONVERT) != XFS_DIR2_DATA_FREE_TAG)
+               if (be16_to_cpu(enddup->freetag) != XFS_DIR2_DATA_FREE_TAG)
                        dup = enddup = NULL;
                /*
                 * Check out the biggest freespace and see if it's the same one.
                                 * It is the biggest freespace, is it too small
                                 * to hold the new leaf too?
                                 */
-                               if (INT_GET(dup->length, ARCH_CONVERT) < len + (uint)sizeof(*blp)) {
+                               if (be16_to_cpu(dup->length) < len + (uint)sizeof(*blp)) {
                                        /*
                                         * Yes, we use the second-largest
                                         * entry instead if it works.
                                 * Not the same free entry,
                                 * just check its length.
                                 */
-                               if (INT_GET(dup->length, ARCH_CONVERT) < len) {
+                               if (be16_to_cpu(dup->length) < len) {
                                        dup = NULL;
                                }
                        }
                 * If it's not free then the data will go where the
                 * leaf data starts now, if it works at all.
                 */
-               if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) {
-                       if (INT_GET(dup->length, ARCH_CONVERT) + (INT_GET(btp->stale, ARCH_CONVERT) - 1) *
+               if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
+                       if (be16_to_cpu(dup->length) + (INT_GET(btp->stale, ARCH_CONVERT) - 1) *
                            (uint)sizeof(*blp) < len)
                                dup = NULL;
                } else if ((INT_GET(btp->stale, ARCH_CONVERT) - 1) * (uint)sizeof(*blp) < len)
                 */
                xfs_dir2_data_use_free(tp, bp, enddup,
                        (xfs_dir2_data_aoff_t)
-                       ((char *)enddup - (char *)block + INT_GET(enddup->length, ARCH_CONVERT) -
+                       ((char *)enddup - (char *)block + be16_to_cpu(enddup->length) -
                         sizeof(*blp)),
                        (xfs_dir2_data_aoff_t)sizeof(*blp),
                        &needlog, &needscan);
                /*
                 * Unused, skip it.
                 */
-               if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) {
-                       ptr += INT_GET(dup->length, ARCH_CONVERT);
+               if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
+                       ptr += be16_to_cpu(dup->length);
                        continue;
                }
 
        /*
         * If it's not free or is too short we can't do it.
         */
-       if (INT_GET(dup->freetag, ARCH_CONVERT) != XFS_DIR2_DATA_FREE_TAG || INT_GET(dup->length, ARCH_CONVERT) < size) {
+       if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG ||
+           be16_to_cpu(dup->length) < size) {
                error = 0;
                goto out;
        }
         */
        xfs_dir2_data_use_free(tp, bp, dup,
                (xfs_dir2_data_aoff_t)((char *)dup - (char *)block),
-               INT_GET(dup->length, ARCH_CONVERT), &needlog, &needscan);
+               be16_to_cpu(dup->length), &needlog, &needscan);
        /*
         * Create entry for .
         */
                if (offset < newoffset) {
                        dup = (xfs_dir2_data_unused_t *)
                              ((char *)block + offset);
-                       INT_SET(dup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-                       INT_SET(dup->length, ARCH_CONVERT, newoffset - offset);
+                       dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
+                       dup->length = cpu_to_be16(newoffset - offset);
                        INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT,
                                (xfs_dir2_data_off_t)
                                ((char *)dup - (char *)block));
                        xfs_dir2_data_log_unused(tp, bp, dup);
                        (void)xfs_dir2_data_freeinsert((xfs_dir2_data_t *)block,
                                dup, &dummy);
-                       offset += INT_GET(dup->length, ARCH_CONVERT);
+                       offset += be16_to_cpu(dup->length);
                        continue;
                }
                /*
 
                 * If we find it, account for that, else make sure it
                 * doesn't need to be there.
                 */
-               if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) {
+               if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
                        ASSERT(lastfree == 0);
                        ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT) ==
                               (char *)dup - (char *)d);
                                ASSERT((freeseen & (1 << i)) == 0);
                                freeseen |= 1 << i;
                        } else {
-                               ASSERT(INT_GET(dup->length, ARCH_CONVERT) <=
+                               ASSERT(be16_to_cpu(dup->length) <=
                                       be16_to_cpu(bf[2].length));
                        }
-                       p += INT_GET(dup->length, ARCH_CONVERT);
+                       p += be16_to_cpu(dup->length);
                        lastfree = 1;
                        continue;
                }
                ASSERT(seenzero == 0);
                if (be16_to_cpu(dfp->offset) == off) {
                        matched = 1;
-                       ASSERT(be16_to_cpu(dfp->length) == INT_GET(dup->length, ARCH_CONVERT));
+                       ASSERT(dfp->length == dup->length);
                } else if (off < be16_to_cpu(dfp->offset))
-                       ASSERT(off + INT_GET(dup->length, ARCH_CONVERT) <= be16_to_cpu(dfp->offset));
+                       ASSERT(off + be16_to_cpu(dup->length) <= be16_to_cpu(dfp->offset));
                else
                        ASSERT(be16_to_cpu(dfp->offset) + be16_to_cpu(dfp->length) <= off);
-               ASSERT(matched || be16_to_cpu(dfp->length) >= INT_GET(dup->length, ARCH_CONVERT));
+               ASSERT(matched || be16_to_cpu(dfp->length) >= be16_to_cpu(dup->length));
                if (dfp > &d->hdr.bestfree[0])
                        ASSERT(be16_to_cpu(dfp[-1].length) >= be16_to_cpu(dfp[0].length));
        }
         * If this is smaller than the smallest bestfree entry,
         * it can't be there since they're sorted.
         */
-       if (INT_GET(dup->length, ARCH_CONVERT) <
+       if (be16_to_cpu(dup->length) <
            be16_to_cpu(d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT - 1].length))
                return NULL;
        /*
                /*
                 * If it's a free entry, insert it.
                 */
-               if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) {
+               if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
                        ASSERT((char *)dup - (char *)d ==
                               INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT));
                        xfs_dir2_data_freeinsert(d, dup, loghead);
-                       p += INT_GET(dup->length, ARCH_CONVERT);
+                       p += be16_to_cpu(dup->length);
                }
                /*
                 * For active entries, check their tags and skip them.
         * Set up an unused entry for the block's body.
         */
        dup = &d->u[0].unused;
-       INT_SET(dup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
+       dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
 
        t=mp->m_dirblksize - (uint)sizeof(d->hdr);
        d->hdr.bestfree[0].length = cpu_to_be16(t);
-       INT_SET(dup->length, ARCH_CONVERT, t);
+       dup->length = cpu_to_be16(t);
        INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT,
                (xfs_dir2_data_off_t)((char *)dup - (char *)d));
        /*
 
                tagp = (xfs_dir2_data_off_t *)((char *)d + offset) - 1;
                prevdup = (xfs_dir2_data_unused_t *)((char *)d + INT_GET(*tagp, ARCH_CONVERT));
-               if (INT_GET(prevdup->freetag, ARCH_CONVERT) != XFS_DIR2_DATA_FREE_TAG)
+               if (be16_to_cpu(prevdup->freetag) != XFS_DIR2_DATA_FREE_TAG)
                        prevdup = NULL;
        } else
                prevdup = NULL;
        if ((char *)d + offset + len < endptr) {
                postdup =
                        (xfs_dir2_data_unused_t *)((char *)d + offset + len);
-               if (INT_GET(postdup->freetag, ARCH_CONVERT) != XFS_DIR2_DATA_FREE_TAG)
+               if (be16_to_cpu(postdup->freetag) != XFS_DIR2_DATA_FREE_TAG)
                        postdup = NULL;
        } else
                postdup = NULL;
                /*
                 * Fix up the new big freespace.
                 */
-               INT_MOD(prevdup->length, ARCH_CONVERT, len + INT_GET(postdup->length, ARCH_CONVERT));
+               be16_add(&prevdup->length, len + be16_to_cpu(postdup->length));
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)prevdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, prevdup);
                         */
                        dfp = xfs_dir2_data_freeinsert(d, prevdup, needlogp);
                        ASSERT(dfp == &d->hdr.bestfree[0]);
-                       ASSERT(be16_to_cpu(dfp->length) == INT_GET(prevdup->length, ARCH_CONVERT));
+                       ASSERT(dfp->length == prevdup->length);
                        ASSERT(!dfp[1].length);
                        ASSERT(!dfp[2].length);
                }
         */
        else if (prevdup) {
                dfp = xfs_dir2_data_freefind(d, prevdup);
-               INT_MOD(prevdup->length, ARCH_CONVERT, len);
+               be16_add(&prevdup->length, len);
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(prevdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)prevdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, prevdup);
                 * Otherwise we need a scan if the new entry is big enough.
                 */
                else {
-                       needscan = INT_GET(prevdup->length, ARCH_CONVERT) >
+                       needscan = be16_to_cpu(prevdup->length) >
                                   be16_to_cpu(d->hdr.bestfree[2].length);
                }
        }
        else if (postdup) {
                dfp = xfs_dir2_data_freefind(d, postdup);
                newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
-               INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-               INT_SET(newdup->length, ARCH_CONVERT, len + INT_GET(postdup->length, ARCH_CONVERT));
+               newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
+               newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup);
                 * Otherwise we need a scan if the new entry is big enough.
                 */
                else {
-                       needscan = INT_GET(newdup->length, ARCH_CONVERT) >
+                       needscan = be16_to_cpu(newdup->length) >
                                   be16_to_cpu(d->hdr.bestfree[2].length);
                }
        }
         */
        else {
                newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
-               INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-               INT_SET(newdup->length, ARCH_CONVERT, len);
+               newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
+               newdup->length = cpu_to_be16(len);
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup);
        d = bp->data;
        ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_DATA_MAGIC ||
               be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC);
-       ASSERT(INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG);
+       ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
        ASSERT(offset >= (char *)dup - (char *)d);
-       ASSERT(offset + len <= (char *)dup + INT_GET(dup->length, ARCH_CONVERT) - (char *)d);
+       ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d);
        ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT));
        /*
         * Look up the entry in the bestfree table.
         */
        dfp = xfs_dir2_data_freefind(d, dup);
-       oldlen = INT_GET(dup->length, ARCH_CONVERT);
+       oldlen = be16_to_cpu(dup->length);
        ASSERT(dfp || oldlen <= be16_to_cpu(d->hdr.bestfree[2].length));
        /*
         * Check for alignment with front and back of the entry.
         */
        else if (matchfront) {
                newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
-               INT_SET(newdup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-               INT_SET(newdup->length, ARCH_CONVERT, oldlen - len);
+               newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
+               newdup->length = cpu_to_be16(oldlen - len);
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup);
                        xfs_dir2_data_freeremove(d, dfp, needlogp);
                        dfp = xfs_dir2_data_freeinsert(d, newdup, needlogp);
                        ASSERT(dfp != NULL);
-                       ASSERT(be16_to_cpu(dfp->length) == INT_GET(newdup->length, ARCH_CONVERT));
+                       ASSERT(dfp->length == newdup->length);
                        ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)d);
                        /*
                         * If we got inserted at the last slot,
         */
        else if (matchback) {
                newdup = dup;
-               INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t)
-                       (((char *)d + offset) - (char *)newdup));
+               newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup);
                        xfs_dir2_data_freeremove(d, dfp, needlogp);
                        dfp = xfs_dir2_data_freeinsert(d, newdup, needlogp);
                        ASSERT(dfp != NULL);
-                       ASSERT(be16_to_cpu(dfp->length) == INT_GET(newdup->length, ARCH_CONVERT));
+                       ASSERT(dfp->length == newdup->length);
                        ASSERT(be16_to_cpu(dfp->offset) == (char *)newdup - (char *)d);
                        /*
                         * If we got inserted at the last slot,
         */
        else {
                newdup = dup;
-               INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t)
-                       (((char *)d + offset) - (char *)newdup));
+               newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup);
                newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
-               INT_SET(newdup2->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG);
-               INT_SET(newdup2->length, ARCH_CONVERT, oldlen - len - INT_GET(newdup->length, ARCH_CONVERT));
+               newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
+               newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
                INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(newdup2), ARCH_CONVERT,
                        (xfs_dir2_data_off_t)((char *)newdup2 - (char *)d));
                xfs_dir2_data_log_unused(tp, bp, newdup2);