]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
bump minor version for minor change - sync with recent kernel changes
authorNathan Scott <nathans@sgi.com>
Wed, 17 Apr 2002 05:34:30 +0000 (05:34 +0000)
committerNathan Scott <nathans@sgi.com>
Wed, 17 Apr 2002 05:34:30 +0000 (05:34 +0000)
(mainly do less endian swabbing on some code paths).

17 files changed:
VERSION
debian/changelog
doc/CHANGES
include/xfs_dinode.h
include/xfs_log.h
libxfs/xfs.h
libxfs/xfs_alloc.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_btree.c
libxfs/xfs_da_btree.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_data.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_dir2_node.c
libxfs/xfs_dir_leaf.c
libxfs/xfs_ialloc.c
libxlog/xfs_log_recover.c

diff --git a/VERSION b/VERSION
index a5c287cb163e78306d63ee57b976e185fa89c28a..d6fb318cbc8175844cc717ab48757b7eae7c77b0 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=0
-PKG_REVISION=3
+PKG_REVISION=4
 PKG_BUILD=0
index be8dec815d04ca83ca364e266dd533a0538b0806..066785d6961408b261599c9680e7118a1f01190b 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs (2.0.4-1) unstable; urgency=low
+
+  * New upstream release, minor changes only
+
+ -- Nathan Scott <nathans@debian.org>  Wed, 17 Apr 2002 15:30:52 +1000
+
 xfsprogs (2.0.3-1) unstable; urgency=low
 
   * New upstream bugfix release
index ba1eff256ea4f058154c6bebf3c30f0fb3052962..91c11469ce169b0c3b1c2f110111d0d708215bd9 100644 (file)
@@ -1,3 +1,7 @@
+xfsprogs-2.0.4 (17 April 2002)
+       - Minor update sync'ing with kernel changes (less endian
+         swabbing in libxfs code)
+
 xfsprogs-2.0.3 (13 April 2002)
        - Important build system update, was causing libxfs to be
          built incorrectly, which can cause xfs_repair to fail by
index 27641928addc6c2824d403c7ac3e107a7c08c0fa..4e5bb2a142fbb856196b2c2a800b0bb576f69244 100644 (file)
@@ -206,7 +206,7 @@ int xfs_cfork_q(xfs_dinode_core_t *dcp);
 #define        XFS_CFORK_Q_ARCH(dcp,arch)          xfs_cfork_q_arch(dcp,arch)
 #define        XFS_CFORK_Q(dcp)                    xfs_cfork_q(dcp)
 #else
-#define        XFS_CFORK_Q_ARCH(dcp,arch)          (INT_GET((dcp)->di_forkoff, arch) != 0)
+#define        XFS_CFORK_Q_ARCH(dcp,arch)          (!INT_ISZERO((dcp)->di_forkoff, arch))
 #define XFS_CFORK_Q(dcp)                    ((dcp)->di_forkoff != 0)
 
 #endif
index 3de4125f4c1402f3b7a951943a670efa8aaf190d..535305fa7c1b734be6ae866b2d108a593d58d766 100644 (file)
@@ -44,6 +44,8 @@
     
 #define CYCLE_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)], arch))
 #define BLOCK_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch))
+/* this is used in a spot where we might otherwise double-endian-flip */
+#define CYCLE_LSN_NOCONV(lsn,arch) (((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)])
 
 #ifdef __KERNEL__
 /*
index 6d486b7e007a47a94b0334b188153085928364b6..10679b9a355278a42bde4157f8d20e6d00f5ce05 100644 (file)
@@ -235,7 +235,7 @@ typedef __uint32_t inst_t;  /* an instruction */
 typedef enum { B_FALSE, B_TRUE } boolean_t;
 typedef struct { dev_t dev; } buftarg_t;
 #define STATIC
-#define ATTR_ROOT      1       /* use attrs in root namespace */
+#define ATTR_ROOT      0x0002  /* use attrs in root namespace */
 #define ENOATTR                ENODATA /* Attribute not found */
 #define EFSCORRUPTED   990     /* Filesystem is corrupted */
 #define ktrace_t       void
index 28fe364ffafa6f08ea84ce8ce1a52e01d335ffee..c4caa7f0909b3b8340b6170fb5f566534db1080e 100644 (file)
@@ -1921,7 +1921,7 @@ xfs_alloc_get_freelist(
        /*
         * Freelist is empty, give up.
         */
-       if (INT_GET(agf->agf_flcount, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(agf->agf_flcount, ARCH_CONVERT)) {
                *bnop = NULLAGBLOCK;
                return 0;
        }
index f3b02e0b840df17fb12486da64fa634076edb7a9..58b37a0bd4e10f85ffff87cc8c1e9cee24b8711f 100644 (file)
@@ -67,7 +67,7 @@ xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)
        hdr = &leaf->hdr;
        INT_SET(hdr->info.magic, ARCH_CONVERT, XFS_ATTR_LEAF_MAGIC);
        INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount));
-       if (INT_GET(hdr->firstused, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) {
                INT_SET(hdr->firstused, ARCH_CONVERT,
                        XFS_LBSIZE(dp->i_mount) - XFS_ATTR_LEAF_NAME_ALIGN);
        }
@@ -170,7 +170,7 @@ xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args)
                        sum += INT_GET(map->size, ARCH_CONVERT);
                        continue;
                }
-               if (INT_GET(map->size, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(map->size, ARCH_CONVERT))
                        continue;       /* no space in this map */
                tmp = entsize;
                if (INT_GET(map->base, ARCH_CONVERT)
@@ -302,8 +302,8 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
                bcopy(args->name, (char *)name_rmt->name, args->namelen);
                entry->flags |= XFS_ATTR_INCOMPLETE;
                /* just in case */
-               INT_SET(name_rmt->valuelen, ARCH_CONVERT, 0);
-               INT_SET(name_rmt->valueblk, ARCH_CONVERT, 0);
+               INT_ZERO(name_rmt->valuelen, ARCH_CONVERT);
+               INT_ZERO(name_rmt->valueblk, ARCH_CONVERT);
                args->rmtblkno = 1;
                args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen);
        }
@@ -316,8 +316,8 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
         */
        if (INT_GET(entry->nameidx, ARCH_CONVERT)
                                < INT_GET(hdr->firstused, ARCH_CONVERT)) {
-               INT_SET(hdr->firstused, ARCH_CONVERT,
-                                       INT_GET(entry->nameidx, ARCH_CONVERT));
+               /* both on-disk, don't endian-flip twice */
+               hdr->firstused = entry->nameidx;
        }
        ASSERT(INT_GET(hdr->firstused, ARCH_CONVERT)
                                >= ((INT_GET(hdr->count, ARCH_CONVERT)
@@ -368,12 +368,12 @@ xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp)
        hdr_d->info = hdr_s->info;      /* struct copy */
        INT_SET(hdr_d->firstused, ARCH_CONVERT, XFS_LBSIZE(mp));
        /* handle truncation gracefully */
-       if (INT_GET(hdr_d->firstused, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(hdr_d->firstused, ARCH_CONVERT)) {
                INT_SET(hdr_d->firstused, ARCH_CONVERT,
                                XFS_LBSIZE(mp) - XFS_ATTR_LEAF_NAME_ALIGN);
        }
-       INT_SET(hdr_d->usedbytes, ARCH_CONVERT, 0);
-       INT_SET(hdr_d->count, ARCH_CONVERT, 0);
+       INT_ZERO(hdr_d->usedbytes, ARCH_CONVERT);
+       INT_ZERO(hdr_d->count, ARCH_CONVERT);
        hdr_d->holes = 0;
        INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT,
                                        sizeof(xfs_attr_leaf_hdr_t));
@@ -727,7 +727,7 @@ xfs_attr_leaf_toosmall(xfs_da_state_t *state, int *action)
                 * Make altpath point to the block we want to keep and
                 * path point to the block we want to drop (this one).
                 */
-               forward = (INT_GET(info->forw, ARCH_CONVERT) != 0);
+               forward = (!INT_ISZERO(info->forw, ARCH_CONVERT));
                bcopy(&state->path, &state->altpath, sizeof(state->path));
                error = xfs_da_path_shift(state, &state->altpath, forward,
                                                 0, &retval);
@@ -871,13 +871,13 @@ xfs_attr_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
                tmp_leaf = (xfs_attr_leafblock_t *)tmpbuffer;
                tmp_hdr = &tmp_leaf->hdr;
                tmp_hdr->info = save_hdr->info; /* struct copy */
-               INT_SET(tmp_hdr->count, ARCH_CONVERT, 0);
+               INT_ZERO(tmp_hdr->count, ARCH_CONVERT);
                INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize);
-               if (INT_GET(tmp_hdr->firstused, ARCH_CONVERT) == 0) {
+               if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) {
                        INT_SET(tmp_hdr->firstused, ARCH_CONVERT,
                                state->blocksize - XFS_ATTR_LEAF_NAME_ALIGN);
                }
-               INT_SET(tmp_hdr->usedbytes, ARCH_CONVERT, 0);
+               INT_ZERO(tmp_hdr->usedbytes, ARCH_CONVERT);
                if (xfs_attr_leaf_order(save_blk->bp, drop_blk->bp)) {
                        xfs_attr_leaf_moveents(drop_leaf, 0, tmp_leaf, 0,
                                (int)INT_GET(drop_hdr->count, ARCH_CONVERT),
@@ -999,11 +999,10 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
                } else {
 #endif /* GROT */
                        INT_MOD(hdr_d->firstused, ARCH_CONVERT, -tmp);
-                       INT_SET(entry_d->hashval, ARCH_CONVERT,
-                                   INT_GET(entry_s->hashval, ARCH_CONVERT));
-                       INT_SET(entry_d->nameidx, ARCH_CONVERT,
-                                               INT_GET(hdr_d->firstused,
-                                                               ARCH_CONVERT));
+                       /* both on-disk, don't endian flip twice */
+                       entry_d->hashval = entry_s->hashval;
+                       /* both on-disk, don't endian flip twice */
+                       entry_d->nameidx = hdr_d->firstused;
                        entry_d->flags = entry_s->flags;
                        ASSERT(INT_GET(entry_d->nameidx, ARCH_CONVERT) + tmp
                                                        <= XFS_LBSIZE(mp));
@@ -1064,10 +1063,10 @@ xfs_attr_leaf_moveents(xfs_attr_leafblock_t *leaf_s, int start_s,
        INT_SET(hdr_d->freemap[0].size, ARCH_CONVERT,
                                INT_GET(hdr_d->firstused, ARCH_CONVERT)
                              - INT_GET(hdr_d->freemap[0].base, ARCH_CONVERT));
-       INT_SET(hdr_d->freemap[1].base, ARCH_CONVERT, 0);
-       INT_SET(hdr_d->freemap[2].base, ARCH_CONVERT, 0);
-       INT_SET(hdr_d->freemap[1].size, ARCH_CONVERT, 0);
-       INT_SET(hdr_d->freemap[2].size, ARCH_CONVERT, 0);
+       INT_ZERO(hdr_d->freemap[1].base, ARCH_CONVERT);
+       INT_ZERO(hdr_d->freemap[2].base, ARCH_CONVERT);
+       INT_ZERO(hdr_d->freemap[1].size, ARCH_CONVERT);
+       INT_ZERO(hdr_d->freemap[2].size, ARCH_CONVERT);
        hdr_s->holes = 1;       /* leaf may not be compact */
 }
 
@@ -1112,7 +1111,7 @@ xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count)
                                                == XFS_ATTR_LEAF_MAGIC);
        if (count)
                *count = INT_GET(leaf->hdr.count, ARCH_CONVERT);
-       if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT))
                return(0);
        return(INT_GET(leaf->entries[INT_GET(leaf->hdr.count,
                                ARCH_CONVERT)-1].hashval, ARCH_CONVERT));
index 86353348232c397f35560a099329766401130f12..34d3f55db8a054aa47421ca2799807c45094bb54 100644 (file)
@@ -184,10 +184,10 @@ xfs_btree_check_lblock(
                INT_GET(block->bb_level, ARCH_CONVERT) == level &&
                INT_GET(block->bb_numrecs, ARCH_CONVERT) <=
                        xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
-               INT_GET(block->bb_leftsib, ARCH_CONVERT) != 0 &&
+               !INT_ISZERO(block->bb_leftsib, ARCH_CONVERT) &&
                (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLDFSBNO ||
                 XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_leftsib, ARCH_CONVERT))) &&
-               INT_GET(block->bb_rightsib, ARCH_CONVERT) != 0 &&
+               !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT) &&
                (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLDFSBNO ||
                 XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_rightsib, ARCH_CONVERT)));
        if (XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK,
@@ -308,10 +308,10 @@ xfs_btree_check_sblock(
                        xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
                (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLAGBLOCK ||
                 INT_GET(block->bb_leftsib, ARCH_CONVERT) < agflen) &&
-               INT_GET(block->bb_leftsib, ARCH_CONVERT) != 0 &&
+               !INT_ISZERO(block->bb_leftsib, ARCH_CONVERT) &&
                (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK ||
                 INT_GET(block->bb_rightsib, ARCH_CONVERT) < agflen) &&
-               INT_GET(block->bb_rightsib, ARCH_CONVERT) != 0;
+               !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT);
        if (XFS_TEST_ERROR(!sblock_ok, cur->bc_mp,
                        XFS_ERRTAG_BTREE_CHECK_SBLOCK,
                        XFS_RANDOM_BTREE_CHECK_SBLOCK)) {
@@ -472,7 +472,7 @@ xfs_btree_firstrec(
        /*
         * It's empty, there is no such record.
         */
-       if (INT_GET(block->bb_h.bb_numrecs, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT))
                return 0;
        /*
         * Set the ptr value to 1, that's the first record/key.
@@ -686,7 +686,7 @@ xfs_btree_lastrec(
        /*
         * It's empty, there is no such record.
         */
-       if (INT_GET(block->bb_h.bb_numrecs, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT))
                return 0;
        /*
         * Set the ptr value to numrecs, that's the last record/key.
index 4d7ed947f4dcec88ba538649afbda55514a27828..70f60f7ff99686b9070d5470b196ac00963e3951 100644 (file)
@@ -738,8 +738,8 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk)
        } else {
                ASSERT(INT_GET(blkinfo->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC);
        }
-       ASSERT(INT_GET(blkinfo->forw, ARCH_CONVERT) == 0);
-       ASSERT(INT_GET(blkinfo->back, ARCH_CONVERT) == 0);
+       ASSERT(INT_ISZERO(blkinfo->forw, ARCH_CONVERT));
+       ASSERT(INT_ISZERO(blkinfo->back, ARCH_CONVERT));
        bcopy(bp->data, root_blk->bp->data, state->blocksize);
        xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);
        error = xfs_da_shrink_inode(args, child, bp);
@@ -1344,7 +1344,7 @@ xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count)
        ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC);
        if (count)
                *count = INT_GET(node->hdr.count, ARCH_CONVERT);
-       if (INT_GET(node->hdr.count, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(node->hdr.count, ARCH_CONVERT))
                return(0);
        return(INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT));
 }
@@ -2157,7 +2157,7 @@ xfs_da_do_buf(
                                   (magic != XFS_DIR2_LEAFN_MAGIC) &&
                                   (magic1 != XFS_DIR2_BLOCK_MAGIC) &&
                                   (magic1 != XFS_DIR2_DATA_MAGIC) &&
-                                  (magic1 != XFS_DIR2_FREE_MAGIC),
+                                  (INT_GET(free->hdr.magic, ARCH_CONVERT) != XFS_DIR2_FREE_MAGIC),
                                mp, XFS_ERRTAG_DA_READ_BUF,
                                XFS_RANDOM_DA_READ_BUF)) {
                        xfs_buftrace("DA READ ERROR", rbp->bps[0]);
index 6508475daf65e396b864c11d86ee46f058f0f431..a8ca760f96aff18f5b6de5a62a9da4f604ebd613 100644 (file)
@@ -101,7 +101,7 @@ xfs_dir2_block_addname(
        /*
         * No stale entries?  Need space for entry and new leaf.
         */
-       if (INT_GET(btp->stale, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(btp->stale, ARCH_CONVERT)) {
                /*
                 * Tag just before the first leaf entry.
                 */
@@ -289,7 +289,7 @@ xfs_dir2_block_addname(
        /*
         * No stale entries, will use enddup space to hold new leaf.
         */
-       if (INT_GET(btp->stale, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(btp->stale, ARCH_CONVERT)) {
                /*
                 * Mark the space needed for the new leaf entry, now in use.
                 */
@@ -828,7 +828,7 @@ xfs_dir2_leaf_to_block(
         */
        btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
        INT_SET(btp->count, ARCH_CONVERT, INT_GET(leaf->hdr.count, ARCH_CONVERT) - INT_GET(leaf->hdr.stale, ARCH_CONVERT));
-       INT_SET(btp->stale, ARCH_CONVERT, 0);
+       INT_ZERO(btp->stale, ARCH_CONVERT);
        xfs_dir2_block_log_tail(tp, dbp);
        /*
         * Initialize the block leaf area.  We compact out stale entries.
index 9ef50b90af97469f4e9e56e15f16945e9f0e9d6e..34cab2399a25dbb30126cd99b13a2d5f6ddd8b79 100644 (file)
@@ -82,16 +82,16 @@ xfs_dir2_data_check(
        /*
         * Account for zero bestfree entries.
         */
-       if (INT_GET(bf[0].length, ARCH_CONVERT) == 0) {
-               ASSERT(INT_GET(bf[0].offset, ARCH_CONVERT) == 0);
+       if (INT_ISZERO(bf[0].length, ARCH_CONVERT)) {
+               ASSERT(INT_ISZERO(bf[0].offset, ARCH_CONVERT));
                freeseen |= 1 << 0;
        }
-       if (INT_GET(bf[1].length, ARCH_CONVERT) == 0) {
-               ASSERT(INT_GET(bf[1].offset, ARCH_CONVERT) == 0);
+       if (INT_ISZERO(bf[1].length, ARCH_CONVERT)) {
+               ASSERT(INT_ISZERO(bf[1].offset, ARCH_CONVERT));
                freeseen |= 1 << 1;
        }
-       if (INT_GET(bf[2].length, ARCH_CONVERT) == 0) {
-               ASSERT(INT_GET(bf[2].offset, ARCH_CONVERT) == 0);
+       if (INT_ISZERO(bf[2].length, ARCH_CONVERT)) {
+               ASSERT(INT_ISZERO(bf[2].offset, ARCH_CONVERT));
                freeseen |= 1 << 2;
        }
        ASSERT(INT_GET(bf[0].length, ARCH_CONVERT) >= INT_GET(bf[1].length, ARCH_CONVERT));
@@ -193,8 +193,8 @@ xfs_dir2_data_freefind(
        for (dfp = &d->hdr.bestfree[0], seenzero = matched = 0;
             dfp < &d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT];
             dfp++) {
-               if (INT_GET(dfp->offset, ARCH_CONVERT) == 0) {
-                       ASSERT(INT_GET(dfp->length, ARCH_CONVERT) == 0);
+               if (INT_ISZERO(dfp->offset, ARCH_CONVERT)) {
+                       ASSERT(INT_ISZERO(dfp->length, ARCH_CONVERT));
                        seenzero = 1;
                        continue;
                }
@@ -223,7 +223,7 @@ xfs_dir2_data_freefind(
        for (dfp = &d->hdr.bestfree[0];
             dfp < &d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT];
             dfp++) {
-               if (INT_GET(dfp->offset, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(dfp->offset, ARCH_CONVERT))
                        return NULL;
                if (INT_GET(dfp->offset, ARCH_CONVERT) == off)
                        return dfp;
@@ -584,7 +584,7 @@ xfs_dir2_data_make_free(
                 * since the third bestfree is there, there might be more
                 * entries.
                 */
-               needscan = INT_GET(d->hdr.bestfree[2].length, ARCH_CONVERT) != 0;
+               needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT);
                /*
                 * Fix up the new big freespace.
                 */
@@ -613,8 +613,8 @@ xfs_dir2_data_make_free(
                        dfp = xfs_dir2_data_freeinsert(d, prevdup, needlogp);
                        ASSERT(dfp == &d->hdr.bestfree[0]);
                        ASSERT(INT_GET(dfp->length, ARCH_CONVERT) == INT_GET(prevdup->length, ARCH_CONVERT));
-                       ASSERT(INT_GET(dfp[1].length, ARCH_CONVERT) == 0);
-                       ASSERT(INT_GET(dfp[2].length, ARCH_CONVERT) == 0);
+                       ASSERT(INT_ISZERO(dfp[1].length, ARCH_CONVERT));
+                       ASSERT(INT_ISZERO(dfp[2].length, ARCH_CONVERT));
                }
        }
        /*
@@ -730,7 +730,7 @@ xfs_dir2_data_use_free(
         */
        if (matchfront && matchback) {
                if (dfp) {
-                       needscan = INT_GET(d->hdr.bestfree[2].offset, ARCH_CONVERT) != 0;
+                       needscan = !INT_ISZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT);
                        if (!needscan)
                                xfs_dir2_data_freeremove(d, dfp, needlogp);
                }
@@ -817,7 +817,7 @@ xfs_dir2_data_use_free(
                 * the 2 new will work.
                 */
                if (dfp) {
-                       needscan = INT_GET(d->hdr.bestfree[2].length, ARCH_CONVERT) != 0;
+                       needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT);
                        if (!needscan) {
                                xfs_dir2_data_freeremove(d, dfp, needlogp);
                                (void)xfs_dir2_data_freeinsert(d, newdup,
index 19a68b20825b9a24428f0f3cb3adcc363c846405..e1902936a9456bbcf44b2efa189c13909cc71723 100644 (file)
@@ -237,7 +237,7 @@ xfs_dir2_leaf_addname(
         * How many bytes do we need in the leaf block?
         */
        needbytes =
-               (INT_GET(leaf->hdr.stale, ARCH_CONVERT) != 0 ? 0 : (uint)sizeof(leaf->ents[0])) +
+               (!INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT) ? 0 : (uint)sizeof(leaf->ents[0])) +
                (use_block != -1 ? 0 : (uint)sizeof(leaf->bests[0]));
        /*
         * Now kill use_block if it refers to a missing block, so we
@@ -419,7 +419,7 @@ xfs_dir2_leaf_addname(
         * Now we need to make room to insert the leaf entry.
         * If there are no stale entries, we just insert a hole at index.
         */
-       if (INT_GET(leaf->hdr.stale, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) {
                /*
                 * lep is still good as the index leaf entry.
                 */
@@ -589,7 +589,7 @@ xfs_dir2_leaf_compact(
        int             to;             /* target leaf index */
 
        leaf = bp->data;
-       if (INT_GET(leaf->hdr.stale, ARCH_CONVERT) == 0) {
+       if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) {
                return;
        }
        /*
@@ -613,7 +613,7 @@ xfs_dir2_leaf_compact(
         */
        ASSERT(INT_GET(leaf->hdr.stale, ARCH_CONVERT) == from - to);
        INT_MOD(leaf->hdr.count, ARCH_CONVERT, -(INT_GET(leaf->hdr.stale, ARCH_CONVERT)));
-       INT_SET(leaf->hdr.stale, ARCH_CONVERT, 0);
+       INT_ZERO(leaf->hdr.stale, ARCH_CONVERT);
        xfs_dir2_leaf_log_header(args->trans, bp);
        if (loglow != -1)
                xfs_dir2_leaf_log_ents(args->trans, bp, loglow, to - 1);
@@ -779,7 +779,7 @@ xfs_dir2_leaf_init(
         */
        if (magic == XFS_DIR2_LEAF1_MAGIC) {
                ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
-               INT_SET(ltp->bestcount, ARCH_CONVERT, 0);
+               INT_ZERO(ltp->bestcount, ARCH_CONVERT);
                xfs_dir2_leaf_log_tail(tp, bp);
        }
        *bpp = bp;
@@ -1233,7 +1233,7 @@ xfs_dir2_leaf_search_hash(
 
        leaf = lbp->data;
 #ifndef __KERNEL__
-       if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT))
                return 0;
 #endif
        /*
index 743923f157aa3a4badc7106623934a81041d7b78..2f995fd3ccd748ad93f8af0d9eebdb5e4a43be13 100644 (file)
@@ -950,7 +950,7 @@ xfs_dir2_leafn_remove(
                         * If there are no useful entries left in the block,
                         * get rid of the block if we can.
                         */
-                       if (INT_GET(free->hdr.nused, ARCH_CONVERT) == 0) {
+                       if (INT_ISZERO(free->hdr.nused, ARCH_CONVERT)) {
                                error = xfs_dir2_shrink_inode(args, fdb, fbp);
                                if (error == 0) {
                                        fbp = NULL;
index f0abc762e89d4b4572bfa4a424acf791ce5d6c3e..67a7c9d207eedb80b65e40ceab30e097d03626f9 100644 (file)
@@ -458,7 +458,7 @@ xfs_dir_leaf_to_shortform(xfs_da_args_t *iargs)
        args.justcheck = 0;
        args.addname = args.oknoent = 1;
        for (i = 0; i < INT_GET(hdr->count, ARCH_CONVERT); entry++, i++) {
-               if (INT_GET(entry->nameidx, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(entry->nameidx, ARCH_CONVERT))
                        continue;
                namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT));
                args.name = (char *)(namest->name);
@@ -652,7 +652,7 @@ xfs_dir_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args, int index)
                        sum += INT_GET(map->size, ARCH_CONVERT);
                        continue;
                }
-               if (INT_GET(map->size, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(map->size, ARCH_CONVERT))
                        continue;       /* no space in this map */
                tmp = entsize;
                if (INT_GET(map->base, ARCH_CONVERT) < INT_GET(hdr->firstused, ARCH_CONVERT))
@@ -817,7 +817,7 @@ xfs_dir_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp, int musthave,
        hdr_d = &leaf_d->hdr;
        hdr_d->info = hdr_s->info;      /* struct copy */
        INT_SET(hdr_d->firstused, ARCH_CONVERT, lbsize);
-       if (INT_GET(hdr_d->firstused, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(hdr_d->firstused, ARCH_CONVERT))
                INT_SET(hdr_d->firstused, ARCH_CONVERT, lbsize - 1);
        INT_ZERO(hdr_d->namebytes, ARCH_CONVERT);
        INT_ZERO(hdr_d->count, ARCH_CONVERT);
@@ -1333,7 +1333,7 @@ xfs_dir_leaf_remove(xfs_trans_t *trans, xfs_dabuf_t *bp, int index)
                                tmp = INT_GET(entry->nameidx, ARCH_CONVERT);
                }
                INT_SET(hdr->firstused, ARCH_CONVERT, tmp);
-               if (INT_GET(hdr->firstused, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(hdr->firstused, ARCH_CONVERT))
                        INT_SET(hdr->firstused, ARCH_CONVERT, tmp - 1);
        } else {
                hdr->holes = 1;         /* mark as needing compaction */
@@ -1415,7 +1415,7 @@ xfs_dir_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk,
                tmp_hdr->info = save_hdr->info; /* struct copy */
                INT_ZERO(tmp_hdr->count, ARCH_CONVERT);
                INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize);
-               if (INT_GET(tmp_hdr->firstused, ARCH_CONVERT) == 0)
+               if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT))
                        INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize - 1);
                INT_ZERO(tmp_hdr->namebytes, ARCH_CONVERT);
                if (xfs_dir_leaf_order(save_blk->bp, drop_blk->bp)) {
@@ -1490,7 +1490,7 @@ xfs_dir_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args, int *index)
                        break;
        }
        ASSERT((probe >= 0) && \
-              ((INT_GET(leaf->hdr.count, ARCH_CONVERT) == 0) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT))));
+              ((INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT))));
        ASSERT((span <= 4) || (INT_GET(entry->hashval, ARCH_CONVERT) == hashval));
 
        /*
@@ -1684,7 +1684,7 @@ xfs_dir_leaf_lasthash(xfs_dabuf_t *bp, int *count)
        ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR_LEAF_MAGIC);
        if (count)
                *count = INT_GET(leaf->hdr.count, ARCH_CONVERT);
-       if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == 0)
+       if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT))
                return(0);
        return(INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT));
 }
index cc6eb3c832a9abab50f8489a9f34d23e41c7a739..680c8b25cff00a88efbf28418d4ad289bf50f01d 100644 (file)
@@ -370,8 +370,11 @@ xfs_ialloc_ag_select(
        agcount = mp->m_maxagi;
        if (S_ISDIR(mode))
                pagno = atomicIncWithWrap((int *)&mp->m_agirotor, agcount);
-       else
+       else {
                pagno = XFS_INO_TO_AGNO(mp, parent);
+               if (pagno >= agcount)
+                       pagno = 0;
+       }
        ASSERT(pagno < agcount);
        /*
         * Loop through allocation groups, looking for one with a little
@@ -442,7 +445,7 @@ nextag:
                if (XFS_FORCED_SHUTDOWN(mp))
                        return (xfs_buf_t *)0;
                agno++;
-               if (agno == agcount)
+               if (agno >= agcount)
                        agno = 0;
                if (agno == pagno) {
                        if (flags == 0)
@@ -565,7 +568,7 @@ xfs_dialloc(
         * allocation groups upward, wrapping at the end.
         */
        *alloc_done = B_FALSE;
-       while (INT_GET(agi->agi_freecount, ARCH_CONVERT) == 0) {
+       while (INT_ISZERO(agi->agi_freecount, ARCH_CONVERT)) {
                /* 
                 * Don't do anything if we're not supposed to allocate
                 * any blocks, just go on to the next ag.
@@ -1166,7 +1169,7 @@ xfs_ialloc_read_agi(
        }
 #ifdef DEBUG
        for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++)
-               ASSERT(INT_GET(agi->agi_unlinked[i], ARCH_CONVERT) != 0);
+               ASSERT(!INT_ISZERO(agi->agi_unlinked[i], ARCH_CONVERT));
 #endif
        XFS_BUF_SET_VTYPE_REF(bp, B_FS_AGI, XFS_AGI_REF);
        *bpp = bp;
index be7e6c272ef2354782bb9e61fb47b35fa395860b..c1c31baca3d799b4667afb998e3f60b7fb2497c1 100644 (file)
@@ -766,7 +766,8 @@ xlog_unpack_data(xlog_rec_header_t *rhead,
 #endif
 
        for (i=0; i<BTOBB(INT_GET(rhead->h_len, ARCH_CONVERT)); i++) {
-               INT_SET(*(uint *)dp, ARCH_CONVERT, INT_GET(*(uint *)&rhead->h_cycle_data[i], ARCH_CONVERT));
+               /* these are both on-disk, so don't endian flip twice */
+               *(uint *)dp = *(uint *)&rhead->h_cycle_data[i];
                dp += BBSIZE;
        }
 #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)