From: Nathan Scott Date: Tue, 19 Apr 2005 03:57:24 +0000 (+0000) Subject: Merge back kernel changes into libxfs, mainly endian stuff. X-Git-Tag: v2.7.0~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46eca962f98661d3893ace3bae01b1d9f8be1a58;p=thirdparty%2Fxfsprogs-dev.git Merge back kernel changes into libxfs, mainly endian stuff. Merge of master-melb:xfs-cmds:22256a by kenmcd. --- diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 6551bcf88..f99f04b5a 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -1,32 +1,32 @@ /* * 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 * published by the Free Software Foundation. - * + * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * + * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * + * * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ @@ -682,7 +682,7 @@ main(int argc, char **argv) sbp = libxfs_readbuf(xargs.ddev, XFS_SB_DADDR, 1, 0); memset(&mbuf, 0, sizeof(xfs_mount_t)); sb = &mbuf.m_sb; - libxfs_xlate_sb(XFS_BUF_PTR(sbp), sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(sbp), sb, 1, XFS_SB_ALL_BITS); mp = libxfs_mount(&mbuf, sb, xargs.ddev, xargs.logdev, xargs.rtdev, 1); if (mp == NULL) { diff --git a/db/bmap.c b/db/bmap.c index 042824c78..4c4f61397 100644 --- a/db/bmap.c +++ b/db/bmap.c @@ -88,13 +88,13 @@ bmap( n = 0; eoffset = offset + len - 1; curoffset = offset; - fmt = (xfs_dinode_fmt_t)XFS_DFORK_FORMAT_ARCH(dip, whichfork, ARCH_CONVERT); + fmt = (xfs_dinode_fmt_t)XFS_DFORK_FORMAT(dip, whichfork); typ = whichfork == XFS_DATA_FORK ? TYP_BMAPBTD : TYP_BMAPBTA; ASSERT(typtab[typ].typnm == typ); ASSERT(fmt == XFS_DINODE_FMT_EXTENTS || fmt == XFS_DINODE_FMT_BTREE); if (fmt == XFS_DINODE_FMT_EXTENTS) { - nextents = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); - xp = (xfs_bmbt_rec_64_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + nextents = XFS_DFORK_NEXTENTS(dip, whichfork); + xp = (xfs_bmbt_rec_64_t *)XFS_DFORK_PTR(dip, whichfork); for (ep = xp; ep < &xp[nextents] && n < nex; ep++) { if (!bmap_one_extent(ep, &curoffset, eoffset, &n, bep)) break; @@ -102,8 +102,8 @@ bmap( } else { push_cur(); bno = NULLFSBLOCK; - rblock = (xfs_bmdr_block_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); - fsize = XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT); + rblock = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); + fsize = XFS_DFORK_SIZE(dip, mp, whichfork); pp = XFS_BTREE_PTR_ADDR(fsize, xfs_bmdr, rblock, 1, XFS_BTREE_BLOCK_MAXRECS(fsize, xfs_bmdr, 0)); kp = XFS_BTREE_KEY_ADDR(fsize, xfs_bmdr, rblock, 1, diff --git a/db/check.c b/db/check.c index 4fe875023..a83584ba9 100644 --- a/db/check.c +++ b/db/check.c @@ -38,9 +38,9 @@ #include "command.h" #include "io.h" #include "type.h" -#include "fprint.h" -#include "faddr.h" -#include "field.h" +#include "fprint.h" +#include "faddr.h" +#include "field.h" #include "sb.h" #include "output.h" #include "init.h" @@ -2117,7 +2117,7 @@ process_btinode( xfs_bmbt_ptr_t *pp; xfs_bmbt_rec_32_t *rp; - dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_NOCONVERT); + dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); if (INT_GET(dib->bb_level, ARCH_CONVERT) >= XFS_BM_MAXLEVELS(mp, whichfork)) { if (!sflag || id->ilist) dbprintf("level for ino %lld %s fork bmap root too " @@ -2129,7 +2129,7 @@ process_btinode( return; } if (INT_GET(dib->bb_numrecs, ARCH_CONVERT) > - XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_NOCONVERT), + XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE_HOST(dip, mp, whichfork), xfs_bmdr, INT_GET(dib->bb_level, ARCH_CONVERT) == 0)) { if (!sflag || id->ilist) dbprintf("numrecs for ino %lld %s fork bmap root too " @@ -2142,7 +2142,7 @@ process_btinode( } if (INT_GET(dib->bb_level, ARCH_CONVERT) == 0) { rp = (xfs_bmbt_rec_32_t *)XFS_BTREE_REC_ADDR( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_NOCONVERT), + XFS_DFORK_SIZE_HOST(dip, mp, whichfork), xfs_bmdr, dib, 1, XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE(dip, mp, whichfork), @@ -2152,7 +2152,7 @@ process_btinode( *nex += INT_GET(dib->bb_numrecs, ARCH_CONVERT); return; } else { - pp = XFS_BTREE_PTR_ADDR(XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_NOCONVERT), + pp = XFS_BTREE_PTR_ADDR(XFS_DFORK_SIZE_HOST(dip, mp, whichfork), xfs_bmdr, dib, 1, XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE(dip, mp, whichfork), @@ -2165,7 +2165,7 @@ process_btinode( TYP_BMAPBTD : TYP_BMAPBTA); } if (*nex <= - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_NOCONVERT) / sizeof(xfs_bmbt_rec_t)) { + XFS_DFORK_SIZE_HOST(dip, mp, whichfork) / sizeof(xfs_bmbt_rec_t)) { if (!sflag || id->ilist) dbprintf("extent count for ino %lld %s fork too low " "(%d) for file format\n", @@ -2228,7 +2228,7 @@ process_data_dir_v2( ptr = (char *)data->u; if (INT_GET(block->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + lep = XFS_DIR2_BLOCK_LEAF_P(btp); endptr = (char *)lep; if (endptr <= ptr || endptr > (char *)btp) { endptr = (char *)data + mp->m_dirblksize; @@ -2276,7 +2276,7 @@ process_data_dir_v2( lastfree_err += lastfree != 0; if ((INT_GET(dup->length, ARCH_CONVERT) & (XFS_DIR2_DATA_ALIGN - 1)) || INT_GET(dup->length, ARCH_CONVERT) == 0 || - (char *)(tagp = XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT)) >= + (char *)(tagp = XFS_DIR2_DATA_UNUSED_TAG_P(dup)) >= endptr) { if (!sflag || v) dbprintf("dir %lld block %d bad free " @@ -2505,7 +2505,7 @@ process_dir_v1( inodata_t *id, xfs_ino_t *parent) { - if (dip->di_core.di_size <= XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_NOCONVERT) && + if (dip->di_core.di_size <= XFS_DFORK_DSIZE_HOST(dip, mp) && dip->di_core.di_format == XFS_DINODE_FMT_LOCAL) *parent = process_shortform_dir_v1(dip, dot, dotdot, id); @@ -2541,7 +2541,7 @@ process_dir_v2( if (blkmap) last = blkmap_last_off(blkmap); - if (dip->di_core.di_size <= XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_NOCONVERT) && + if (dip->di_core.di_size <= XFS_DFORK_DSIZE_HOST(dip, mp) && dip->di_core.di_format == XFS_DINODE_FMT_LOCAL) *parent = process_sf_dir_v2(dip, dot, dotdot, id); else if (last == mp->m_dirblkfsbs && @@ -2578,11 +2578,11 @@ process_exinode( { xfs_bmbt_rec_32_t *rp; - rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_NOCONVERT); - *nex = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_NOCONVERT); + rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR(dip, whichfork); + *nex = XFS_DFORK_NEXTENTS_HOST(dip, whichfork); if (*nex < 0 || *nex > - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_NOCONVERT) / sizeof(xfs_bmbt_rec_32_t)) { + XFS_DFORK_SIZE_HOST(dip, mp, whichfork) / sizeof(xfs_bmbt_rec_32_t)) { if (!sflag || id->ilist) dbprintf("bad number of extents %d for inode %lld\n", *nex, id->ino); @@ -2645,8 +2645,7 @@ process_inode( }; /* convert the core, then copy it back into the inode */ - libxfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, &tdic, 1, - ARCH_CONVERT); + libxfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, &tdic, 1); memcpy(&dip->di_core, &tdic, sizeof(xfs_dinode_core_t)); dic=&dip->di_core; @@ -2707,7 +2706,7 @@ process_inode( error++; return; } - if ((unsigned int)XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_NOCONVERT) >= XFS_LITINO(mp)) { + if ((unsigned int)XFS_DFORK_ASIZE_HOST(dip, mp) >= XFS_LITINO(mp)) { if (!sflag || id->ilist) dbprintf("bad fork offset %d for inode %lld\n", dic->di_forkoff, id->ino); @@ -2796,7 +2795,7 @@ process_inode( &nextents, &blkmap, XFS_DATA_FORK); break; } - if (XFS_DFORK_Q_ARCH(dip, ARCH_NOCONVERT)) { + if (XFS_DFORK_Q(dip)) { sbversion |= XFS_SB_VERSION_ATTRBIT; switch (dic->di_aformat) { case XFS_DINODE_FMT_LOCAL: @@ -2875,11 +2874,11 @@ process_inode( process_quota(IS_USER_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) + (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) process_quota(IS_GROUP_QUOTA, id, blkmap); else if (id->ino == mp->m_sb.sb_gquotino && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD)) /* yep, G */ + (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD)) process_quota(IS_PROJECT_QUOTA, id, blkmap); } if (blkmap) @@ -2905,7 +2904,7 @@ process_lclinode( dic = &dip->di_core; bno = XFS_INO_TO_FSB(mp, id->ino); if (whichfork == XFS_DATA_FORK && - dic->di_size > XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_NOCONVERT)) { + dic->di_size > XFS_DFORK_DSIZE_HOST(dip, mp)) { if (!sflag || id->ilist || CHECK_BLIST(bno)) dbprintf("local inode %lld data is too large (size " "%lld)\n", @@ -2913,8 +2912,8 @@ process_lclinode( error++; } else if (whichfork == XFS_ATTR_FORK) { - asf = (xfs_attr_shortform_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_NOCONVERT); - if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) > XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_NOCONVERT)) { + asf = (xfs_attr_shortform_t *)XFS_DFORK_PTR(dip, whichfork); + if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) > XFS_DFORK_ASIZE_HOST(dip, mp)) { if (!sflag || id->ilist || CHECK_BLIST(bno)) dbprintf("local inode %lld attr is too large " "(size %d)\n", @@ -2989,7 +2988,7 @@ process_leaf_dir_v1_int( entry = &leaf->entries[0]; for (i = 0; i < INT_GET(leaf->hdr.count, ARCH_CONVERT); entry++, i++) { namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - lino=DIRINO_GET_ARCH(&namest->inumber, ARCH_CONVERT); + lino = XFS_GET_DIR_INO8(namest->inumber); cid = find_inode(lino, 1); if (v) dbprintf("dir %lld entry %*.*s %lld\n", id->ino, @@ -3240,7 +3239,7 @@ process_leaf_node_dir_v2_int( error++; } ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - lbp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + lbp = XFS_DIR2_LEAF_BESTS_P(ltp); for (i = 0; i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++) { if (freetab->nents <= i || freetab->ents[i] != INT_GET(lbp[i], ARCH_CONVERT)) { if (!sflag || v) @@ -3641,7 +3640,7 @@ process_sf_dir_v2( error++; break; } - lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sf, XFS_DIR2_SF_INUMBERP(sfe), ARCH_CONVERT); + lino = XFS_DIR2_SF_GET_INUMBER(sf, XFS_DIR2_SF_INUMBERP(sfe)); if (lino > XFS_DIR2_MAX_SHORT_INUM) i8++; cid = find_inode(lino, 1); @@ -3661,16 +3660,16 @@ process_sf_dir_v2( if (v) dbprintf("dir %lld entry %*.*s offset %d %lld\n", id->ino, sfe->namelen, sfe->namelen, sfe->name, - XFS_DIR2_SF_GET_OFFSET_ARCH(sfe, ARCH_CONVERT), lino); - if (XFS_DIR2_SF_GET_OFFSET_ARCH(sfe, ARCH_CONVERT) < offset) { + XFS_DIR2_SF_GET_OFFSET(sfe), lino); + if (XFS_DIR2_SF_GET_OFFSET(sfe) < offset) { if (!sflag) dbprintf("dir %lld entry %*.*s bad offset %d\n", id->ino, sfe->namelen, sfe->namelen, - sfe->name, XFS_DIR2_SF_GET_OFFSET_ARCH(sfe, ARCH_CONVERT)); + sfe->name, XFS_DIR2_SF_GET_OFFSET(sfe)); error++; } offset = - XFS_DIR2_SF_GET_OFFSET_ARCH(sfe, ARCH_CONVERT) + + XFS_DIR2_SF_GET_OFFSET(sfe) + XFS_DIR2_DATA_ENTSIZE(sfe->namelen); sfe = XFS_DIR2_SF_NEXTENTRY(sf, sfe); } @@ -3687,7 +3686,7 @@ process_sf_dir_v2( dbprintf("dir %llu offsets too high\n", id->ino); error++; } - lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sf, &sf->hdr.parent, ARCH_CONVERT); + lino = XFS_DIR2_SF_GET_INUMBER(sf, &sf->hdr.parent); if (lino > XFS_DIR2_MAX_SHORT_INUM) i8++; cid = find_inode(lino, 1); @@ -3734,7 +3733,7 @@ process_shortform_dir_v1( (*dot)++; sfe = &sf->list[0]; for (i = INT_GET(sf->hdr.count, ARCH_CONVERT) - 1; i >= 0; i--) { - lino = DIRINO_GET_ARCH(&sfe->inumber, ARCH_CONVERT); + lino = XFS_GET_DIR_INO8(sfe->inumber); cid = find_inode(lino, 1); if (cid == NULL) { if (!sflag) @@ -3758,7 +3757,7 @@ process_shortform_dir_v1( dbprintf("dir %llu size is %lld, should be %d\n", id->ino, dip->di_core.di_size, (int)((char *)sfe - (char *)sf)); - lino=DIRINO_GET_ARCH(&sf->hdr.parent, ARCH_CONVERT); + lino = XFS_GET_DIR_INO8(sf->hdr.parent); cid = find_inode(lino, 1); if (cid) addlink_inode(cid); @@ -3881,11 +3880,11 @@ quota_init(void) qgdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); + (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); qpdo = mp->m_sb.sb_gquotino != 0 && mp->m_sb.sb_gquotino != NULLFSINO && (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) && - (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD); /* yep, G */ + (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD); if (qudo) qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *)); if (qgdo) @@ -3918,7 +3917,7 @@ scan_ag( return; } - libxfs_xlate_sb(iocur_top->data, sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(iocur_top->data, sb, 1, XFS_SB_ALL_BITS); if (sb->sb_magicnum != XFS_SB_MAGIC) { if (!sflag) diff --git a/db/dir2.c b/db/dir2.c index 5f6e512bd..20d6f48a2 100644 --- a/db/dir2.c +++ b/db/dir2.c @@ -225,7 +225,7 @@ dir2_block_leaf_offset( block = obj; ASSERT(INT_GET(block->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT) + idx; + lep = XFS_DIR2_BLOCK_LEAF_P(btp) + idx; return bitize((int)((char *)lep - (char *)block)); } @@ -280,7 +280,7 @@ dir2_block_u_count( return 0; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); ptr = (char *)block->u; - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); for (i = 0; ptr < endptr; i++) { dup = (xfs_dir2_data_unused_t *)ptr; if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) @@ -314,7 +314,7 @@ dir2_block_u_offset( ASSERT(INT_GET(block->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); ptr = (char *)block->u; - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); for (i = 0; i < idx; i++) { ASSERT(ptr < endptr); dup = (xfs_dir2_data_unused_t *)ptr; @@ -432,7 +432,7 @@ dir2_data_union_tag_count( end = (char *)&dup->length + sizeof(dup->length); if (end > (char *)obj + mp->m_dirblksize) return 0; - tagp = XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT); + tagp = XFS_DIR2_DATA_UNUSED_TAG_P(dup); } else { end = (char *)&dep->namelen + sizeof(dep->namelen); if (end > (char *)obj + mp->m_dirblksize) @@ -457,7 +457,7 @@ dir2_data_union_tag_offset( ASSERT(idx == 0); dup = (xfs_dir2_data_unused_t *)((char *)obj + byteize(startoff)); if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) - return bitize((int)((char *)XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT) - + return bitize((int)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)dup)); dep = (xfs_dir2_data_entry_t *)dup; return bitize((int)((char *)XFS_DIR2_DATA_ENTRY_TAG_P(dep) - @@ -622,7 +622,7 @@ dir2_leaf_bests_offset( leaf = obj; ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC); ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - lbp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT) + idx; + lbp = XFS_DIR2_LEAF_BESTS_P(ltp) + idx; return bitize((int)((char *)lbp - (char *)leaf)); } diff --git a/db/frag.c b/db/frag.c index 10d8a849b..0a21dd97d 100644 --- a/db/frag.c +++ b/db/frag.c @@ -515,7 +515,7 @@ scanfunc_ino( /* convert the core, then copy it back into the inode */ libxfs_xlate_dinode_core( (xfs_caddr_t) - &dip->di_core, &tdic, 1, ARCH_CONVERT ); + &dip->di_core, &tdic, 1); memcpy(&dip->di_core, &tdic, sizeof(xfs_dinode_core_t)); if (XFS_INOBT_IS_FREE(&rp[i], j, ARCH_CONVERT)) diff --git a/db/init.c b/db/init.c index 520fc653a..39133054e 100644 --- a/db/init.c +++ b/db/init.c @@ -128,7 +128,7 @@ init( } /* copy SB from buffer to in-core, converting architecture as we go */ - libxfs_xlate_sb(bufp, &xmount.m_sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(bufp, &xmount.m_sb, 1, XFS_SB_ALL_BITS); xfree(bufp); sbp = &xmount.m_sb; diff --git a/db/inode.c b/db/inode.c index 10c4fb23e..85cbc136d 100644 --- a/db/inode.c +++ b/db/inode.c @@ -225,9 +225,9 @@ inode_a_bmbt_count( ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; - if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)) + if (!XFS_DFORK_Q(dip)) return 0; - ASSERT((char *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT) - (char *)dip == byteize(startoff)); + ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff)); return INT_GET(dip->di_core.di_aformat, ARCH_CONVERT) == XFS_DINODE_FMT_BTREE; } @@ -241,9 +241,9 @@ inode_a_bmx_count( ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; - if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)) + if (!XFS_DFORK_Q(dip)) return 0; - ASSERT((char *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT) - (char *)dip == byteize(startoff)); + ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff)); return INT_GET(dip->di_core.di_aformat, ARCH_CONVERT) == XFS_DINODE_FMT_EXTENTS ? INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) : 0; } @@ -257,7 +257,7 @@ inode_a_count( ASSERT(startoff == 0); dip = obj; - return XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT); + return XFS_DFORK_Q(dip); } static int @@ -271,8 +271,8 @@ inode_a_offset( ASSERT(startoff == 0); ASSERT(idx == 0); dip = obj; - ASSERT(XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)); - return bitize((int)((char *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT) - (char *)dip)); + ASSERT(XFS_DFORK_Q(dip)); + return bitize((int)((char *)XFS_DFORK_APTR(dip) - (char *)dip)); } static int @@ -285,9 +285,9 @@ inode_a_sfattr_count( ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; - if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)) + if (!XFS_DFORK_Q(dip)) return 0; - ASSERT((char *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT) - (char *)dip == byteize(startoff)); + ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff)); return INT_GET(dip->di_core.di_aformat, ARCH_CONVERT) == XFS_DINODE_FMT_LOCAL; } @@ -305,12 +305,12 @@ inode_a_size( dip = obj; switch (INT_GET(dip->di_core.di_aformat, ARCH_CONVERT)) { case XFS_DINODE_FMT_LOCAL: - asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); return bitize((int)asf->hdr.totsize); case XFS_DINODE_FMT_EXTENTS: return (int)(INT_GET(dip->di_core.di_anextents, ARCH_CONVERT) * bitsz(xfs_bmbt_rec_t)); case XFS_DINODE_FMT_BTREE: - return bitize((int)XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT)); + return bitize((int)XFS_DFORK_ASIZE(dip, mp)); default: return 0; } @@ -552,7 +552,7 @@ inode_u_size( case XFS_DINODE_FMT_EXTENTS: return (int)(INT_GET(dip->di_core.di_nextents, ARCH_CONVERT) * bitsz(xfs_bmbt_rec_t)); case XFS_DINODE_FMT_BTREE: - return bitize((int)XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)); + return bitize((int)XFS_DFORK_DSIZE(dip, mp)); case XFS_DINODE_FMT_UUID: return bitsz(uuid_t); default: diff --git a/db/sb.c b/db/sb.c index 8e5b81983..7a3f2529b 100644 --- a/db/sb.c +++ b/db/sb.c @@ -198,7 +198,7 @@ get_sb(xfs_agnumber_t agno, xfs_sb_t *sb) return 0; } - libxfs_xlate_sb(iocur_top->data, sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(iocur_top->data, sb, 1, XFS_SB_ALL_BITS); if (sb->sb_magicnum != XFS_SB_MAGIC) { dbprintf("bad sb magic # %#x in AG %u\n", @@ -330,7 +330,7 @@ do_uuid(xfs_agnumber_t agno, uuid_t *uuid) } /* set uuid */ memcpy(&tsb.sb_uuid, uuid, sizeof(uuid_t)); - libxfs_xlate_sb(iocur_top->data, &tsb, -1, ARCH_CONVERT, XFS_SB_UUID); + libxfs_xlate_sb(iocur_top->data, &tsb, -1, XFS_SB_UUID); write_cur(); return uuid; } @@ -483,7 +483,7 @@ do_label(xfs_agnumber_t agno, char *label) memset(&tsb.sb_fname, 0, sizeof(tsb.sb_fname)); memcpy(&tsb.sb_fname, label, len); memcpy(&lbl[0], &tsb.sb_fname, sizeof(tsb.sb_fname)); - libxfs_xlate_sb(iocur_top->data, &tsb, -1, ARCH_CONVERT, XFS_SB_FNAME); + libxfs_xlate_sb(iocur_top->data, &tsb, -1, XFS_SB_FNAME); write_cur(); return &lbl[0]; } @@ -566,8 +566,7 @@ do_version(xfs_agnumber_t agno, __uint16_t versionnum) return 0; tsb.sb_versionnum = versionnum; - libxfs_xlate_sb(iocur_top->data, &tsb, - -1, ARCH_CONVERT, XFS_SB_VERSIONNUM); + libxfs_xlate_sb(iocur_top->data, &tsb, -1, XFS_SB_VERSIONNUM); write_cur(); return 1; } diff --git a/include/libxfs.h b/include/libxfs.h index 0262c4ce1..9820de5d5 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -303,7 +303,7 @@ extern void libxfs_trans_cancel (xfs_trans_t *, int); extern void libxfs_mod_sb (xfs_trans_t *, __int64_t); extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, - uint, struct xfs_inode **); + uint, uint, struct xfs_inode **); extern void libxfs_trans_iput(xfs_trans_t *, struct xfs_inode *, uint); extern void libxfs_trans_ijoin (xfs_trans_t *, struct xfs_inode *, uint); extern void libxfs_trans_ihold (xfs_trans_t *, struct xfs_inode *); @@ -443,10 +443,9 @@ extern int libxfs_highbit32 (__uint32_t); extern int libxfs_highbit64 (__uint64_t); extern uint libxfs_da_log2_roundup (uint); -extern void libxfs_xlate_sb (void *, xfs_sb_t *, int, xfs_arch_t, - __int64_t); +extern void libxfs_xlate_sb (void *, xfs_sb_t *, int, __int64_t); extern void libxfs_xlate_dinode_core (xfs_caddr_t buf, - xfs_dinode_core_t *, int, xfs_arch_t); + xfs_dinode_core_t *, int); extern int libxfs_alloc_fix_freelist (xfs_alloc_arg_t *, int); extern int libxfs_alloc_file_space (xfs_inode_t *, xfs_off_t, diff --git a/include/libxlog.h b/include/libxlog.h index 0eaf9279d..a70bc5f8d 100644 --- a/include/libxlog.h +++ b/include/libxlog.h @@ -86,6 +86,7 @@ typedef union { #define XFS_ERROR_REPORT(e,l,mp) ((void) 0) #endif #define XFS_CORRUPTION_ERROR(e,l,mp,m) ((void) 0) +#define XFS_MOUNT_WAS_CLEAN 0x1 #define unlikely(x) (x) #define min(a,b) ((a) < (b) ? (a) : (b)) diff --git a/include/xfs_ag.h b/include/xfs_ag.h index 96b70f7fb..ea6e35b70 100644 --- a/include/xfs_ag.h +++ b/include/xfs_ag.h @@ -92,6 +92,7 @@ typedef struct xfs_agf __uint32_t agf_flcount; /* count of blocks in freelist */ xfs_extlen_t agf_freeblks; /* total free blocks */ xfs_extlen_t agf_longest; /* longest free space */ + __uint32_t agf_btreeblks; /* # of blocks held in AGF btrees */ } xfs_agf_t; #define XFS_AGF_MAGICNUM 0x00000001 @@ -105,7 +106,8 @@ typedef struct xfs_agf #define XFS_AGF_FLCOUNT 0x00000100 #define XFS_AGF_FREEBLKS 0x00000200 #define XFS_AGF_LONGEST 0x00000400 -#define XFS_AGF_NUM_BITS 11 +#define XFS_AGF_BTREEBLKS 0x00000800 +#define XFS_AGF_NUM_BITS 12 #define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) /* disk block (xfs_daddr_t) in the AG */ @@ -222,11 +224,13 @@ typedef struct xfs_perag __uint32_t pagf_flcount; /* count of blocks in freelist */ xfs_extlen_t pagf_freeblks; /* total free blocks */ xfs_extlen_t pagf_longest; /* longest free space */ + __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */ xfs_agino_t pagi_freecount; /* number of free inodes */ + int pagb_count; /* pagb slots in use */ + xfs_agino_t pagi_count; /* number of allocated inodes */ #ifdef __KERNEL__ lock_t pagb_lock; /* lock for pagb_list */ #endif - int pagb_count; /* pagb slots in use */ xfs_perag_busy_t *pagb_list; /* unstable blocks */ } xfs_perag_t; diff --git a/include/xfs_alloc.h b/include/xfs_alloc.h index 72329c863..a1e13488d 100644 --- a/include/xfs_alloc.h +++ b/include/xfs_alloc.h @@ -128,7 +128,8 @@ int /* error */ xfs_alloc_get_freelist( struct xfs_trans *tp, /* transaction pointer */ struct xfs_buf *agbp, /* buffer containing the agf structure */ - xfs_agblock_t *bnop); /* block address retrieved from freelist */ + xfs_agblock_t *bnop, /* block address retrieved from freelist */ + int btreeblk); /* destination is a AGF btree */ /* * Log the given fields from the agf structure. @@ -157,7 +158,8 @@ xfs_alloc_put_freelist( struct xfs_trans *tp, /* transaction pointer */ struct xfs_buf *agbp, /* buffer for a.g. freelist header */ struct xfs_buf *agflbp,/* buffer for a.g. free block array */ - xfs_agblock_t bno); /* block being freed */ + xfs_agblock_t bno, /* block being freed */ + int btreeblk); /* owner was a AGF btree */ /* * Read in the allocation group header (free/alloc section). diff --git a/include/xfs_arch.h b/include/xfs_arch.h index 3c7a90bfb..ac18a34a3 100644 --- a/include/xfs_arch.h +++ b/include/xfs_arch.h @@ -72,69 +72,18 @@ ((sizeof(type) == 2) ? INT_SWAP16(type,var) : \ (var)))) -#define INT_SWAP_UNALIGNED_32(from,to) \ - { \ - ((__u8*)(to))[0] = ((__u8*)(from))[3]; \ - ((__u8*)(to))[1] = ((__u8*)(from))[2]; \ - ((__u8*)(to))[2] = ((__u8*)(from))[1]; \ - ((__u8*)(to))[3] = ((__u8*)(from))[0]; \ - } - -#define INT_SWAP_UNALIGNED_64(from,to) \ - { \ - INT_SWAP_UNALIGNED_32( ((__u8*)(from)) + 4, ((__u8*)(to))); \ - INT_SWAP_UNALIGNED_32( ((__u8*)(from)), ((__u8*)(to)) + 4); \ - } - /* * get and set integers from potentially unaligned locations */ -#define INT_GET_UNALIGNED_16_LE(pointer) \ - ((__u16)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ))) #define INT_GET_UNALIGNED_16_BE(pointer) \ ((__u16)((((__u8*)(pointer))[0] << 8) | (((__u8*)(pointer))[1]))) -#define INT_SET_UNALIGNED_16_LE(pointer,value) \ - { \ - ((__u8*)(pointer))[0] = (((value) ) & 0xff); \ - ((__u8*)(pointer))[1] = (((value) >> 8) & 0xff); \ - } #define INT_SET_UNALIGNED_16_BE(pointer,value) \ { \ ((__u8*)(pointer))[0] = (((value) >> 8) & 0xff); \ ((__u8*)(pointer))[1] = (((value) ) & 0xff); \ } -#define INT_GET_UNALIGNED_32_LE(pointer) \ - ((__u32)((((__u8*)(pointer))[0] ) | (((__u8*)(pointer))[1] << 8 ) \ - |(((__u8*)(pointer))[2] << 16) | (((__u8*)(pointer))[3] << 24))) -#define INT_GET_UNALIGNED_32_BE(pointer) \ - ((__u32)((((__u8*)(pointer))[0] << 24) | (((__u8*)(pointer))[1] << 16) \ - |(((__u8*)(pointer))[2] << 8) | (((__u8*)(pointer))[3] ))) - -#define INT_GET_UNALIGNED_64_LE(pointer) \ - (((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer))+4)) << 32 ) \ - |((__u64)(INT_GET_UNALIGNED_32_LE(((__u8*)(pointer)) )) )) -#define INT_GET_UNALIGNED_64_BE(pointer) \ - (((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer)) )) << 32 ) \ - |((__u64)(INT_GET_UNALIGNED_32_BE(((__u8*)(pointer))+4)) )) - -/* - * now pick the right ones for our MACHINE ARCHITECTURE - */ - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_LE(pointer) -#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_LE(pointer,value) -#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_LE(pointer) -#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_LE(pointer) -#else -#define INT_GET_UNALIGNED_16(pointer) INT_GET_UNALIGNED_16_BE(pointer) -#define INT_SET_UNALIGNED_16(pointer,value) INT_SET_UNALIGNED_16_BE(pointer,value) -#define INT_GET_UNALIGNED_32(pointer) INT_GET_UNALIGNED_32_BE(pointer) -#define INT_GET_UNALIGNED_64(pointer) INT_GET_UNALIGNED_64_BE(pointer) -#endif - /* define generic INT_ macros */ #define INT_GET(reference,arch) \ @@ -213,64 +162,52 @@ } \ } -#define INT_ISZERO(reference,arch) \ - ((reference) == 0) - -#define INT_ZERO(reference,arch) \ - ((reference) = 0) - -#define INT_GET_UNALIGNED_16_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_16(pointer)) \ - : \ - (INT_GET_UNALIGNED_16_BE(pointer)) \ - ) -#define INT_SET_UNALIGNED_16_ARCH(pointer,value,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - INT_SET_UNALIGNED_16(pointer,value); \ - } else { \ - INT_SET_UNALIGNED_16_BE(pointer,value); \ - } - -#define DIRINO4_GET_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_32(pointer)) \ - : \ - (INT_GET_UNALIGNED_32_BE(pointer)) \ - ) - -#if XFS_BIG_INUMS -#define DIRINO_GET_ARCH(pointer,arch) \ - ( ((arch) == ARCH_NOCONVERT) \ - ? \ - (INT_GET_UNALIGNED_64(pointer)) \ - : \ - (INT_GET_UNALIGNED_64_BE(pointer)) \ - ) -#else -/* MACHINE ARCHITECTURE dependent */ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define DIRINO_GET_ARCH(pointer,arch) \ - DIRINO4_GET_ARCH((((__u8*)pointer)+4),arch) -#else -#define DIRINO_GET_ARCH(pointer,arch) \ - DIRINO4_GET_ARCH(pointer,arch) -#endif -#endif - -#define DIRINO_COPY_ARCH(from,to,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - memcpy(to,from,sizeof(xfs_ino_t)); \ - } else { \ - INT_SWAP_UNALIGNED_64(from,to); \ - } -#define DIRINO4_COPY_ARCH(from,to,arch) \ - if ((arch) == ARCH_NOCONVERT) { \ - memcpy(to,(((__u8*)from+4)),sizeof(xfs_dir2_ino4_t)); \ - } else { \ - INT_SWAP_UNALIGNED_32(from,to); \ - } - +/* + * In directories inode numbers are stored as unaligned arrays of unsigned + * 8bit integers on disk. + * + * For v1 directories or v2 directories that contain inode numbers that + * do not fit into 32bit the array has eight members, but the first member + * is always zero: + * + * |unused|48-55|40-47|32-39|24-31|16-23| 8-15| 0- 7| + * + * For v2 directories that only contain entries with inode numbers that fit + * into 32bits a four-member array is used: + * + * |24-31|16-23| 8-15| 0- 7| + */ + +#define XFS_GET_DIR_INO4(di) \ + (((__u32)(di).i[0] << 24) | ((di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3])) + +#define XFS_PUT_DIR_INO4(from, di) \ +do { \ + (di).i[0] = (((from) & 0xff000000ULL) >> 24); \ + (di).i[1] = (((from) & 0x00ff0000ULL) >> 16); \ + (di).i[2] = (((from) & 0x0000ff00ULL) >> 8); \ + (di).i[3] = ((from) & 0x000000ffULL); \ +} while (0) + +#define XFS_DI_HI(di) \ + (((__u32)(di).i[1] << 16) | ((di).i[2] << 8) | ((di).i[3])) +#define XFS_DI_LO(di) \ + (((__u32)(di).i[4] << 24) | ((di).i[5] << 16) | ((di).i[6] << 8) | ((di).i[7])) + +#define XFS_GET_DIR_INO8(di) \ + (((xfs_ino_t)XFS_DI_LO(di) & 0xffffffffULL) | \ + ((xfs_ino_t)XFS_DI_HI(di) << 32)) + +#define XFS_PUT_DIR_INO8(from, di) \ +do { \ + (di).i[0] = 0; \ + (di).i[1] = (((from) & 0x00ff000000000000ULL) >> 48); \ + (di).i[2] = (((from) & 0x0000ff0000000000ULL) >> 40); \ + (di).i[3] = (((from) & 0x000000ff00000000ULL) >> 32); \ + (di).i[4] = (((from) & 0x00000000ff000000ULL) >> 24); \ + (di).i[5] = (((from) & 0x0000000000ff0000ULL) >> 16); \ + (di).i[6] = (((from) & 0x000000000000ff00ULL) >> 8); \ + (di).i[7] = ((from) & 0x00000000000000ffULL); \ +} while (0) + #endif /* __XFS_ARCH_H__ */ diff --git a/include/xfs_attr_leaf.h b/include/xfs_attr_leaf.h index 97bac75c6..b1480e0b3 100644 --- a/include/xfs_attr_leaf.h +++ b/include/xfs_attr_leaf.h @@ -246,7 +246,6 @@ int xfs_attr_shortform_getvalue(struct xfs_da_args *args); int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); int xfs_attr_shortform_remove(struct xfs_da_args *remove); int xfs_attr_shortform_list(struct xfs_attr_list_context *context); -int xfs_attr_shortform_replace(struct xfs_da_args *args); int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp); /* diff --git a/include/xfs_bmap_btree.h b/include/xfs_bmap_btree.h index a4a666a7c..65195f363 100644 --- a/include/xfs_bmap_btree.h +++ b/include/xfs_bmap_btree.h @@ -478,7 +478,7 @@ xfs_bmbt_delete( struct xfs_btree_cur *, int *); -void +int xfs_bmbt_get_all( xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); @@ -505,7 +505,7 @@ xfs_exntst_t xfs_bmbt_get_state( xfs_bmbt_rec_t *r); -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN void xfs_bmbt_disk_get_all( xfs_bmbt_rec_t *r, @@ -551,13 +551,6 @@ xfs_bmbt_insert( struct xfs_btree_cur *, int *); -int -xfs_bmbt_insert_many( - struct xfs_btree_cur *, - int, - xfs_bmbt_rec_t *, - int *); - void xfs_bmbt_log_block( struct xfs_btree_cur *, @@ -638,7 +631,7 @@ xfs_bmbt_set_state( xfs_bmbt_rec_t *r, xfs_exntst_t v); -#if ARCH_CONVERT != ARCH_NOCONVERT +#if __BYTE_ORDER != __BIG_ENDIAN void xfs_bmbt_disk_set_all( xfs_bmbt_rec_t *r, diff --git a/include/xfs_buf_item.h b/include/xfs_buf_item.h index 5f1b0c930..01aed5f2d 100644 --- a/include/xfs_buf_item.h +++ b/include/xfs_buf_item.h @@ -80,7 +80,7 @@ typedef struct xfs_buf_log_format_t { * user or group dquots and may require special recovery handling. */ #define XFS_BLI_UDQUOT_BUF 0x4 -/* #define XFS_BLI_PDQUOT_BUF 0x8 */ +#define XFS_BLI_PDQUOT_BUF 0x8 #define XFS_BLI_GDQUOT_BUF 0x10 #define XFS_BLI_CHUNK 128 diff --git a/include/xfs_dinode.h b/include/xfs_dinode.h index d395f7838..28572c571 100644 --- a/include/xfs_dinode.h +++ b/include/xfs_dinode.h @@ -204,58 +204,59 @@ int xfs_litino(struct xfs_mount *mp); * Inode data & attribute fork sizes, per inode. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q) -int xfs_cfork_q_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); +int xfs_cfork_q_disk(xfs_dinode_core_t *dcp); 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_DISK(dcp) xfs_cfork_q_disk(dcp) #define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp) #else -#define XFS_CFORK_Q_ARCH(dcp,arch) (!INT_ISZERO((dcp)->di_forkoff, arch)) +#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF) -int xfs_cfork_boff_arch(xfs_dinode_core_t *dcp, xfs_arch_t arch); +int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp); int xfs_cfork_boff(xfs_dinode_core_t *dcp); -#define XFS_CFORK_BOFF_ARCH(dcp,arch) xfs_cfork_boff_arch(dcp,arch) +#define XFS_CFORK_BOFF_DISK(dcp) xfs_cfork_boff_disk(dcp) #define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp) #else -#define XFS_CFORK_BOFF_ARCH(dcp,arch) ((int)(INT_GET((dcp)->di_forkoff, arch) << 3)) +#define XFS_CFORK_BOFF_DISK(dcp) ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3)) #define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE) -int xfs_cfork_dsize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); +int xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp); int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) xfs_cfork_dsize_arch(dcp,mp,arch) +#define XFS_CFORK_DSIZE_DISK(dcp,mp) xfs_cfork_dsize_disk(dcp,mp) #define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp) #else -#define XFS_CFORK_DSIZE_ARCH(dcp,mp,arch) \ - (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_CFORK_BOFF_ARCH(dcp, arch) : XFS_LITINO(mp)) +#define XFS_CFORK_DSIZE_DISK(dcp,mp) \ + (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) #define XFS_CFORK_DSIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE) -int xfs_cfork_asize_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, xfs_arch_t arch); +int xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp); int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) xfs_cfork_asize_arch(dcp,mp,arch) +#define XFS_CFORK_ASIZE_DISK(dcp,mp) xfs_cfork_asize_disk(dcp,mp) #define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp) #else -#define XFS_CFORK_ASIZE_ARCH(dcp,mp,arch) \ - (XFS_CFORK_Q_ARCH(dcp, arch) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_ARCH(dcp, arch) : 0) +#define XFS_CFORK_ASIZE_DISK(dcp,mp) \ + (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) #define XFS_CFORK_ASIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE) -int xfs_cfork_size_arch(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w, xfs_arch_t arch); +int xfs_cfork_size_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); -#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) xfs_cfork_size_arch(dcp,mp,w,arch) +#define XFS_CFORK_SIZE_DISK(dcp,mp,w) xfs_cfork_size_disk(dcp,mp,w) #define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w) #else -#define XFS_CFORK_SIZE_ARCH(dcp,mp,w,arch) \ +#define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ ((w) == XFS_DATA_FORK ? \ - XFS_CFORK_DSIZE_ARCH(dcp, mp, arch) : XFS_CFORK_ASIZE_ARCH(dcp, mp, arch)) + XFS_CFORK_DSIZE_DISK(dcp, mp) : \ + XFS_CFORK_ASIZE_DISK(dcp, mp)) #define XFS_CFORK_SIZE(dcp,mp,w) \ ((w) == XFS_DATA_FORK ? \ XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) @@ -263,33 +264,27 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) -int xfs_dfork_dsize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) xfs_dfork_dsize_arch(dip,mp,arch) #define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) #else -#define XFS_DFORK_DSIZE_ARCH(dip,mp,arch) XFS_CFORK_DSIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_DSIZE(dip,mp) XFS_DFORK_DSIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#define XFS_DFORK_DSIZE(dip,mp) XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp) +#define XFS_DFORK_DSIZE_HOST(dip,mp) XFS_CFORK_DSIZE(&(dip)->di_core, mp) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE) -int xfs_dfork_asize_arch(xfs_dinode_t *dip, struct xfs_mount *mp, xfs_arch_t arch); int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) xfs_dfork_asize_arch(dip,mp,arch) #define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp) #else -#define XFS_DFORK_ASIZE_ARCH(dip,mp,arch) XFS_CFORK_ASIZE_ARCH(&(dip)->di_core, mp, arch) -#define XFS_DFORK_ASIZE(dip,mp) XFS_DFORK_ASIZE_ARCH(dip,mp,ARCH_NOCONVERT) +#define XFS_DFORK_ASIZE(dip,mp) XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp) +#define XFS_DFORK_ASIZE_HOST(dip,mp) XFS_CFORK_ASIZE(&(dip)->di_core, mp) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE) -int xfs_dfork_size_arch(xfs_dinode_t *dip, struct xfs_mount *mp, int w, xfs_arch_t arch); int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) xfs_dfork_size_arch(dip,mp,w,arch) #define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w) #else -#define XFS_DFORK_SIZE_ARCH(dip,mp,w,arch) XFS_CFORK_SIZE_ARCH(&(dip)->di_core, mp, w, arch) -#define XFS_DFORK_SIZE(dip,mp,w) XFS_DFORK_SIZE_ARCH(dip,mp,w,ARCH_NOCONVERT) +#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) +#define XFS_DFORK_SIZE_HOST(dip,mp,w) XFS_CFORK_SIZE(&(dip)->di_core, mp, w) #endif @@ -297,143 +292,97 @@ int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); * Macros for accessing per-fork disk inode information. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q) -int xfs_dfork_q_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_q(xfs_dinode_t *dip); -#define XFS_DFORK_Q_ARCH(dip,arch) xfs_dfork_q_arch(dip,arch) #define XFS_DFORK_Q(dip) xfs_dfork_q(dip) #else -#define XFS_DFORK_Q_ARCH(dip,arch) XFS_CFORK_Q_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_Q(dip) XFS_DFORK_Q_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF) -int xfs_dfork_boff_arch(xfs_dinode_t *dip, xfs_arch_t arch); int xfs_dfork_boff(xfs_dinode_t *dip); -#define XFS_DFORK_BOFF_ARCH(dip,arch) xfs_dfork_boff_arch(dip,arch) -#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) +#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) #else -#define XFS_DFORK_BOFF_ARCH(dip,arch) XFS_CFORK_BOFF_ARCH(&(dip)->di_core, arch) -#define XFS_DFORK_BOFF(dip) XFS_DFORK_BOFF_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR) -char *xfs_dfork_dptr_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_dptr(xfs_dinode_t *dip); -#define XFS_DFORK_DPTR_ARCH(dip,arch) xfs_dfork_dptr_arch(dip,arch) #define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip) #else -#define XFS_DFORK_DPTR_ARCH(dip,arch) ((dip)->di_u.di_c) -#define XFS_DFORK_DPTR(dip) XFS_DFORK_DPTR_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR) -char *xfs_dfork_aptr_arch(xfs_dinode_t *dip, xfs_arch_t arch); char *xfs_dfork_aptr(xfs_dinode_t *dip); -#define XFS_DFORK_APTR_ARCH(dip,arch) xfs_dfork_aptr_arch(dip,arch) #define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip) #else -#define XFS_DFORK_APTR_ARCH(dip,arch) ((dip)->di_u.di_c + XFS_DFORK_BOFF_ARCH(dip, arch)) -#define XFS_DFORK_APTR(dip) XFS_DFORK_APTR_ARCH(dip,ARCH_NOCONVERT) +#define XFS_DFORK_APTR(dip) ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR) -char *xfs_dfork_ptr_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); char *xfs_dfork_ptr(xfs_dinode_t *dip, int w); -#define XFS_DFORK_PTR_ARCH(dip,w,arch) xfs_dfork_ptr_arch(dip,w,arch) #define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w) #else -#define XFS_DFORK_PTR_ARCH(dip,w,arch) \ - ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR_ARCH(dip, arch) : XFS_DFORK_APTR_ARCH(dip, arch)) -#define XFS_DFORK_PTR(dip,w) XFS_DFORK_PTR_ARCH(dip,w,ARCH_NOCONVERT) +#define XFS_DFORK_PTR(dip,w) \ + ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT) -int xfs_cfork_format_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); int xfs_cfork_format(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) xfs_cfork_format_arch(dcp,w,arch) #define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w) #else -#define XFS_CFORK_FORMAT_ARCH(dcp,w,arch) \ - ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_format, arch) : INT_GET((dcp)->di_aformat, arch)) -#define XFS_CFORK_FORMAT(dcp,w) XFS_CFORK_FORMAT_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_FORMAT(dcp,w) \ + ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET) -void xfs_cfork_fmt_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) xfs_cfork_fmt_set_arch(dcp,w,n,arch) #define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n) #else -#define XFS_CFORK_FMT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_FMT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - (INT_SET((dcp)->di_format, arch, (n))) : \ - (INT_SET((dcp)->di_aformat, arch, (n)))) -#define XFS_CFORK_FMT_SET(dcp,w,n) XFS_CFORK_FMT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) + ((dcp)->di_format = (n)) : \ + ((dcp)->di_aformat = (n))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS) -int xfs_cfork_nextents_arch(xfs_dinode_core_t *dcp, int w, xfs_arch_t arch); +int xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w); int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) xfs_cfork_nextents_arch(dcp,w,arch) +#define XFS_CFORK_NEXTENTS_DISK(dcp,w) xfs_cfork_nextents_disk(dcp,w) #define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w) #else -#define XFS_CFORK_NEXTENTS_ARCH(dcp,w,arch) \ - ((w) == XFS_DATA_FORK ? INT_GET((dcp)->di_nextents, arch) : INT_GET((dcp)->di_anextents, arch)) -#define XFS_CFORK_NEXTENTS(dcp,w) XFS_CFORK_NEXTENTS_ARCH(dcp,w,ARCH_NOCONVERT) +#define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ + ((w) == XFS_DATA_FORK ? \ + INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ + INT_GET((dcp)->di_anextents, ARCH_CONVERT)) +#define XFS_CFORK_NEXTENTS(dcp,w) \ + ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET) -void xfs_cfork_next_set_arch(xfs_dinode_core_t *dcp, int w, int n, xfs_arch_t arch); void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) xfs_cfork_next_set_arch(dcp,w,n,arch) #define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n) #else -#define XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,arch) \ +#define XFS_CFORK_NEXT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - (INT_SET((dcp)->di_nextents, arch, (n))) : \ - (INT_SET((dcp)->di_anextents, arch, (n)))) -#define XFS_CFORK_NEXT_SET(dcp,w,n) XFS_CFORK_NEXT_SET_ARCH(dcp,w,n,ARCH_NOCONVERT) + ((dcp)->di_nextents = (n)) : \ + ((dcp)->di_anextents = (n))) #endif + #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FORMAT) -int xfs_dfork_format_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); int xfs_dfork_format(xfs_dinode_t *dip, int w); -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) xfs_dfork_format_arch(dip,w,arch) -#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w) +#define XFS_DFORK_FORMAT(dip,w) xfs_dfork_format(dip,w) #else -#define XFS_DFORK_FORMAT_ARCH(dip,w,arch) XFS_CFORK_FORMAT_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_FORMAT(dip,w) XFS_DFORK_FORMAT_ARCH(dip,w,ARCH_NOCONVERT) - +#define XFS_DFORK_FORMAT(dip,w) XFS_CFORK_FORMAT(&(dip)->di_core, (w)) #endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_FMT_SET) -void xfs_dfork_fmt_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); -void xfs_dfork_fmt_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) xfs_dfork_fmt_set_arch(dip,w,n,arch) -#define XFS_DFORK_FMT_SET(dip,w,n) xfs_dfork_fmt_set(dip,w,n) -#else -#define XFS_DFORK_FMT_SET_ARCH(dip,w,n,arch) XFS_CFORK_FMT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_FMT_SET(dip,w,n) XFS_DFORK_FMT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) -#endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS) -int xfs_dfork_nextents_arch(xfs_dinode_t *dip, int w, xfs_arch_t arch); int xfs_dfork_nextents(xfs_dinode_t *dip, int w); -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) xfs_dfork_nextents_arch(dip,w,arch) -#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) +#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) #else -#define XFS_DFORK_NEXTENTS_ARCH(dip,w,arch) XFS_CFORK_NEXTENTS_ARCH(&(dip)->di_core, w, arch) -#define XFS_DFORK_NEXTENTS(dip,w) XFS_DFORK_NEXTENTS_ARCH(dip,w,ARCH_NOCONVERT) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXT_SET) -void xfs_dfork_next_set_arch(xfs_dinode_t *dip, int w, int n, xfs_arch_t arch); -void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n); -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) xfs_dfork_next_set_arch(dip,w,n,arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) xfs_dfork_next_set(dip,w,n) -#else -#define XFS_DFORK_NEXT_SET_ARCH(dip,w,n,arch) XFS_CFORK_NEXT_SET_ARCH(&(dip)->di_core, w, n, arch) -#define XFS_DFORK_NEXT_SET(dip,w,n) XFS_DFORK_NEXT_SET_ARCH(dip,w,n,ARCH_NOCONVERT) - +#define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) +#define XFS_DFORK_NEXTENTS_HOST(dip,w) XFS_CFORK_NEXTENTS(&(dip)->di_core, w) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) diff --git a/include/xfs_dir2.h b/include/xfs_dir2.h index 8f4fc7f23..1215f2af4 100644 --- a/include/xfs_dir2.h +++ b/include/xfs_dir2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2001,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 @@ -106,4 +106,11 @@ extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db, struct xfs_dabuf *bp); +extern xfs_dahash_t + xfs_dir2_hashname(struct xfs_mount *mp, char *name, int namelen); + +extern int + xfs_dir2_compare(struct xfs_mount *mp, const char *a, const char *b, + size_t length, int ci); + #endif /* __XFS_DIR2_H__ */ diff --git a/include/xfs_dir2_block.h b/include/xfs_dir2_block.h index 3c4f70c91..5a578b84e 100644 --- a/include/xfs_dir2_block.h +++ b/include/xfs_dir2_block.h @@ -87,13 +87,12 @@ xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block); * Pointer to the leaf entries embedded in a data block (1-block format) */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_BLOCK_LEAF_P) -struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p_arch( - xfs_dir2_block_tail_t *btp, xfs_arch_t arch); -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ - xfs_dir2_block_leaf_p_arch(btp,arch) +struct xfs_dir2_leaf_entry *xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp); +#define XFS_DIR2_BLOCK_LEAF_P(btp) \ + xfs_dir2_block_leaf_p(btp) #else -#define XFS_DIR2_BLOCK_LEAF_P_ARCH(btp,arch) \ - (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, arch)) +#define XFS_DIR2_BLOCK_LEAF_P(btp) \ + (((struct xfs_dir2_leaf_entry *)(btp)) - INT_GET((btp)->count, ARCH_CONVERT)) #endif /* diff --git a/include/xfs_dir2_data.h b/include/xfs_dir2_data.h index b9e16ab5f..3f02294cc 100644 --- a/include/xfs_dir2_data.h +++ b/include/xfs_dir2_data.h @@ -163,14 +163,13 @@ xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep); * Pointer to a freespace's tag word. */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P) -xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p_arch( - xfs_dir2_data_unused_t *dup, xfs_arch_t arch); -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ - xfs_dir2_data_unused_tag_p_arch(dup,arch) +xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup); +#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ + xfs_dir2_data_unused_tag_p(dup) #else -#define XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup,arch) \ +#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ ((xfs_dir2_data_off_t *)\ - ((char *)(dup) + INT_GET((dup)->length, arch) \ + ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ - (uint)sizeof(xfs_dir2_data_off_t))) #endif diff --git a/include/xfs_dir2_leaf.h b/include/xfs_dir2_leaf.h index d3b5145a9..7f20eee56 100644 --- a/include/xfs_dir2_leaf.h +++ b/include/xfs_dir2_leaf.h @@ -144,11 +144,11 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp); */ #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_LEAF_BESTS_P) xfs_dir2_data_off_t * -xfs_dir2_leaf_bests_p_arch(xfs_dir2_leaf_tail_t *ltp, xfs_arch_t arch); -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) xfs_dir2_leaf_bests_p_arch(ltp,arch) +xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp); +#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp) #else -#define XFS_DIR2_LEAF_BESTS_P_ARCH(ltp,arch) \ - ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, arch)) +#define XFS_DIR2_LEAF_BESTS_P(ltp) \ + ((xfs_dir2_data_off_t *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT)) #endif /* diff --git a/include/xfs_dir2_sf.h b/include/xfs_dir2_sf.h index 3fea83ecd..bac6f5a2a 100644 --- a/include/xfs_dir2_sf.h +++ b/include/xfs_dir2_sf.h @@ -59,21 +59,12 @@ struct xfs_trans; */ typedef struct { __uint8_t i[8]; } xfs_dir2_ino8_t; -#define XFS_DIR2_SF_GET_INO8_ARCH(di,arch) \ - (xfs_ino_t)(DIRINO_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO8(di) \ - XFS_DIR2_SF_GET_INO8_ARCH(di,ARCH_NOCONVERT) - /* * Inode number stored as 4 8-bit values. * Works a lot of the time, when all the inode numbers in a directory * fit in 32 bits. */ typedef struct { __uint8_t i[4]; } xfs_dir2_ino4_t; -#define XFS_DIR2_SF_GET_INO4_ARCH(di,arch) \ - (xfs_ino_t)(DIRINO4_GET_ARCH(&di,arch)) -#define XFS_DIR2_SF_GET_INO4(di) \ - XFS_DIR2_SF_GET_INO4_ARCH(di,ARCH_NOCONVERT) typedef union { xfs_dir2_ino8_t i8; @@ -132,51 +123,48 @@ xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep); #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER) -xfs_intino_t xfs_dir2_sf_get_inumber_arch(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from, - xfs_arch_t arch); -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ - xfs_dir2_sf_get_inumber_arch(sfp, from, arch) +xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from); +#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ + xfs_dir2_sf_get_inumber(sfp, from) #else -#define XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, from, arch) \ +#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ ((sfp)->hdr.i8count == 0 ? \ - (xfs_intino_t)XFS_DIR2_SF_GET_INO4_ARCH(*(from), arch) : \ - (xfs_intino_t)XFS_DIR2_SF_GET_INO8_ARCH(*(from), arch)) + (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ + (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) -void xfs_dir2_sf_put_inumber_arch(xfs_dir2_sf_t *sfp, xfs_ino_t *from, - xfs_dir2_inou_t *to, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ - xfs_dir2_sf_put_inumber_arch(sfp,from,to,arch) +void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from, + xfs_dir2_inou_t *to); +#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ + xfs_dir2_sf_put_inumber(sfp,from,to) #else -#define XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp,from,to,arch) \ +#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ if ((sfp)->hdr.i8count == 0) { \ - DIRINO4_COPY_ARCH(from,to,arch); \ + XFS_PUT_DIR_INO4(*(from), (to)->i4); \ } else { \ - DIRINO_COPY_ARCH(from,to,arch); \ + XFS_PUT_DIR_INO8(*(from), (to)->i8); \ } #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_OFFSET) -xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset_arch(xfs_dir2_sf_entry_t *sfep, - xfs_arch_t arch); xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep); -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ - xfs_dir2_sf_get_offset_arch(sfep,arch) +#define XFS_DIR2_SF_GET_OFFSET(sfep) \ + xfs_dir2_sf_get_offset(sfep) #else -#define XFS_DIR2_SF_GET_OFFSET_ARCH(sfep,arch) \ - INT_GET_UNALIGNED_16_ARCH(&(sfep)->offset.i,arch) +#define XFS_DIR2_SF_GET_OFFSET(sfep) \ + INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET) -void xfs_dir2_sf_put_offset_arch(xfs_dir2_sf_entry_t *sfep, - xfs_dir2_data_aoff_t off, xfs_arch_t arch); -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ - xfs_dir2_sf_put_offset_arch(sfep,off,arch) +void xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, + xfs_dir2_data_aoff_t off); +#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ + xfs_dir2_sf_put_offset(sfep,off) #else -#define XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep,off,arch) \ - INT_SET_UNALIGNED_16_ARCH(&(sfep)->offset.i,off,arch) +#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ + INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i,off) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME) diff --git a/include/xfs_dir_leaf.h b/include/xfs_dir_leaf.h index ad7477401..00d68d33c 100644 --- a/include/xfs_dir_leaf.h +++ b/include/xfs_dir_leaf.h @@ -140,11 +140,6 @@ typedef union { #define XFS_PUT_COOKIE(c,mp,bno,entry,hash) \ ((c).s.be = XFS_DA_MAKE_BNOENTRY(mp, bno, entry), (c).s.h = (hash)) -#define XFS_GET_DIR_INO_ARCH(mp,di,arch) \ - DIRINO_GET_ARCH(&(di),arch) -#define XFS_GET_DIR_INO(mp,di) \ - XFS_GET_DIR_INO_ARCH(mp,di,ARCH_NOCONVERT) - typedef struct xfs_dir_put_args { xfs_dircook_t cook; /* cookie of (next) entry */ diff --git a/include/xfs_dir_sf.h b/include/xfs_dir_sf.h index a363d1a01..a61bcfc2a 100644 --- a/include/xfs_dir_sf.h +++ b/include/xfs_dir_sf.h @@ -77,22 +77,16 @@ typedef struct xfs_dir_sf_sort { } xfs_dir_sf_sort_t; #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) -void xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch) #define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) #else -#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#define XFS_DIR_SF_GET_DIRINO(from,to) (*(to) = XFS_GET_DIR_INO8(*from)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO) -void xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch); void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) +#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) #else -#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch) -#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT) +#define XFS_DIR_SF_PUT_DIRINO(from,to) XFS_PUT_DIR_INO8(*(from), *(to)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME) int xfs_dir_sf_entsize_byname(int len); diff --git a/include/xfs_ialloc.h b/include/xfs_ialloc.h index db6d0015c..1449ddab7 100644 --- a/include/xfs_ialloc.h +++ b/include/xfs_ialloc.h @@ -179,6 +179,16 @@ xfs_ialloc_read_agi( xfs_agnumber_t agno, /* allocation group number */ struct xfs_buf **bpp); /* allocation group hdr buf */ +/* + * Read in the allocation group header to initialise the per-ag data + * in the mount structure + */ +int +xfs_ialloc_pagi_init( + struct xfs_mount *mp, /* file system mount structure */ + struct xfs_trans *tp, /* transaction pointer */ + xfs_agnumber_t agno); /* allocation group number */ + #endif /* __KERNEL__ */ #endif /* __XFS_IALLOC_H__ */ diff --git a/include/xfs_ialloc_btree.h b/include/xfs_ialloc_btree.h index dbda2ed81..1232daf36 100644 --- a/include/xfs_ialloc_btree.h +++ b/include/xfs_ialloc_btree.h @@ -99,21 +99,21 @@ xfs_inofree_t xfs_inobt_mask(int i); #define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i)) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) -int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_IS_FREE(rp,i,arch) xfs_inobt_is_free(rp,i,arch) +int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); +#define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) #else -#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \ +#define XFS_INOBT_IS_FREE(rp,i,arch) ((INT_GET((rp)->ir_free, arch) \ & XFS_INOBT_MASK(i)) != 0) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE) -void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_SET_FREE(rp,i,arch) xfs_inobt_set_free(rp,i,arch) +void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i); +#define XFS_INOBT_SET_FREE(rp,i) xfs_inobt_set_free(rp,i) #else #define XFS_INOBT_SET_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, |= XFS_INOBT_MASK(i))) #endif #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_CLR_FREE) -void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i, xfs_arch_t arch); -#define XFS_INOBT_CLR_FREE(rp,i,arch) xfs_inobt_clr_free(rp,i,arch) +void xfs_inobt_clr_free(xfs_inobt_rec_t *rp, int i); +#define XFS_INOBT_CLR_FREE(rp,i) xfs_inobt_clr_free(rp,i) #else #define XFS_INOBT_CLR_FREE(rp,i,arch) (INT_MOD_EXPR((rp)->ir_free, arch, &= ~XFS_INOBT_MASK(i))) #endif @@ -244,8 +244,7 @@ xfs_inobt_get_rec( xfs_agino_t *ino, /* output: starting inode of chunk */ __int32_t *fcnt, /* output: number of free inodes */ xfs_inofree_t *free, /* output: free inode mask */ - int *stat, /* output: success/failure */ - xfs_arch_t arch); /* output: architecture */ + int *stat); /* output: success/failure */ /* * Increment cursor by one record at the level. diff --git a/include/xfs_inode.h b/include/xfs_inode.h index f606073ad..37e1c316f 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -182,10 +182,6 @@ typedef struct xfs_ihash { uint ih_version; } xfs_ihash_t; -/* - * Inode hashing and hash bucket locking. - */ -#define XFS_BUCKETS(mp) (37*(mp)->m_sb.sb_agcount-1) #define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)(ino)) % (mp)->m_ihsize)) /* @@ -193,7 +189,6 @@ typedef struct xfs_ihash { * find inodes that share a cluster and can be flushed to disk at the same * time. */ - typedef struct xfs_chashlist { struct xfs_chashlist *chl_next; struct xfs_inode *chl_ip; @@ -207,6 +202,8 @@ typedef struct xfs_chash { lock_t ch_lock; } xfs_chash_t; +#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize)) + /* * This is the xfs in-core inode structure. @@ -381,6 +378,7 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); #define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */ #define XFS_ISTALE 0x0010 /* inode has been staled */ #define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ +#define XFS_INEW 0x0040 /* * Flags for inode locking. @@ -448,12 +446,6 @@ xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp); #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops) -/* - * Pick the inode cluster hash bucket - * (m_chash is the same size as m_ihash) - */ -#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize)) - /* * For multiple groups support: if S_ISGID bit is set in the parent * directory, group of new file is set to that of the parent, and @@ -465,6 +457,9 @@ xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp); /* * xfs_iget.c prototypes. */ + +#define IGET_CREATE 1 + void xfs_ihash_init(struct xfs_mount *); void xfs_ihash_free(struct xfs_mount *); void xfs_chash_init(struct xfs_mount *); @@ -473,7 +468,7 @@ xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t, struct xfs_trans *); void xfs_inode_lock_init(xfs_inode_t *, struct vnode *); int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, - uint, xfs_inode_t **, xfs_daddr_t); + uint, uint, xfs_inode_t **, xfs_daddr_t); void xfs_iput(xfs_inode_t *, uint); void xfs_iput_new(xfs_inode_t *, uint); void xfs_ilock(xfs_inode_t *, uint); @@ -500,15 +495,15 @@ int xfs_itobp(struct xfs_mount *, struct xfs_trans *, int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, xfs_inode_t **, xfs_daddr_t); int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int); -int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t, - xfs_dev_t, struct cred *, xfs_prid_t, int, - struct xfs_buf **, boolean_t *, xfs_inode_t **); +int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, + xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t, + int, struct xfs_buf **, boolean_t *, xfs_inode_t **); void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, - int, xfs_arch_t); -uint xfs_dic2xflags(struct xfs_dinode_core *, xfs_arch_t); + int); +uint xfs_ip2xflags(struct xfs_inode *); +uint xfs_dic2xflags(struct xfs_dinode_core *); int xfs_ifree(struct xfs_trans *, xfs_inode_t *, struct xfs_bmap_free *); -int xfs_atruncate_start(xfs_inode_t *); void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, xfs_fsize_t, int, int); diff --git a/include/xfs_log.h b/include/xfs_log.h index 3b1f395b6..0db122ddd 100644 --- a/include/xfs_log.h +++ b/include/xfs_log.h @@ -32,20 +32,12 @@ #ifndef __XFS_LOG_H__ #define __XFS_LOG_H__ -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define LSN_FIELD_CYCLE(arch) (((arch)==ARCH_NOCONVERT)?1:0) -#define LSN_FIELD_BLOCK(arch) (((arch)==ARCH_NOCONVERT)?0:1) -#else -#define LSN_FIELD_CYCLE(arch) (0) -#define LSN_FIELD_BLOCK(arch) (1) -#endif - /* get lsn fields */ -#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)) +#define CYCLE_LSN(lsn) ((uint)((lsn)>>32)) +#define BLOCK_LSN(lsn) ((uint)(lsn)) /* 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)]) +#define CYCLE_LSN_DISK(lsn) (((uint *)&(lsn))[0]) #ifdef __KERNEL__ /* @@ -58,21 +50,18 @@ __attribute__((unused)) /* gcc 2.95, 2.96 miscompile this when inlined */ #else __inline__ #endif -xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch) +xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2) { - if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch)) - return (CYCLE_LSN(lsn1, arch)l_curr_cycle,(log)->l_curr_block,arch); +#define ASSIGN_ANY_LSN_DISK(lsn,cycle,block) \ + { \ + INT_SET(((uint *)&(lsn))[0], ARCH_CONVERT, (cycle)); \ + INT_SET(((uint *)&(lsn))[1], ARCH_CONVERT, (block)); \ + } +#define ASSIGN_LSN(lsn,log) \ + ASSIGN_ANY_LSN_DISK(lsn,(log)->l_curr_cycle,(log)->l_curr_block); #define XLOG_SET(f,b) (((f) & (b)) == (b)) diff --git a/include/xfs_mount.h b/include/xfs_mount.h index c194b8ef0..b4c6a5ca4 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2005 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 @@ -133,7 +133,7 @@ struct xfs_dqtrxops; struct xfs_quotainfo; typedef int (*xfs_qminit_t)(struct xfs_mount *, uint *, uint *); -typedef int (*xfs_qmmount_t)(struct xfs_mount *, uint, uint); +typedef int (*xfs_qmmount_t)(struct xfs_mount *, uint, uint, int); typedef int (*xfs_qmunmount_t)(struct xfs_mount *); typedef void (*xfs_qmdone_t)(struct xfs_mount *); typedef void (*xfs_dqrele_t)(struct xfs_dquot *); @@ -141,7 +141,7 @@ typedef int (*xfs_dqattach_t)(struct xfs_inode *, uint); typedef void (*xfs_dqdetach_t)(struct xfs_inode *); typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint); typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *, - struct xfs_inode *, uid_t, gid_t, uint, + struct xfs_inode *, uid_t, gid_t, prid_t, uint, struct xfs_dquot **, struct xfs_dquot **); typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *, struct xfs_dquot *, struct xfs_dquot *); @@ -171,8 +171,8 @@ typedef struct xfs_qmops { #define XFS_QM_INIT(mp, mnt, fl) \ (*(mp)->m_qm_ops.xfs_qminit)(mp, mnt, fl) -#define XFS_QM_MOUNT(mp, mnt, fl) \ - (*(mp)->m_qm_ops.xfs_qmmount)(mp, mnt, fl) +#define XFS_QM_MOUNT(mp, mnt, fl, mfsi_flags) \ + (*(mp)->m_qm_ops.xfs_qmmount)(mp, mnt, fl, mfsi_flags) #define XFS_QM_UNMOUNT(mp) \ (*(mp)->m_qm_ops.xfs_qmunmount)(mp) #define XFS_QM_DONE(mp) \ @@ -185,8 +185,8 @@ typedef struct xfs_qmops { (*(mp)->m_qm_ops.xfs_dqdetach)(ip) #define XFS_QM_DQPURGEALL(mp, fl) \ (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl) -#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, fl, dq1, dq2) \ - (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, fl, dq1, dq2) +#define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \ + (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2) #define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2) #define XFS_QM_DQVOPRENAME(mp, ip) \ @@ -296,7 +296,7 @@ typedef struct xfs_mount { xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ lock_t m_agirotor_lock;/* .. and lock protecting it */ xfs_agnumber_t m_maxagi; /* highest inode alloc group */ - int m_ihsize; /* size of next field */ + uint m_ihsize; /* size of next field */ struct xfs_ihash *m_ihash; /* fs private inode hash table*/ struct xfs_inode *m_inodes; /* active inode list */ struct list_head m_del_inodes; /* inodes to reclaim */ @@ -376,13 +376,15 @@ typedef struct xfs_mount { xfs_dablk_t m_dirdatablk; /* blockno of dir data v2 */ xfs_dablk_t m_dirleafblk; /* blockno of dir non-data v2 */ xfs_dablk_t m_dirfreeblk; /* blockno of dirfreeindex v2 */ - int m_chsize; /* size of next field */ + uint m_chsize; /* size of next field */ struct xfs_chash *m_chash; /* fs private inode per-cluster * hash table */ struct xfs_dmops m_dm_ops; /* vector of DMI ops */ struct xfs_qmops m_qm_ops; /* vector of XQM ops */ struct xfs_ioops m_io_ops; /* vector of I/O ops */ atomic_t m_active_trans; /* number trans frozen */ + unsigned long m_ail_push_time;/* last time an ail push + occurred for rate limiting */ } xfs_mount_t; /* @@ -393,7 +395,7 @@ typedef struct xfs_mount { for space allocations */ #define XFS_MOUNT_INO64 0x00000002 /* 0x00000004 -- currently unused */ - /* 0x00000008 -- currently unused */ +#define XFS_MOUNT_WAS_CLEAN 0x00000008 #define XFS_MOUNT_FS_SHUTDOWN 0x00000010 /* atomic stop of all filesystem operations, typically for disk errors in metadata */ @@ -418,6 +420,8 @@ typedef struct xfs_mount { #define XFS_MOUNT_IDELETE 0x00040000 /* delete empty inode clusters*/ #define XFS_MOUNT_SWALLOC 0x00080000 /* turn on stripe width * allocation */ +#define XFS_MOUNT_IHASHSIZE 0x00100000 /* inode hash table size */ +#define XFS_MOUNT_DIRSYNC 0x00200000 /* synchronous directory ops */ /* * Default minimum read and write sizes. @@ -426,10 +430,10 @@ typedef struct xfs_mount { #define XFS_WRITEIO_LOG_LARGE 16 /* - * Max and min values for UIO and mount-option defined I/O sizes; - * min value can't be less than a page. Currently unused. + * Max and min values for mount-option defined I/O + * preallocation sizes. */ -#define XFS_MAX_IO_LOG 16 /* 64K */ +#define XFS_MAX_IO_LOG 30 /* 1G */ #define XFS_MIN_IO_LOG PAGE_SHIFT /* @@ -441,6 +445,8 @@ typedef struct xfs_mount { #define XFS_MAXIOFFSET(mp) ((mp)->m_maxioffset) +#define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \ + ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN) #define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) #define xfs_force_shutdown(m,f) \ VFS_FORCE_SHUTDOWN((XFS_MTOVFS(m)), f, __FILE__, __LINE__) @@ -466,6 +472,7 @@ typedef struct xfs_mount { #define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */ #define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */ /* log recovery */ +#define XFS_MFSI_NO_QUOTACHECK 0x10 /* Skip quotacheck processing */ /* * Macros for getting from mount to vfs and back. @@ -536,10 +543,12 @@ typedef struct xfs_mod_sb { extern xfs_mount_t *xfs_mount_init(void); extern void xfs_mod_sb(xfs_trans_t *, __int64_t); +extern int xfs_log_sbcount(xfs_mount_t *, uint); extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv); extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, int); extern int xfs_unmountfs(xfs_mount_t *, struct cred *); +extern void xfs_unmountfs_wait(xfs_mount_t *); extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *); extern int xfs_unmountfs_writesb(xfs_mount_t *); extern int xfs_unmount_flush(xfs_mount_t *, int); @@ -552,8 +561,7 @@ extern void xfs_freesb(xfs_mount_t *); extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int); extern int xfs_syncsub(xfs_mount_t *, int, int, int *); extern xfs_agnumber_t xfs_initialize_perag(xfs_mount_t *, xfs_agnumber_t); -extern void xfs_xlatesb(void *, struct xfs_sb *, int, xfs_arch_t, - __int64_t); +extern void xfs_xlatesb(void *, struct xfs_sb *, int, __int64_t); extern struct vfsops xfs_vfsops; extern struct vnodeops xfs_vnodeops; diff --git a/include/xfs_quota.h b/include/xfs_quota.h index ea58b5c23..9fe0644a2 100644 --- a/include/xfs_quota.h +++ b/include/xfs_quota.h @@ -104,6 +104,8 @@ typedef struct xfs_dqblk { #define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & hashlist */ #define XFS_DQ_MARKER 0x0080 /* sentinel */ +#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) + /* * In the worst case, when both user and group quotas are on, * we can have a max of three dquots changing in a single transaction. @@ -124,7 +126,7 @@ typedef struct xfs_dqblk { typedef struct xfs_dq_logformat { __uint16_t qlf_type; /* dquot log item type */ __uint16_t qlf_size; /* size of this item */ - xfs_dqid_t qlf_id; /* usr/grp id number : 32 bits */ + xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */ __int64_t qlf_blkno; /* blkno of dquot buffer */ __int32_t qlf_len; /* len of dquot buffer */ __uint32_t qlf_boffset; /* off of dquot in buffer */ @@ -152,9 +154,9 @@ typedef struct xfs_qoff_logformat { #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ -#define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */ -#define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */ -#define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */ +#define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */ +#define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */ +#define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */ #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ /* @@ -162,17 +164,22 @@ typedef struct xfs_qoff_logformat { * are in the process of getting turned off. These flags are in m_qflags but * never in sb_qflags. */ -#define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */ +#define XFS_UQUOTA_ACTIVE 0x0100 /* uquotas are being turned off */ +#define XFS_PQUOTA_ACTIVE 0x0200 /* pquotas are being turned off */ +#define XFS_GQUOTA_ACTIVE 0x0400 /* gquotas are being turned off */ /* * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees * quota will be not be switched off as long as that inode lock is held. */ #define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ - XFS_GQUOTA_ACTIVE)) + XFS_GQUOTA_ACTIVE | \ + XFS_PQUOTA_ACTIVE)) +#define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ + XFS_PQUOTA_ACTIVE)) #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) +#define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) /* * Flags to tell various functions what to do. Not all of these are meaningful @@ -182,7 +189,7 @@ typedef struct xfs_qoff_logformat { #define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */ #define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ -#define XFS_QMOPT_GQUOTA 0x0000008 /* group dquot requested */ +#define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */ #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ @@ -192,6 +199,7 @@ typedef struct xfs_qoff_logformat { #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */ #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */ +#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ /* * flags to xfs_trans_mod_dquot to indicate which field needs to be @@ -231,7 +239,8 @@ typedef struct xfs_qoff_logformat { #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT -#define XFS_QMOPT_QUOTALL (XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA) +#define XFS_QMOPT_QUOTALL \ + (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) #ifdef __KERNEL__ @@ -246,21 +255,30 @@ typedef struct xfs_qoff_logformat { */ #define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ (ip)->i_udquot == NULL) || \ - (XFS_IS_GQUOTA_ON(mp) && \ + (XFS_IS_OQUOTA_ON(mp) && \ (ip)->i_gdquot == NULL)) #define XFS_QM_NEED_QUOTACHECK(mp) ((XFS_IS_UQUOTA_ON(mp) && \ (mp->m_sb.sb_qflags & \ XFS_UQUOTA_CHKD) == 0) || \ - (XFS_IS_GQUOTA_ON(mp) && \ + (XFS_IS_OQUOTA_ON(mp) && \ (mp->m_sb.sb_qflags & \ - XFS_GQUOTA_CHKD) == 0)) + XFS_OQUOTA_CHKD) == 0)) -#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ +#define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ + XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) + +#define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD) + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) + +#define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ + XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\ + XFS_GQUOTA_ACCT) #define XFS_MOUNT_QUOTA_MASK (XFS_MOUNT_QUOTA_ALL | XFS_UQUOTA_ACTIVE | \ - XFS_GQUOTA_ACTIVE) + XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE) /* diff --git a/include/xfs_sb.h b/include/xfs_sb.h index ad090a834..b8e161900 100644 --- a/include/xfs_sb.h +++ b/include/xfs_sb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2001 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 @@ -72,7 +72,8 @@ struct xfs_mount; XFS_SB_VERSION_DALIGNBIT | \ XFS_SB_VERSION_SHAREDBIT | \ XFS_SB_VERSION_LOGV2BIT | \ - XFS_SB_VERSION_SECTORBIT) + XFS_SB_VERSION_SECTORBIT | \ + XFS_SB_VERSION_MOREBITSBIT) #define XFS_SB_VERSION_OKSASHBITS \ (XFS_SB_VERSION_NUMBITS | \ XFS_SB_VERSION_REALFBITS | \ @@ -103,12 +104,13 @@ struct xfs_mount; */ #define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ #define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 +#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */ #define XFS_SB_VERSION2_SASHFBITS 0xff000000 /* Mask: features that require changing PROM and SASH */ #define XFS_SB_VERSION2_OKREALFBITS \ - (0) + (XFS_SB_VERSION2_LAZYSBCOUNTBIT) #define XFS_SB_VERSION2_OKSASHFBITS \ (0) #define XFS_SB_VERSION2_OKREALBITS \ @@ -118,8 +120,8 @@ struct xfs_mount; /* * mkfs macro to set up sb_features2 word */ -#define XFS_SB_VERSION2_MKFS(xyz) \ - ((xyz) ? 0 : 0) +#define XFS_SB_VERSION2_MKFS(resvd1, sbcntr) \ + ((sbcntr) ? XFS_SB_VERSION2_LAZYSBCOUNTBIT : 0) typedef struct xfs_sb { @@ -216,6 +218,9 @@ typedef enum { #define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) #define XFS_SB_UNIT XFS_SB_MVAL(UNIT) #define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) +#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT) +#define XFS_SB_IFREE XFS_SB_MVAL(IFREE) +#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS) #define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) #define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) #define XFS_SB_MOD_BITS \ @@ -502,11 +507,18 @@ int xfs_sb_version_hasmorebits(xfs_sb_t *sbp); * * For example, for a bit defined as XFS_SB_VERSION2_YBIT, has a macro: * - * SB_VERSION_HASYBIT(xfs_sb_t *sbp) + * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) * ((XFS_SB_VERSION_HASMOREBITS(sbp) && - * ((sbp)->sb_versionnum & XFS_SB_VERSION2_YBIT) + * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) */ - +#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_LAZYSBCOUNTBIT) +int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp); +#define XFS_SB_VERSION_LAZYSBCOUNT(sbp) xfs_sb_version_haslazysbcount(sbp) +#else +#define XFS_SB_VERSION_LAZYSBCOUNT(sbp) \ + ((XFS_SB_VERSION_HASMOREBITS(sbp)) && \ + ((sbp)->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)) +#endif /* * end of superblock version macros */ diff --git a/include/xfs_trans.h b/include/xfs_trans.h index 86e53377e..23a376be3 100644 --- a/include/xfs_trans.h +++ b/include/xfs_trans.h @@ -112,6 +112,7 @@ typedef struct xfs_trans_header { #define XFS_TRANS_GROWFSRT_ZERO 38 #define XFS_TRANS_GROWFSRT_FREE 39 #define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_SB_COUNT 41 /* new transaction types need to be reflected in xfs_logprint(8) */ @@ -1007,7 +1008,7 @@ void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *, - xfs_ino_t , uint, struct xfs_inode **); + xfs_ino_t , uint, uint, struct xfs_inode **); void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint); void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *); diff --git a/include/xfs_types.h b/include/xfs_types.h index 04609d27e..16f5371ce 100644 --- a/include/xfs_types.h +++ b/include/xfs_types.h @@ -55,7 +55,7 @@ typedef signed long long int __int64_t; typedef unsigned long long int __uint64_t; typedef enum { B_FALSE,B_TRUE } boolean_t; -typedef __int64_t prid_t; /* project ID */ +typedef __uint32_t prid_t; /* project ID */ typedef __uint32_t inst_t; /* an instruction */ typedef __s64 xfs_off_t; /* type */ @@ -63,6 +63,7 @@ typedef __u64 xfs_ino_t; /* type */ typedef __s64 xfs_daddr_t; /* type */ typedef char * xfs_caddr_t; /* type */ typedef __u32 xfs_dev_t; +typedef __u32 xfs_nlink_t; /* __psint_t is the same size as a pointer */ #if (BITS_PER_LONG == 32) diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index f5d8e9630..67a8edcb7 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -181,8 +181,8 @@ libxfs_log_header( INT_SET(head->h_fmt, ARCH_CONVERT, fmt); INT_SET(head->h_size, ARCH_CONVERT, XLOG_HEADER_CYCLE_SIZE); - ASSIGN_ANY_LSN(head->h_lsn, 1, 0, ARCH_CONVERT); - ASSIGN_ANY_LSN(head->h_tail_lsn, 1, 0, ARCH_CONVERT); + ASSIGN_ANY_LSN_DISK(head->h_lsn, 1, 0); + ASSIGN_ANY_LSN_DISK(head->h_tail_lsn, 1, 0); memcpy(&head->h_fs_uuid, fs_uuid, sizeof(uuid_t)); @@ -190,7 +190,7 @@ libxfs_log_header( p = nextfunc(p, BBSIZE, private); unmount_record(p); - cycle_lsn = CYCLE_LSN_NOCONV(head->h_lsn, ARCH_CONVERT); + cycle_lsn = CYCLE_LSN_DISK(head->h_lsn); for (i = 2; i < len; i++) { p = nextfunc(p, BBSIZE, private); memset(p, 0, BBSIZE); @@ -501,7 +501,6 @@ libxfs_mod_sb(xfs_trans_t *tp, __int64_t fields) mp = tp->t_mountp; bp = libxfs_getbuf(mp->m_dev, XFS_SB_DADDR, 1); - libxfs_xlate_sb(XFS_BUF_PTR(bp), &mp->m_sb, -1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(bp), &mp->m_sb, -1, XFS_SB_ALL_BITS); libxfs_writebuf(bp, LIBXFS_EXIT_ON_FAILURE); } diff --git a/libxfs/trans.c b/libxfs/trans.c index 38dcedbc2..ce1585afe 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -118,6 +118,7 @@ libxfs_trans_iget( xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, + uint flags, uint lock_flags, xfs_inode_t **ipp) { diff --git a/libxfs/util.c b/libxfs/util.c index 0fb9671f4..f39ba1b3e 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -161,7 +161,7 @@ libxfs_ialloc( } ASSERT(*ialloc_context == NULL); - error = xfs_trans_iget(tp->t_mountp, tp, ino, 0, &ip); + error = xfs_trans_iget(tp->t_mountp, tp, ino, 0, 0, &ip); if (error != 0) return error; ASSERT(ip != NULL); @@ -339,8 +339,8 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) * because if the inode is dirty at all the core must * be. */ - xfs_xlate_dinode_core((xfs_caddr_t)&(dip->di_core), &(ip->i_d), -1, - ARCH_CONVERT); + xfs_xlate_dinode_core((xfs_caddr_t)&(dip->di_core), &(ip->i_d), -1); + /* * If this is really an old format inode and the superblock version * has not been updated to support only new format inodes, then @@ -367,7 +367,7 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp) INT_SET(dip->di_core.di_version, ARCH_CONVERT, XFS_DINODE_VERSION_2); ip->i_d.di_onlink = 0; - INT_ZERO(dip->di_core.di_onlink, ARCH_CONVERT); + dip->di_core.di_onlink = 0; memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); memset(&(dip->di_core.di_pad[0]), 0, sizeof(dip->di_core.di_pad)); diff --git a/libxfs/xfs.h b/libxfs/xfs.h index 01adbb81c..bdffc7f87 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -232,6 +232,7 @@ /* space allocation */ #define xfs_alloc_search_busy(tp,ag,b,len) ((void) 0) #define xfs_alloc_mark_busy(tp,ag,b,len) ((void) 0) +#define xfs_rotorstep 1 /* anything else */ #if !defined(__sgi__) @@ -327,10 +328,10 @@ static inline int atomicIncWithWrap(int *a, int b) */ /* xfs_alloc.c */ -int xfs_alloc_get_freelist (xfs_trans_t *, xfs_buf_t *, xfs_agblock_t *); +int xfs_alloc_get_freelist (xfs_trans_t *, xfs_buf_t *, xfs_agblock_t *, int); void xfs_alloc_log_agf (xfs_trans_t *, xfs_buf_t *, int); int xfs_alloc_put_freelist (xfs_trans_t *, xfs_buf_t *, xfs_buf_t *, - xfs_agblock_t); + xfs_agblock_t, int); int xfs_alloc_read_agf (xfs_mount_t *, xfs_trans_t *, xfs_agnumber_t, int, xfs_buf_t **); int xfs_alloc_vextent (xfs_alloc_arg_t *); diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 90f7e9091..1d65002cb 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2005 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 @@ -1375,7 +1375,8 @@ xfs_alloc_ag_vextent_small( else if (args->minlen == 1 && args->alignment == 1 && !args->isfl && (INT_GET(XFS_BUF_TO_AGF(args->agbp)->agf_flcount, ARCH_CONVERT) > args->minleft)) { - if ((error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno))) + error = xfs_alloc_get_freelist(args->tp, args->agbp, &fbno, 0); + if (error) goto error0; if (fbno != NULLAGBLOCK) { if (args->userdata) { @@ -1840,7 +1841,7 @@ xfs_alloc_fix_freelist( while (INT_GET(agf->agf_flcount, ARCH_CONVERT) > need) { xfs_buf_t *bp; - if ((error = xfs_alloc_get_freelist(tp, agbp, &bno))) + if ((error = xfs_alloc_get_freelist(tp, agbp, &bno, 0))) return error; if ((error = xfs_free_ag_extent(tp, agbp, args->agno, bno, 1, 1))) return error; @@ -1884,7 +1885,7 @@ xfs_alloc_fix_freelist( */ for (bno = targs.agbno; bno < targs.agbno + targs.len; bno++) { if ((error = xfs_alloc_put_freelist(tp, agbp, agflbp, - bno))) + bno, 0))) return error; } } @@ -1900,13 +1901,15 @@ int /* error */ xfs_alloc_get_freelist( xfs_trans_t *tp, /* transaction pointer */ xfs_buf_t *agbp, /* buffer containing the agf structure */ - xfs_agblock_t *bnop) /* block address retrieved from freelist */ + xfs_agblock_t *bnop, /* block address retrieved from freelist */ + int btreeblk) /* destination is a AGF btree */ { xfs_agf_t *agf; /* a.g. freespace structure */ xfs_agfl_t *agfl; /* a.g. freelist structure */ xfs_buf_t *agflbp;/* buffer for a.g. freelist structure */ xfs_agblock_t bno; /* block number returned */ int error; + int logflags; #ifdef XFS_ALLOC_TRACE static char fname[] = "xfs_alloc_get_freelist"; #endif @@ -1917,7 +1920,7 @@ xfs_alloc_get_freelist( /* * Freelist is empty, give up. */ - if (INT_ISZERO(agf->agf_flcount, ARCH_CONVERT)) { + if (!agf->agf_flcount) { *bnop = NULLAGBLOCK; return 0; } @@ -1936,13 +1939,21 @@ xfs_alloc_get_freelist( INT_MOD(agf->agf_flfirst, ARCH_CONVERT, 1); xfs_trans_brelse(tp, agflbp); if (INT_GET(agf->agf_flfirst, ARCH_CONVERT) == XFS_AGFL_SIZE(mp)) - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)]; INT_MOD(agf->agf_flcount, ARCH_CONVERT, -1); xfs_trans_agflist_delta(tp, -1); pag->pagf_flcount--; - TRACE_MODAGF(NULL, agf, XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT); - xfs_alloc_log_agf(tp, agbp, XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT); + + logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT; + if (btreeblk) { + INT_MOD(agf->agf_btreeblks, ARCH_CONVERT, 1); + pag->pagf_btreeblks++; + logflags |= XFS_AGF_BTREEBLKS; + } + + TRACE_MODAGF(NULL, agf, logflags); + xfs_alloc_log_agf(tp, agbp, logflags); *bnop = bno; /* @@ -1980,6 +1991,7 @@ xfs_alloc_log_agf( offsetof(xfs_agf_t, agf_flcount), offsetof(xfs_agf_t, agf_freeblks), offsetof(xfs_agf_t, agf_longest), + offsetof(xfs_agf_t, agf_btreeblks), sizeof(xfs_agf_t) }; @@ -2015,12 +2027,14 @@ xfs_alloc_put_freelist( xfs_trans_t *tp, /* transaction pointer */ xfs_buf_t *agbp, /* buffer for a.g. freelist header */ xfs_buf_t *agflbp,/* buffer for a.g. free block array */ - xfs_agblock_t bno) /* block being freed */ + xfs_agblock_t bno, /* block being freed */ + int btreeblk) /* block came from a AGF btree */ { xfs_agf_t *agf; /* a.g. freespace structure */ xfs_agfl_t *agfl; /* a.g. free block array */ xfs_agblock_t *blockp;/* pointer to array entry */ int error; + int logflags; #ifdef XFS_ALLOC_TRACE static char fname[] = "xfs_alloc_put_freelist"; #endif @@ -2036,16 +2050,26 @@ xfs_alloc_put_freelist( agfl = XFS_BUF_TO_AGFL(agflbp); INT_MOD(agf->agf_fllast, ARCH_CONVERT, 1); if (INT_GET(agf->agf_fllast, ARCH_CONVERT) == XFS_AGFL_SIZE(mp)) - INT_ZERO(agf->agf_fllast, ARCH_CONVERT); + agf->agf_fllast = 0; pag = &mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)]; INT_MOD(agf->agf_flcount, ARCH_CONVERT, 1); xfs_trans_agflist_delta(tp, 1); pag->pagf_flcount++; + + logflags = XFS_AGF_FLLAST | XFS_AGF_FLCOUNT; + if (btreeblk) { + INT_MOD(agf->agf_btreeblks, ARCH_CONVERT, -1); + pag->pagf_btreeblks--; + logflags |= XFS_AGF_BTREEBLKS; + } + + TRACE_MODAGF(NULL, agf, logflags); + xfs_alloc_log_agf(tp, agbp, logflags); ASSERT(INT_GET(agf->agf_flcount, ARCH_CONVERT) <= XFS_AGFL_SIZE(mp)); blockp = &agfl->agfl_bno[INT_GET(agf->agf_fllast, ARCH_CONVERT)]; INT_SET(*blockp, ARCH_CONVERT, bno); - TRACE_MODAGF(NULL, agf, XFS_AGF_FLLAST | XFS_AGF_FLCOUNT); - xfs_alloc_log_agf(tp, agbp, XFS_AGF_FLLAST | XFS_AGF_FLCOUNT); + TRACE_MODAGF(NULL, agf, logflags); + xfs_alloc_log_agf(tp, agbp, logflags); xfs_trans_log_buf(tp, agflbp, (int)((xfs_caddr_t)blockp - (xfs_caddr_t)agfl), (int)((xfs_caddr_t)blockp - (xfs_caddr_t)agfl + @@ -2107,6 +2131,7 @@ xfs_alloc_read_agf( pag = &mp->m_perag[agno]; if (!pag->pagf_init) { pag->pagf_freeblks = INT_GET(agf->agf_freeblks, ARCH_CONVERT); + pag->pagf_btreeblks = INT_GET(agf->agf_btreeblks, ARCH_CONVERT); pag->pagf_flcount = INT_GET(agf->agf_flcount, ARCH_CONVERT); pag->pagf_longest = INT_GET(agf->agf_longest, ARCH_CONVERT); pag->pagf_levels[XFS_BTNUM_BNOi] = @@ -2155,6 +2180,7 @@ xfs_alloc_vextent( xfs_alloctype_t type; /* input allocation type */ int bump_rotor = 0; int no_min = 0; + xfs_agnumber_t rotorstep = xfs_rotorstep; /* inode32 agf stepper */ mp = args->mp; type = args->otype = args->type; @@ -2218,7 +2244,9 @@ xfs_alloc_vextent( */ if ((args->userdata == XFS_ALLOC_INITIAL_USER_DATA) && (mp->m_flags & XFS_MOUNT_32BITINODES)) { - args->fsbno = XFS_AGB_TO_FSB(mp, mp->m_agfrotor, 0); + args->fsbno = XFS_AGB_TO_FSB(mp, + ((mp->m_agfrotor / rotorstep) % + mp->m_sb.sb_agcount), 0); bump_rotor = 1; } args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno); @@ -2234,7 +2262,8 @@ xfs_alloc_vextent( /* * Start with the last place we left off. */ - args->agno = sagno = mp->m_agfrotor; + args->agno = sagno = (mp->m_agfrotor / rotorstep) % + mp->m_sb.sb_agcount; args->type = XFS_ALLOCTYPE_THIS_AG; flags = XFS_ALLOC_FLAG_TRYLOCK; } else if (type == XFS_ALLOCTYPE_FIRST_AG) { @@ -2308,8 +2337,14 @@ xfs_alloc_vextent( } } up_read(&mp->m_peraglock); - if (bump_rotor || (type == XFS_ALLOCTYPE_ANY_AG)) - mp->m_agfrotor = (args->agno + 1) % mp->m_sb.sb_agcount; + if (bump_rotor || (type == XFS_ALLOCTYPE_ANY_AG)) { + if (args->agno == sagno) + mp->m_agfrotor = (mp->m_agfrotor + 1) % + (mp->m_sb.sb_agcount * rotorstep); + else + mp->m_agfrotor = (args->agno * rotorstep + 1) % + (mp->m_sb.sb_agcount * rotorstep); + } break; default: ASSERT(0); diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c index c3338a27b..5a41feb6d 100644 --- a/libxfs/xfs_alloc_btree.c +++ b/libxfs/xfs_alloc_btree.c @@ -173,7 +173,7 @@ xfs_alloc_delrec( * No free extents left. */ else - INT_ZERO(agf->agf_longest, ARCH_CONVERT); + agf->agf_longest = 0; mp->m_perag[INT_GET(agf->agf_seqno, ARCH_CONVERT)].pagf_longest = INT_GET(agf->agf_longest, ARCH_CONVERT); xfs_alloc_log_agf(cur->bc_tp, cur->bc_private.a.agbp, @@ -202,7 +202,7 @@ xfs_alloc_delrec( * Put this buffer/block on the ag's freelist. */ if ((error = xfs_alloc_put_freelist(cur->bc_tp, - cur->bc_private.a.agbp, NULL, bno))) + cur->bc_private.a.agbp, NULL, bno, 1))) return error; /* * Since blocks move to the free list without the @@ -524,7 +524,7 @@ xfs_alloc_delrec( * Free the deleting block by putting it on the freelist. */ if ((error = xfs_alloc_put_freelist(cur->bc_tp, cur->bc_private.a.agbp, - NULL, rbno))) + NULL, rbno, 1))) return error; /* * Since blocks move to the free list without the coordination @@ -1282,7 +1282,7 @@ xfs_alloc_newroot( * Get a buffer from the freelist blocks, for the new root. */ if ((error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, - &nbno))) + &nbno, 1))) return error; /* * None available, we fail. @@ -1566,7 +1566,7 @@ xfs_alloc_split( * If we can't do it, we're toast. Give up. */ if ((error = xfs_alloc_get_freelist(cur->bc_tp, cur->bc_private.a.agbp, - &rbno))) + &rbno, 1))) return error; if (rbno == NULLAGBLOCK) { *stat = 0; diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index c3c8010a0..29d12de97 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -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_ISZERO(hdr->firstused, ARCH_CONVERT)) { + if (!hdr->firstused) { 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_ISZERO(map->size, ARCH_CONVERT)) + if (!map->size) continue; /* no space in this map */ tmp = entsize; if (INT_GET(map->base, ARCH_CONVERT) @@ -303,8 +303,8 @@ xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex) memcpy((char *)name_rmt->name, args->name, args->namelen); entry->flags |= XFS_ATTR_INCOMPLETE; /* just in case */ - INT_ZERO(name_rmt->valuelen, ARCH_CONVERT); - INT_ZERO(name_rmt->valueblk, ARCH_CONVERT); + name_rmt->valuelen = 0; + name_rmt->valueblk = 0; args->rmtblkno = 1; args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen); } @@ -369,12 +369,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_ISZERO(hdr_d->firstused, ARCH_CONVERT)) { + if (!hdr_d->firstused) { INT_SET(hdr_d->firstused, ARCH_CONVERT, XFS_LBSIZE(mp) - XFS_ATTR_LEAF_NAME_ALIGN); } - INT_ZERO(hdr_d->usedbytes, ARCH_CONVERT); - INT_ZERO(hdr_d->count, ARCH_CONVERT); + hdr_d->usedbytes = 0; + hdr_d->count = 0; hdr_d->holes = 0; INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, sizeof(xfs_attr_leaf_hdr_t)); @@ -728,7 +728,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_ISZERO(info->forw, ARCH_CONVERT)); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -872,13 +872,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_ZERO(tmp_hdr->count, ARCH_CONVERT); + tmp_hdr->count = 0; INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); - if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) { + if (!tmp_hdr->firstused) { INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize - XFS_ATTR_LEAF_NAME_ALIGN); } - INT_ZERO(tmp_hdr->usedbytes, ARCH_CONVERT); + tmp_hdr->usedbytes = 0; 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), @@ -1064,10 +1064,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_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_d->freemap[1].base = 0; + hdr_d->freemap[2].base = 0; + hdr_d->freemap[1].size = 0; + hdr_d->freemap[2].size = 0; hdr_s->holes = 1; /* leaf may not be compact */ } @@ -1112,7 +1112,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_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return(0); return(INT_GET(leaf->entries[INT_GET(leaf->hdr.count, ARCH_CONVERT)-1].hashval, ARCH_CONVERT)); diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 135607ec5..cb5cca094 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -2763,7 +2763,7 @@ xfs_bmap_extents_to_btree( */ ablock = XFS_BUF_TO_BMBT_BLOCK(abp); INT_SET(ablock->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC); - INT_ZERO(ablock->bb_level, ARCH_CONVERT); + ablock->bb_level = 0; INT_SET(ablock->bb_leftsib, ARCH_CONVERT, NULLDFSBNO); INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO); arp = XFS_BMAP_REC_IADDR(ablock, 1, cur); diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c index b0c277dbe..5528db049 100644 --- a/libxfs/xfs_btree.c +++ b/libxfs/xfs_btree.c @@ -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_ISZERO(block->bb_leftsib, ARCH_CONVERT) && + block->bb_leftsib && (INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLDFSBNO || XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_leftsib, ARCH_CONVERT))) && - !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT) && + block->bb_rightsib && (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLDFSBNO || XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_rightsib, ARCH_CONVERT))); if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK, @@ -305,10 +305,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_ISZERO(block->bb_leftsib, ARCH_CONVERT) && + block->bb_leftsib && (INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK || INT_GET(block->bb_rightsib, ARCH_CONVERT) < agflen) && - !INT_ISZERO(block->bb_rightsib, ARCH_CONVERT); + block->bb_rightsib; if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp, XFS_ERRTAG_BTREE_CHECK_SBLOCK, XFS_RANDOM_BTREE_CHECK_SBLOCK))) { @@ -460,7 +460,7 @@ xfs_btree_firstrec( /* * It's empty, there is no such record. */ - if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT)) + if (!block->bb_h.bb_numrecs) return 0; /* * Set the ptr value to 1, that's the first record/key. @@ -674,7 +674,7 @@ xfs_btree_lastrec( /* * It's empty, there is no such record. */ - if (INT_ISZERO(block->bb_h.bb_numrecs, ARCH_CONVERT)) + if (!block->bb_h.bb_numrecs) return 0; /* * Set the ptr value to numrecs, that's the last record/key. diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index f0e9e4856..16a5075cf 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -62,11 +62,11 @@ xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level, return(error); ASSERT(bp != NULL); node = bp->data; - INT_ZERO(node->hdr.info.forw, ARCH_CONVERT); - INT_ZERO(node->hdr.info.back, ARCH_CONVERT); + node->hdr.info.forw = 0; + node->hdr.info.back = 0; INT_SET(node->hdr.info.magic, ARCH_CONVERT, XFS_DA_NODE_MAGIC); - INT_ZERO(node->hdr.info.pad, ARCH_CONVERT); - INT_ZERO(node->hdr.count, ARCH_CONVERT); + node->hdr.info.pad = 0; + node->hdr.count = 0; INT_SET(node->hdr.level, ARCH_CONVERT, level); xfs_da_log_buf(tp, bp, @@ -231,7 +231,7 @@ xfs_da_split(xfs_da_state_t *state) */ node = oldblk->bp->data; - if (!INT_ISZERO(node->hdr.info.forw, ARCH_CONVERT)) { + if (node->hdr.info.forw) { if (INT_GET(node->hdr.info.forw, ARCH_CONVERT) == addblk->blkno) { bp = addblk->bp; } else { @@ -716,8 +716,8 @@ xfs_da_root_join(xfs_da_state_t *state, xfs_da_state_blk_t *root_blk) ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC); oldroot = root_blk->bp->data; ASSERT(INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); - ASSERT(INT_ISZERO(oldroot->hdr.info.forw, ARCH_CONVERT)); - ASSERT(INT_ISZERO(oldroot->hdr.info.back, ARCH_CONVERT)); + ASSERT(!oldroot->hdr.info.forw); + ASSERT(!oldroot->hdr.info.back); /* * If the root has more than one child, then don't do anything. @@ -743,8 +743,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_ISZERO(blkinfo->forw, ARCH_CONVERT)); - ASSERT(INT_ISZERO(blkinfo->back, ARCH_CONVERT)); + ASSERT(!blkinfo->forw); + ASSERT(!blkinfo->back); memcpy(root_blk->bp->data, 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); @@ -796,7 +796,7 @@ xfs_da_node_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_ISZERO(info->forw, ARCH_CONVERT)); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1341,7 +1341,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_ISZERO(node->hdr.count, ARCH_CONVERT)) + if (!node->hdr.count) return(0); return(INT_GET(node->btree[ INT_GET(node->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); } diff --git a/libxfs/xfs_dir.c b/libxfs/xfs_dir.c index ba6561f04..7825ff2df 100644 --- a/libxfs/xfs_dir.c +++ b/libxfs/xfs_dir.c @@ -398,7 +398,7 @@ xfs_dir_leaf_replace(xfs_da_args_t *args) entry = &leaf->entries[index]; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); /* XXX - replace assert? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&inum, &namest->inumber); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber))); xfs_da_buf_done(bp); @@ -600,7 +600,7 @@ xfs_dir_node_replace(xfs_da_args_t *args) entry = &leaf->entries[blk->index]; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); /* XXX - replace assert ? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&inum, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&inum, &namest->inumber); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, sizeof(namest->inumber))); xfs_da_buf_done(bp); diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index e9814448f..0038b3d5a 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -100,11 +100,11 @@ xfs_dir2_block_addname( */ bf = block->hdr.bestfree; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * No stale entries? Need space for entry and new leaf. */ - if (INT_ISZERO(btp->stale, ARCH_CONVERT)) { + if (!btp->stale) { /* * Tag just before the first leaf entry. */ @@ -292,7 +292,7 @@ xfs_dir2_block_addname( /* * No stale entries, will use enddup space to hold new leaf. */ - if (INT_ISZERO(btp->stale, ARCH_CONVERT)) { + if (!btp->stale) { /* * Mark the space needed for the new leaf entry, now in use. */ @@ -425,7 +425,7 @@ xfs_dir2_block_log_leaf( mp = tp->t_mountp; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); xfs_da_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)block), (uint)((char *)&blp[last + 1] - (char *)block - 1)); } @@ -479,7 +479,7 @@ xfs_dir2_block_lookup( block = bp->data; xfs_dir2_data_check(dp, bp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Get the offset from the leaf entry, to point to the data. */ @@ -531,7 +531,7 @@ xfs_dir2_block_lookup_int( block = bp->data; xfs_dir2_data_check(dp, bp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Loop doing a binary search for our hash value. * Find our entry, ENOENT if it's not there. @@ -624,7 +624,7 @@ xfs_dir2_block_removename( mp = dp->i_mount; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Point to the data entry using the leaf entry. */ @@ -700,7 +700,7 @@ xfs_dir2_block_replace( mp = dp->i_mount; block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Point to the data entry we need to change. */ @@ -776,7 +776,7 @@ xfs_dir2_leaf_to_block( * These will show up in the leaf bests table. */ while (dp->i_d.di_size > mp->m_dirblksize) { - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); if (INT_GET(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1], ARCH_CONVERT) == mp->m_dirblksize - (uint)sizeof(block->hdr)) { if ((error = @@ -831,12 +831,12 @@ 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_ZERO(btp->stale, ARCH_CONVERT); + btp->stale = 0; xfs_dir2_block_log_tail(tp, dbp); /* * Initialize the block leaf area. We compact out stale entries. */ - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + lep = XFS_DIR2_BLOCK_LEAF_P(btp); for (from = to = 0; from < INT_GET(leaf->hdr.count, ARCH_CONVERT); from++) { if (INT_GET(leaf->ents[from].address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR) continue; @@ -977,8 +977,8 @@ xfs_dir2_sf_to_block( */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); INT_SET(btp->count, ARCH_CONVERT, INT_GET(sfp->hdr.count, ARCH_CONVERT) + 2); /* ., .. */ - INT_ZERO(btp->stale, ARCH_CONVERT); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + btp->stale = 0; + blp = XFS_DIR2_BLOCK_LEAF_P(btp); endoffset = (uint)((char *)blp - (char *)block); /* * Remove the freespace, we'll manage it. @@ -1004,7 +1004,7 @@ xfs_dir2_sf_to_block( */ dep = (xfs_dir2_data_entry_t *) ((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET); - INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT)); + INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); dep->namelen = 2; dep->name[0] = dep->name[1] = '.'; tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); @@ -1031,7 +1031,7 @@ xfs_dir2_sf_to_block( if (sfep == NULL) newoffset = endoffset; else - newoffset = XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT); + newoffset = XFS_DIR2_SF_GET_OFFSET(sfep); /* * There should be a hole here, make one. */ @@ -1040,7 +1040,7 @@ xfs_dir2_sf_to_block( ((char *)block + offset); INT_SET(dup->freetag, ARCH_CONVERT, XFS_DIR2_DATA_FREE_TAG); INT_SET(dup->length, ARCH_CONVERT, newoffset - offset); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT, + 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); @@ -1053,8 +1053,8 @@ xfs_dir2_sf_to_block( * Copy a real entry. */ dep = (xfs_dir2_data_entry_t *)((char *)block + newoffset); - INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT)); + INT_SET(dep->inumber, ARCH_CONVERT, XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep))); dep->namelen = sfep->namelen; memcpy(dep->name, sfep->name, dep->namelen); tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index 40c387c9a..78de11141 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -76,7 +76,7 @@ xfs_dir2_data_check( p = (char *)d->u; if (INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - lep = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + lep = XFS_DIR2_BLOCK_LEAF_P(btp); endp = (char *)lep; } else endp = (char *)d + mp->m_dirblksize; @@ -84,16 +84,16 @@ xfs_dir2_data_check( /* * Account for zero bestfree entries. */ - if (INT_ISZERO(bf[0].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[0].offset, ARCH_CONVERT)); + if (!bf[0].length) { + ASSERT(!bf[0].offset); freeseen |= 1 << 0; } - if (INT_ISZERO(bf[1].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[1].offset, ARCH_CONVERT)); + if (!bf[1].length) { + ASSERT(!bf[1].offset); freeseen |= 1 << 1; } - if (INT_ISZERO(bf[2].length, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(bf[2].offset, ARCH_CONVERT)); + if (!bf[2].length) { + ASSERT(!bf[2].offset); freeseen |= 1 << 2; } ASSERT(INT_GET(bf[0].length, ARCH_CONVERT) >= INT_GET(bf[1].length, ARCH_CONVERT)); @@ -110,7 +110,7 @@ xfs_dir2_data_check( */ if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) { ASSERT(lastfree == 0); - ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT) == + ASSERT(INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT) == (char *)dup - (char *)d); dfp = xfs_dir2_data_freefind(d, dup); if (dfp) { @@ -195,8 +195,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_ISZERO(dfp->offset, ARCH_CONVERT)) { - ASSERT(INT_ISZERO(dfp->length, ARCH_CONVERT)); + if (!dfp->offset) { + ASSERT(!dfp->length); seenzero = 1; continue; } @@ -225,7 +225,7 @@ xfs_dir2_data_freefind( for (dfp = &d->hdr.bestfree[0]; dfp < &d->hdr.bestfree[XFS_DIR2_DATA_FD_COUNT]; dfp++) { - if (INT_ISZERO(dfp->offset, ARCH_CONVERT)) + if (!dfp->offset) return NULL; if (INT_GET(dfp->offset, ARCH_CONVERT) == off) return dfp; @@ -312,8 +312,8 @@ xfs_dir2_data_freeremove( /* * Clear the 3rd entry, must be zero now. */ - INT_ZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); - INT_ZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT); + d->hdr.bestfree[2].length = 0; + d->hdr.bestfree[2].offset = 0; *loghead = 1; } @@ -350,7 +350,7 @@ xfs_dir2_data_freescan( endp = aendp; else if (INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - endp = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endp = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } else endp = (char *)d + mp->m_dirblksize; /* @@ -363,7 +363,7 @@ xfs_dir2_data_freescan( */ if (INT_GET(dup->freetag, ARCH_CONVERT) == XFS_DIR2_DATA_FREE_TAG) { ASSERT((char *)dup - (char *)d == - INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT)); + 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); } @@ -418,8 +418,8 @@ xfs_dir2_data_init( INT_SET(d->hdr.magic, ARCH_CONVERT, XFS_DIR2_DATA_MAGIC); INT_SET(d->hdr.bestfree[0].offset, ARCH_CONVERT, (xfs_dir2_data_off_t)sizeof(d->hdr)); for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) { - INT_ZERO(d->hdr.bestfree[i].length, ARCH_CONVERT); - INT_ZERO(d->hdr.bestfree[i].offset, ARCH_CONVERT); + d->hdr.bestfree[i].length = 0; + d->hdr.bestfree[i].offset = 0; } /* * Set up an unused entry for the block's body. @@ -430,7 +430,7 @@ xfs_dir2_data_init( t=mp->m_dirblksize - (uint)sizeof(d->hdr); INT_SET(d->hdr.bestfree[0].length, ARCH_CONVERT, t); INT_SET(dup->length, ARCH_CONVERT, t); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT, + INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dup - (char *)d)); /* * Log it and return it. @@ -501,8 +501,8 @@ xfs_dir2_data_log_unused( * Log the end (tag) of the unused entry. */ xfs_da_log_buf(tp, bp, - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT) - (char *)d), - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT) - (char *)d + + (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d), + (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d + sizeof(xfs_dir2_data_off_t) - 1)); } @@ -540,7 +540,7 @@ xfs_dir2_data_make_free( ASSERT(INT_GET(d->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC); btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d); - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } /* * If this isn't the start of the block, then back up to @@ -586,12 +586,12 @@ xfs_dir2_data_make_free( * since the third bestfree is there, there might be more * entries. */ - needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].length; /* * Fix up the new big freespace. */ INT_MOD(prevdup->length, ARCH_CONVERT, len + INT_GET(postdup->length, ARCH_CONVERT)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(prevdup, ARCH_CONVERT), ARCH_CONVERT, + 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); if (!needscan) { @@ -615,8 +615,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_ISZERO(dfp[1].length, ARCH_CONVERT)); - ASSERT(INT_ISZERO(dfp[2].length, ARCH_CONVERT)); + ASSERT(!dfp[1].length); + ASSERT(!dfp[2].length); } } /* @@ -625,7 +625,7 @@ xfs_dir2_data_make_free( else if (prevdup) { dfp = xfs_dir2_data_freefind(d, prevdup); INT_MOD(prevdup->length, ARCH_CONVERT, len); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(prevdup, ARCH_CONVERT), ARCH_CONVERT, + 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); /* @@ -651,7 +651,7 @@ xfs_dir2_data_make_free( 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)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + 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); /* @@ -676,7 +676,7 @@ xfs_dir2_data_make_free( 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_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + 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); (void)xfs_dir2_data_freeinsert(d, newdup, needlogp); @@ -712,7 +712,7 @@ xfs_dir2_data_use_free( ASSERT(INT_GET(dup->freetag, ARCH_CONVERT) == 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((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, ARCH_CONVERT), ARCH_CONVERT)); + ASSERT((char *)dup - (char *)d == INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), ARCH_CONVERT)); /* * Look up the entry in the bestfree table. */ @@ -732,7 +732,7 @@ xfs_dir2_data_use_free( */ if (matchfront && matchback) { if (dfp) { - needscan = !INT_ISZERO(d->hdr.bestfree[2].offset, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].offset; if (!needscan) xfs_dir2_data_freeremove(d, dfp, needlogp); } @@ -745,7 +745,7 @@ xfs_dir2_data_use_free( 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); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + 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); /* @@ -773,7 +773,7 @@ xfs_dir2_data_use_free( newdup = dup; INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t) (((char *)d + offset) - (char *)newdup)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + 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); /* @@ -801,13 +801,13 @@ xfs_dir2_data_use_free( newdup = dup; INT_SET(newdup->length, ARCH_CONVERT, (xfs_dir2_data_off_t) (((char *)d + offset) - (char *)newdup)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup, ARCH_CONVERT), ARCH_CONVERT, + 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)); - INT_SET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(newdup2, ARCH_CONVERT), ARCH_CONVERT, + 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); /* @@ -819,7 +819,7 @@ xfs_dir2_data_use_free( * the 2 new will work. */ if (dfp) { - needscan = !INT_ISZERO(d->hdr.bestfree[2].length, ARCH_CONVERT); + needscan = d->hdr.bestfree[2].length; if (!needscan) { xfs_dir2_data_freeremove(d, dfp, needlogp); (void)xfs_dir2_data_freeinsert(d, newdup, diff --git a/libxfs/xfs_dir2_leaf.c b/libxfs/xfs_dir2_leaf.c index 9205950a0..bd71d797f 100644 --- a/libxfs/xfs_dir2_leaf.c +++ b/libxfs/xfs_dir2_leaf.c @@ -90,7 +90,7 @@ xfs_dir2_block_to_leaf( block = dbp->data; xfs_dir2_data_check(dp, dbp); btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Set the counts in the leaf header. */ @@ -125,7 +125,7 @@ xfs_dir2_block_to_leaf( */ ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); INT_SET(ltp->bestcount, ARCH_CONVERT, 1); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); INT_COPY(bestsp[0], block->hdr.bestfree[0].length, ARCH_CONVERT); /* * Log the data header and leaf bests table. @@ -196,7 +196,7 @@ xfs_dir2_leaf_addname( index = xfs_dir2_leaf_search_hash(args, lbp); leaf = lbp->data; ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); length = XFS_DIR2_DATA_ENTSIZE(args->namelen); /* * See if there are any entries with the same hash value @@ -237,7 +237,7 @@ xfs_dir2_leaf_addname( * How many bytes do we need in the leaf block? */ needbytes = - (!INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT) ? 0 : (uint)sizeof(leaf->ents[0])) + + (leaf->hdr.stale ? 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_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { /* * lep is still good as the index leaf entry. */ @@ -558,7 +558,7 @@ xfs_dir2_leaf_check( * Leaves and bests don't overlap. */ ASSERT((char *)&leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT)] <= - (char *)XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT)); + (char *)XFS_DIR2_LEAF_BESTS_P(ltp)); /* * Check hash value order, count stale entries. */ @@ -588,7 +588,7 @@ xfs_dir2_leaf_compact( int to; /* target leaf index */ leaf = bp->data; - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { return; } /* @@ -612,7 +612,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_ZERO(leaf->hdr.stale, ARCH_CONVERT); + leaf->hdr.stale = 0; xfs_dir2_leaf_log_header(args->trans, bp); if (loglow != -1) xfs_dir2_leaf_log_ents(args->trans, bp, loglow, to - 1); @@ -766,10 +766,10 @@ xfs_dir2_leaf_init( * Initialize the header. */ INT_SET(leaf->hdr.info.magic, ARCH_CONVERT, magic); - INT_ZERO(leaf->hdr.info.forw, ARCH_CONVERT); - INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT); - INT_ZERO(leaf->hdr.count, ARCH_CONVERT); - INT_ZERO(leaf->hdr.stale, ARCH_CONVERT); + leaf->hdr.info.forw = 0; + leaf->hdr.info.back = 0; + leaf->hdr.count = 0; + leaf->hdr.stale = 0; xfs_dir2_leaf_log_header(tp, bp); /* * If it's a leaf-format directory initialize the tail. @@ -778,7 +778,7 @@ xfs_dir2_leaf_init( */ if (magic == XFS_DIR2_LEAF1_MAGIC) { ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - INT_ZERO(ltp->bestcount, ARCH_CONVERT); + ltp->bestcount = 0; xfs_dir2_leaf_log_tail(tp, bp); } *bpp = bp; @@ -803,8 +803,8 @@ xfs_dir2_leaf_log_bests( leaf = bp->data; ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAF1_MAGIC); ltp = XFS_DIR2_LEAF_TAIL_P(tp->t_mountp, leaf); - firstb = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT) + first; - lastb = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT) + last; + firstb = XFS_DIR2_LEAF_BESTS_P(ltp) + first; + lastb = XFS_DIR2_LEAF_BESTS_P(ltp) + last; xfs_da_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf), (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); } @@ -1071,7 +1071,7 @@ xfs_dir2_leaf_removename( needscan = needlog = 0; oldbest = INT_GET(data->hdr.bestfree[0].length, ARCH_CONVERT); ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); ASSERT(INT_GET(bestsp[db], ARCH_CONVERT) == oldbest); /* * Mark the former data entry unused. @@ -1232,7 +1232,7 @@ xfs_dir2_leaf_search_hash( leaf = lbp->data; #ifndef __KERNEL__ - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return 0; #endif /* @@ -1323,7 +1323,7 @@ xfs_dir2_leaf_trim_data( /* * Eliminate the last bests entry from the table. */ - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); INT_MOD(ltp->bestcount, ARCH_CONVERT, -1); memmove(&bestsp[1], &bestsp[0], INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(*bestsp)); xfs_dir2_leaf_log_tail(tp, lbp); @@ -1409,7 +1409,7 @@ xfs_dir2_node_to_leaf( } free = fbp->data; ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC); - ASSERT(INT_ISZERO(free->hdr.firstdb, ARCH_CONVERT)); + ASSERT(!free->hdr.firstdb); /* * Now see if the leafn and free data will fit in a leaf1. * If not, release the buffer and give up. @@ -1439,7 +1439,7 @@ xfs_dir2_node_to_leaf( /* * Set up the leaf bests table. */ - memcpy(XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), free->bests, + memcpy(XFS_DIR2_LEAF_BESTS_P(ltp), free->bests, INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(leaf->bests[0])); xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1); xfs_dir2_leaf_log_tail(tp, lbp); diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index b197c78ad..84dc6be11 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -125,14 +125,14 @@ xfs_dir2_leaf_to_node( * Initialize the freespace block header. */ INT_SET(free->hdr.magic, ARCH_CONVERT, XFS_DIR2_FREE_MAGIC); - INT_ZERO(free->hdr.firstdb, ARCH_CONVERT); + free->hdr.firstdb = 0; ASSERT(INT_GET(ltp->bestcount, ARCH_CONVERT) <= (uint)dp->i_d.di_size / mp->m_dirblksize); INT_COPY(free->hdr.nvalid, ltp->bestcount, ARCH_CONVERT); /* * Copy freespace entries from the leaf block to the new block. * Count active entries. */ - for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT), to = free->bests; + for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests; i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++, from++, to++) { if ((off = INT_GET(*from, ARCH_CONVERT)) != NULLDATAOFF) n++; @@ -193,7 +193,7 @@ xfs_dir2_leafn_add( */ if (INT_GET(leaf->hdr.count, ARCH_CONVERT) == XFS_DIR2_MAX_LEAF_ENTS(mp)) { - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) + if (!leaf->hdr.stale) return XFS_ERROR(ENOSPC); compact = INT_GET(leaf->hdr.stale, ARCH_CONVERT) > 1; } else @@ -216,14 +216,14 @@ xfs_dir2_leafn_add( /* * Set impossible logging indices for this case. */ - else if (!INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + else if (leaf->hdr.stale) { lfloglow = INT_GET(leaf->hdr.count, ARCH_CONVERT); lfloghigh = -1; } /* * No stale entries, just insert a space for the new entry. */ - if (INT_ISZERO(leaf->hdr.stale, ARCH_CONVERT)) { + if (!leaf->hdr.stale) { lep = &leaf->ents[index]; if (index < INT_GET(leaf->hdr.count, ARCH_CONVERT)) memmove(lep + 1, lep, @@ -356,7 +356,7 @@ xfs_dir2_leafn_lasthash( ASSERT(INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC); if (count) *count = INT_GET(leaf->hdr.count, ARCH_CONVERT); - if (INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return 0; return INT_GET(leaf->ents[INT_GET(leaf->hdr.count, ARCH_CONVERT) - 1].hashval, ARCH_CONVERT); } @@ -643,7 +643,7 @@ xfs_dir2_leafn_moveents( * If the source has stale leaves, count the ones in the copy range * so we can update the header correctly. */ - if (!INT_ISZERO(leaf_s->hdr.stale, ARCH_CONVERT)) { + if (leaf_s->hdr.stale) { int i; /* temp leaf index */ for (i = start_s, stale = 0; i < start_s + count; i++) { @@ -973,7 +973,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_ISZERO(free->hdr.nused, ARCH_CONVERT)) { + if (!free->hdr.nused) { error = xfs_dir2_shrink_inode(args, fdb, fbp); if (error == 0) { fbp = NULL; @@ -1135,7 +1135,7 @@ xfs_dir2_leafn_toosmall( * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ - forward = !INT_ISZERO(info->forw, ARCH_CONVERT); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &rval); @@ -1587,8 +1587,8 @@ xfs_dir2_node_addname_int( INT_SET(free->hdr.firstdb, ARCH_CONVERT, (fbno - XFS_DIR2_FREE_FIRSTDB(mp)) * XFS_DIR2_MAX_FREE_BESTS(mp)); - INT_ZERO(free->hdr.nvalid, ARCH_CONVERT); - INT_ZERO(free->hdr.nused, ARCH_CONVERT); + free->hdr.nvalid = 0; + free->hdr.nused = 0; } else { free = fbp->data; ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC); diff --git a/libxfs/xfs_dir2_sf.c b/libxfs/xfs_dir2_sf.c index ab55ac38a..6d3633344 100644 --- a/libxfs/xfs_dir2_sf.c +++ b/libxfs/xfs_dir2_sf.c @@ -61,6 +61,7 @@ xfs_dir2_block_sfsize( int isdotdot; /* entry is ".." */ xfs_mount_t *mp; /* mount structure pointer */ int namelen; /* total name bytes */ + int inode_size; /* inode number bytes */ xfs_ino_t parent; /* parent inode number */ int size=0; /* total computed size */ @@ -68,7 +69,7 @@ xfs_dir2_block_sfsize( count = i8count = namelen = 0; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Iterate over the block's data entries by using the leaf pointers. @@ -102,13 +103,10 @@ xfs_dir2_block_sfsize( /* * Calculate the new size, see if we should give up yet. */ - size = XFS_DIR2_SF_HDR_SIZE(i8count) + /* header */ - count + /* namelen */ - count * (uint)sizeof(xfs_dir2_sf_off_t) + /* offset */ - namelen + /* name */ - (i8count ? /* inumber */ - (uint)sizeof(xfs_dir2_ino8_t) * count : - (uint)sizeof(xfs_dir2_ino4_t) * count); + inode_size = i8count ? sizeof(xfs_dir2_ino8_t) : + sizeof(xfs_dir2_ino4_t); + size = XFS_DIR2_SF_HDR_SIZE(i8count) + namelen + + count * (sizeof(xfs_dir2_sf_off_t) + 1 + inode_size); if (size > XFS_IFORK_DSIZE(dp)) return size; /* size value is a failure */ } @@ -117,7 +115,7 @@ xfs_dir2_block_sfsize( */ sfhp->count = count; sfhp->i8count = i8count; - XFS_DIR2_SF_PUT_INUMBER_ARCH((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent); return size; } @@ -184,7 +182,7 @@ xfs_dir2_block_to_sf( */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); ptr = (char *)block->u; - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); sfep = XFS_DIR2_SF_FIRSTENTRY(sfp); /* * Loop over the active and unused entries. @@ -211,19 +209,19 @@ xfs_dir2_block_to_sf( else if (dep->namelen == 2 && dep->name[0] == '.' && dep->name[1] == '.') ASSERT(INT_GET(dep->inumber, ARCH_CONVERT) == - XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT)); + XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent)); /* * Normal entry, copy it into shortform. */ else { sfep->namelen = dep->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, + XFS_DIR2_SF_PUT_OFFSET(sfep, (xfs_dir2_data_aoff_t) - ((char *)dep - (char *)block), ARCH_CONVERT); + ((char *)dep - (char *)block)); memcpy(sfep->name, dep->name, dep->namelen); temp=INT_GET(dep->inumber, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &temp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &temp, + XFS_DIR2_SF_INUMBERP(sfep)); sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); } ptr += XFS_DIR2_DATA_ENTSIZE(dep->namelen); @@ -381,10 +379,10 @@ xfs_dir2_sf_addname_easy( * Fill in the new entry. */ sfep->namelen = args->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(sfep, offset); memcpy(sfep->name, args->name, sfep->namelen); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); /* * Update the header and inode. */ @@ -448,7 +446,7 @@ xfs_dir2_sf_addname_hard( offset = new_offset + XFS_DIR2_DATA_ENTSIZE(oldsfep->namelen), oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep), eof = (char *)oldsfep == &buf[old_isize]) { - new_offset = XFS_DIR2_SF_GET_OFFSET_ARCH(oldsfep, ARCH_CONVERT); + new_offset = XFS_DIR2_SF_GET_OFFSET(oldsfep); if (offset + add_datasize <= new_offset) break; } @@ -473,10 +471,10 @@ xfs_dir2_sf_addname_hard( * Fill in the new entry, and update the header counts. */ sfep->namelen = args->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(sfep, offset); memcpy(sfep->name, args->name, sfep->namelen); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); sfp->hdr.count++; #if XFS_BIG_INUMS if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange) @@ -533,8 +531,8 @@ xfs_dir2_sf_addname_pick( */ for (i = 0; i < sfp->hdr.count; i++) { if (!holefit) - holefit = offset + size <= XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT); - offset = XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + holefit = offset + size <= XFS_DIR2_SF_GET_OFFSET(sfep); + offset = XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(sfep->namelen); sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep); } @@ -595,17 +593,17 @@ xfs_dir2_sf_check( sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data; offset = XFS_DIR2_DATA_FIRST_OFFSET; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); i8count = ino > XFS_DIR2_MAX_SHORT_INUM; for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp); i < sfp->hdr.count; i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { - ASSERT(XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) >= offset); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ASSERT(XFS_DIR2_SF_GET_OFFSET(sfep) >= offset); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep)); i8count += ino > XFS_DIR2_MAX_SHORT_INUM; offset = - XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(sfep->namelen); } ASSERT(i8count == sfp->hdr.i8count); @@ -662,7 +660,7 @@ xfs_dir2_sf_create( /* * Now can put in the inode number, since i8count is set. */ - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &pino, &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &pino, &sfp->hdr.parent); sfp->hdr.count = 0; dp->i_d.di_size = size; xfs_dir2_sf_check(args); @@ -711,7 +709,7 @@ xfs_dir2_sf_lookup( */ if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { - args->inumber = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + args->inumber = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); return XFS_ERROR(EEXIST); } /* @@ -724,8 +722,8 @@ xfs_dir2_sf_lookup( sfep->name[0] == args->name[0] && memcmp(args->name, sfep->name, args->namelen) == 0) { args->inumber = - XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)); return XFS_ERROR(EEXIST); } } @@ -778,8 +776,8 @@ xfs_dir2_sf_removename( if (sfep->namelen == args->namelen && sfep->name[0] == args->name[0] && memcmp(sfep->name, args->name, args->namelen) == 0) { - ASSERT(XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT) == + ASSERT(XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)) == args->inumber); break; } @@ -900,10 +898,10 @@ xfs_dir2_sf_replace( if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { #if XFS_BIG_INUMS || defined(DEBUG) - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); ASSERT(args->inumber != ino); #endif - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, &sfp->hdr.parent); } /* * Normal entry, look for the name. @@ -916,12 +914,12 @@ xfs_dir2_sf_replace( sfep->name[0] == args->name[0] && memcmp(args->name, sfep->name, args->namelen) == 0) { #if XFS_BIG_INUMS || defined(DEBUG) - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)); ASSERT(args->inumber != ino); #endif - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, + XFS_DIR2_SF_INUMBERP(sfep)); break; } } @@ -1022,8 +1020,8 @@ xfs_dir2_sf_toino4( */ sfp->hdr.count = oldsfp->hdr.count; sfp->hdr.i8count = 0; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, &oldsfp->hdr.parent, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent); /* * Copy the entries field by field. */ @@ -1035,9 +1033,9 @@ xfs_dir2_sf_toino4( sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; memcpy(sfep->name, oldsfep->name, sfep->namelen); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, + XFS_DIR2_SF_INUMBERP(oldsfep)); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep)); } /* * Clean up the inode. @@ -1099,8 +1097,8 @@ xfs_dir2_sf_toino8( */ sfp->hdr.count = oldsfp->hdr.count; sfp->hdr.i8count = 1; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, &oldsfp->hdr.parent, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, &sfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent); /* * Copy the entries field by field. */ @@ -1112,9 +1110,9 @@ xfs_dir2_sf_toino8( sfep->namelen = oldsfep->namelen; sfep->offset = oldsfep->offset; memcpy(sfep->name, oldsfep->name, sfep->namelen); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, + XFS_DIR2_SF_INUMBERP(oldsfep)); + XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep)); } /* * Clean up the inode. diff --git a/libxfs/xfs_dir_leaf.c b/libxfs/xfs_dir_leaf.c index 41bb89712..94f6cf112 100644 --- a/libxfs/xfs_dir_leaf.c +++ b/libxfs/xfs_dir_leaf.c @@ -93,9 +93,9 @@ xfs_dir_shortform_create(xfs_da_args_t *args, xfs_ino_t parent) ASSERT(dp->i_df.if_bytes == 0); xfs_idata_realloc(dp, sizeof(*hdr), XFS_DATA_FORK); hdr = (xfs_dir_sf_hdr_t *)dp->i_df.if_u1.if_data; - XFS_DIR_SF_PUT_DIRINO_ARCH(&parent, &hdr->parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&parent, &hdr->parent); - INT_ZERO(hdr->count, ARCH_CONVERT); + hdr->count = 0; dp->i_d.di_size = sizeof(*hdr); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); return(0); @@ -141,7 +141,7 @@ xfs_dir_shortform_addname(xfs_da_args_t *args) sf = (xfs_dir_shortform_t *)dp->i_df.if_u1.if_data; sfe = (xfs_dir_sf_entry_t *)((char *)sf + offset); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sfe->inumber); sfe->namelen = args->namelen; memcpy(sfe->name, args->name, sfe->namelen); INT_MOD(sf->hdr.count, ARCH_CONVERT, +1); @@ -231,7 +231,7 @@ xfs_dir_shortform_lookup(xfs_da_args_t *args) sf = (xfs_dir_shortform_t *)dp->i_df.if_u1.if_data; if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { - XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf->hdr.parent, &args->inumber); return(XFS_ERROR(EEXIST)); } if (args->namelen == 1 && args->name[0] == '.') { @@ -243,7 +243,7 @@ xfs_dir_shortform_lookup(xfs_da_args_t *args) if (sfe->namelen == args->namelen && sfe->name[0] == args->name[0] && memcmp(args->name, sfe->name, args->namelen) == 0) { - XFS_DIR_SF_GET_DIRINO_ARCH(&sfe->inumber, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sfe->inumber, &args->inumber); return(XFS_ERROR(EEXIST)); } sfe = XFS_DIR_SF_NEXTENTRY(sfe); @@ -286,7 +286,7 @@ xfs_dir_shortform_to_leaf(xfs_da_args_t *iargs) memcpy(tmpbuffer, dp->i_df.if_u1.if_data, size); sf = (xfs_dir_shortform_t *)tmpbuffer; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, &inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf->hdr.parent, &inumber); xfs_idata_realloc(dp, -size, XFS_DATA_FORK); dp->i_d.di_size = 0; @@ -331,7 +331,7 @@ xfs_dir_shortform_to_leaf(xfs_da_args_t *iargs) args.namelen = sfe->namelen; args.hashval = xfs_da_hashname((char *)(sfe->name), sfe->namelen); - XFS_DIR_SF_GET_DIRINO_ARCH(&sfe->inumber, &args.inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sfe->inumber, &args.inumber); retval = xfs_dir_leaf_addname(&args); if (retval) goto out; @@ -371,7 +371,7 @@ xfs_dir_shortform_replace(xfs_da_args_t *args) if (args->namelen == 2 && args->name[0] == '.' && args->name[1] == '.') { /* XXX - replace assert? */ - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sf->hdr.parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sf->hdr.parent); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); return(0); } @@ -383,7 +383,7 @@ xfs_dir_shortform_replace(xfs_da_args_t *args) memcmp(args->name, sfe->name, args->namelen) == 0) { ASSERT(memcmp((char *)&args->inumber, (char *)&sfe->inumber, sizeof(xfs_ino_t))); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &sfe->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &sfe->inumber); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); return(0); } @@ -434,10 +434,10 @@ xfs_dir_leaf_to_shortform(xfs_da_args_t *iargs) if ((entry->namelen == 2) && (namest->name[0] == '.') && (namest->name[1] == '.')) { - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &parent, ARCH_CONVERT); - INT_ZERO(entry->nameidx, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &parent); + entry->nameidx = 0; } else if ((entry->namelen == 1) && (namest->name[0] == '.')) { - INT_ZERO(entry->nameidx, ARCH_CONVERT); + entry->nameidx = 0; } } retval = xfs_da_shrink_inode(iargs, 0, bp); @@ -460,13 +460,13 @@ 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_ISZERO(entry->nameidx, ARCH_CONVERT)) + if (!entry->nameidx) continue; namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); args.name = (char *)(namest->name); args.namelen = entry->namelen; args.hashval = INT_GET(entry->hashval, ARCH_CONVERT); - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &args.inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &args.inumber); xfs_dir_shortform_addname(&args); } @@ -560,7 +560,7 @@ xfs_dir_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_DIR_LEAF_MAGIC); INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount)); - if (INT_ISZERO(hdr->firstused, ARCH_CONVERT)) + if (!hdr->firstused) INT_SET(hdr->firstused, ARCH_CONVERT, XFS_LBSIZE(dp->i_mount) - 1); INT_SET(hdr->freemap[0].base, ARCH_CONVERT, sizeof(xfs_dir_leaf_hdr_t)); INT_SET(hdr->freemap[0].size, ARCH_CONVERT, INT_GET(hdr->firstused, ARCH_CONVERT) - INT_GET(hdr->freemap[0].base, ARCH_CONVERT)); @@ -654,7 +654,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_ISZERO(map->size, ARCH_CONVERT)) + if (!map->size) continue; /* no space in this map */ tmp = entsize; if (INT_GET(map->base, ARCH_CONVERT) < INT_GET(hdr->firstused, ARCH_CONVERT)) @@ -754,7 +754,7 @@ xfs_dir_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int index, * Copy the string and inode number into the new space. */ namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - XFS_DIR_SF_PUT_DIRINO_ARCH(&args->inumber, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&args->inumber, &namest->inumber); memcpy(namest->name, args->name, args->namelen); xfs_da_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, namest, XFS_DIR_LEAF_ENTSIZE_BYENTRY(entry))); @@ -819,10 +819,10 @@ 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_ISZERO(hdr_d->firstused, ARCH_CONVERT)) + if (!hdr_d->firstused) INT_SET(hdr_d->firstused, ARCH_CONVERT, lbsize - 1); - INT_ZERO(hdr_d->namebytes, ARCH_CONVERT); - INT_ZERO(hdr_d->count, ARCH_CONVERT); + hdr_d->namebytes = 0; + hdr_d->count = 0; hdr_d->holes = 0; INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, sizeof(xfs_dir_leaf_hdr_t)); 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)); @@ -1125,7 +1125,7 @@ xfs_dir_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_ISZERO(info->forw, ARCH_CONVERT); + forward = info->forw; memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da_path_shift(state, &state->altpath, forward, 0, &retval); @@ -1274,8 +1274,8 @@ xfs_dir_leaf_remove(xfs_trans_t *trans, xfs_dabuf_t *bp, int index) map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, entsize); INT_MOD(map->size, ARCH_CONVERT, INT_GET(hdr->freemap[after].size, ARCH_CONVERT)); - INT_ZERO(hdr->freemap[after].base, ARCH_CONVERT); - INT_ZERO(hdr->freemap[after].size, ARCH_CONVERT); + hdr->freemap[after].base = 0; + hdr->freemap[after].size = 0; } else if (before >= 0) { map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, entsize); @@ -1335,7 +1335,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_ISZERO(hdr->firstused, ARCH_CONVERT)) + if (!hdr->firstused) INT_SET(hdr->firstused, ARCH_CONVERT, tmp - 1); } else { hdr->holes = 1; /* mark as needing compaction */ @@ -1415,11 +1415,11 @@ xfs_dir_leaf_unbalance(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, tmp_leaf = (xfs_dir_leafblock_t *)tmpbuffer; tmp_hdr = &tmp_leaf->hdr; tmp_hdr->info = save_hdr->info; /* struct copy */ - INT_ZERO(tmp_hdr->count, ARCH_CONVERT); + tmp_hdr->count = 0; INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize); - if (INT_ISZERO(tmp_hdr->firstused, ARCH_CONVERT)) + if (!tmp_hdr->firstused) INT_SET(tmp_hdr->firstused, ARCH_CONVERT, state->blocksize - 1); - INT_ZERO(tmp_hdr->namebytes, ARCH_CONVERT); + tmp_hdr->namebytes = 0; if (xfs_dir_leaf_order(save_blk->bp, drop_blk->bp)) { xfs_dir_leaf_moveents(drop_leaf, 0, tmp_leaf, 0, (int)INT_GET(drop_hdr->count, ARCH_CONVERT), mp); @@ -1491,7 +1491,7 @@ xfs_dir_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args, int *index) break; } ASSERT((probe >= 0) && \ - ((INT_ISZERO(leaf->hdr.count, ARCH_CONVERT)) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT)))); + ((!leaf->hdr.count) || (probe < INT_GET(leaf->hdr.count, ARCH_CONVERT)))); ASSERT((span <= 4) || (INT_GET(entry->hashval, ARCH_CONVERT) == hashval)); /* @@ -1520,7 +1520,7 @@ xfs_dir_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args, int *index) if (entry->namelen == args->namelen && namest->name[0] == args->name[0] && memcmp(args->name, namest->name, args->namelen) == 0) { - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &args->inumber, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &args->inumber); *index = probe; return(XFS_ERROR(EEXIST)); } @@ -1645,8 +1645,8 @@ xfs_dir_leaf_moveents(xfs_dir_leafblock_t *leaf_s, int start_s, INT_SET(hdr_d->freemap[0].base, ARCH_CONVERT, (uint)sizeof(xfs_dir_leaf_hdr_t)); INT_MOD(hdr_d->freemap[0].base, ARCH_CONVERT, INT_GET(hdr_d->count, ARCH_CONVERT) * (uint)sizeof(xfs_dir_leaf_entry_t)); 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, INT_ZERO(hdr_d->freemap[2].base, ARCH_CONVERT)); - INT_SET(hdr_d->freemap[1].size, ARCH_CONVERT, INT_ZERO(hdr_d->freemap[2].size, ARCH_CONVERT)); + INT_SET(hdr_d->freemap[1].base, ARCH_CONVERT, (hdr_d->freemap[2].base = 0)); + INT_SET(hdr_d->freemap[1].size, ARCH_CONVERT, (hdr_d->freemap[2].size = 0)); hdr_s->holes = 1; /* leaf may not be compact */ } @@ -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_ISZERO(leaf->hdr.count, ARCH_CONVERT)) + if (!leaf->hdr.count) return(0); return(INT_GET(leaf->entries[ INT_GET(leaf->hdr.count, ARCH_CONVERT)-1 ].hashval, ARCH_CONVERT)); } diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c index 62978f1e2..4671bcc36 100644 --- a/libxfs/xfs_ialloc.c +++ b/libxfs/xfs_ialloc.c @@ -118,6 +118,7 @@ xfs_ialloc_ag_alloc( int blks_per_cluster; /* fs blocks per inode cluster */ xfs_btree_cur_t *cur; /* inode btree cursor */ xfs_daddr_t d; /* disk addr of buffer */ + xfs_agnumber_t agno; int error; xfs_buf_t *fbuf; /* new free inodes' buffer */ xfs_dinode_t *free; /* new free inode structure */ @@ -273,15 +274,16 @@ xfs_ialloc_ag_alloc( } INT_MOD(agi->agi_count, ARCH_CONVERT, newlen); INT_MOD(agi->agi_freecount, ARCH_CONVERT, newlen); + agno = INT_GET(agi->agi_seqno, ARCH_CONVERT); down_read(&args.mp->m_peraglock); - args.mp->m_perag[INT_GET(agi->agi_seqno, ARCH_CONVERT)].pagi_freecount += newlen; + args.mp->m_perag[agno].pagi_count += newlen; + args.mp->m_perag[agno].pagi_freecount += newlen; up_read(&args.mp->m_peraglock); INT_SET(agi->agi_newino, ARCH_CONVERT, newino); /* * Insert records describing the new inode chunk into the btree. */ - cur = xfs_btree_init_cursor(args.mp, tp, agbp, - INT_GET(agi->agi_seqno, ARCH_CONVERT), + cur = xfs_btree_init_cursor(args.mp, tp, agbp, agno, XFS_BTNUM_INO, (xfs_inode_t *)0, 0); for (thisino = newino; thisino < newino + newlen; @@ -557,7 +559,7 @@ xfs_dialloc( * allocation groups upward, wrapping at the end. */ *alloc_done = B_FALSE; - while (INT_ISZERO(agi->agi_freecount, ARCH_CONVERT)) { + while (!agi->agi_freecount) { /* * Don't do anything if we're not supposed to allocate * any blocks, just go on to the next ag. @@ -639,7 +641,7 @@ nextag: XFS_WANT_CORRUPTED_GOTO(i == 1, error0); do { if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_freecount, &rec.ir_free, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; @@ -659,7 +661,7 @@ nextag: goto error0; if (i != 0 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &j, ARCH_NOCONVERT)) == 0 && + &rec.ir_freecount, &rec.ir_free, &j)) == 0 && j == 1 && rec.ir_freecount > 0) { /* @@ -694,7 +696,7 @@ nextag: if ((error = xfs_inobt_get_rec(tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT))) + &trec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } @@ -708,7 +710,7 @@ nextag: if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); } @@ -772,7 +774,7 @@ nextag: tcur, &trec.ir_startino, &trec.ir_freecount, - &trec.ir_free, &i, ARCH_NOCONVERT))) + &trec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -792,7 +794,7 @@ nextag: cur, &rec.ir_startino, &rec.ir_freecount, - &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_free, &i))) goto error1; XFS_WANT_CORRUPTED_GOTO(i == 1, error1); @@ -812,7 +814,7 @@ nextag: goto error0; if (i == 1 && (error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &j, ARCH_NOCONVERT)) == 0 && + &rec.ir_freecount, &rec.ir_free, &j)) == 0 && j == 1 && rec.ir_freecount > 0) { /* @@ -833,7 +835,7 @@ nextag: if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, &rec.ir_freecount, &rec.ir_free, - &i, ARCH_NOCONVERT))) + &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); if (rec.ir_freecount > 0) @@ -868,7 +870,7 @@ nextag: goto error0; do { if ((error = xfs_inobt_get_rec(cur, &rec.ir_startino, - &rec.ir_freecount, &rec.ir_free, &i, ARCH_NOCONVERT))) + &rec.ir_freecount, &rec.ir_free, &i))) goto error0; XFS_WANT_CORRUPTED_GOTO(i == 1, error0); freecount += rec.ir_freecount; @@ -999,7 +1001,7 @@ xfs_dilocate( goto error0; } if ((error = xfs_inobt_get_rec(cur, &chunk_agino, &chunk_cnt, - &chunk_free, &i, ARCH_NOCONVERT))) { + &chunk_free, &i))) { #ifdef DEBUG xfs_fs_cmn_err(CE_ALERT, mp, "xfs_dilocate: " "xfs_inobt_get_rec() failed"); @@ -1143,6 +1145,7 @@ xfs_ialloc_read_agi( pag = &mp->m_perag[agno]; if (!pag->pagi_init) { pag->pagi_freecount = INT_GET(agi->agi_freecount, ARCH_CONVERT); + pag->pagi_count = INT_GET(agi->agi_count, ARCH_CONVERT); pag->pagi_init = 1; } else { /* @@ -1159,7 +1162,7 @@ xfs_ialloc_read_agi( int i; for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) - ASSERT(!INT_ISZERO(agi->agi_unlinked[i], ARCH_CONVERT)); + ASSERT(agi->agi_unlinked[i]); } #endif diff --git a/libxfs/xfs_ialloc_btree.c b/libxfs/xfs_ialloc_btree.c index 9f90be409..249c199f3 100644 --- a/libxfs/xfs_ialloc_btree.c +++ b/libxfs/xfs_ialloc_btree.c @@ -1258,8 +1258,7 @@ xfs_inobt_get_rec( xfs_agino_t *ino, /* output: starting inode of chunk */ __int32_t *fcnt, /* output: number of free inodes */ xfs_inofree_t *free, /* output: free inode mask */ - int *stat, /* output: success/failure */ - xfs_arch_t arch) /* input: architecture */ + int *stat) /* output: success/failure */ { xfs_inobt_block_t *block; /* btree block */ xfs_buf_t *bp; /* buffer containing btree block */ @@ -1287,16 +1286,9 @@ xfs_inobt_get_rec( * Point to the record and extract its data. */ rec = XFS_INOBT_REC_ADDR(block, ptr, cur); - ASSERT(arch == ARCH_NOCONVERT || arch == ARCH_CONVERT); - if (arch == ARCH_NOCONVERT) { - *ino = INT_GET(rec->ir_startino, ARCH_CONVERT); - *fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT); - *free = INT_GET(rec->ir_free, ARCH_CONVERT); - } else { - INT_COPY(*ino, rec->ir_startino, ARCH_CONVERT); - INT_COPY(*fcnt, rec->ir_freecount, ARCH_CONVERT); - INT_COPY(*free, rec->ir_free, ARCH_CONVERT); - } + *ino = INT_GET(rec->ir_startino, ARCH_CONVERT); + *fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT); + *free = INT_GET(rec->ir_free, ARCH_CONVERT); *stat = 1; return 0; } diff --git a/libxfs/xfs_inode.c b/libxfs/xfs_inode.c index bf9e4c9c9..bf1e8cdae 100644 --- a/libxfs/xfs_inode.c +++ b/libxfs/xfs_inode.c @@ -50,11 +50,11 @@ xfs_inobp_check( for (i = 0; i < j; i++) { dip = (xfs_dinode_t *)xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize); - if (INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)) { + if (!dip->di_next_unlinked) { xfs_fs_cmn_err(CE_ALERT, mp, "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.", bp); - ASSERT(!INT_ISZERO(dip->di_next_unlinked, ARCH_CONVERT)); + ASSERT(dip->di_next_unlinked); } } } @@ -297,8 +297,7 @@ xfs_iformat( } di_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); - if (unlikely(di_size > - XFS_DFORK_DSIZE_ARCH(dip, ip->i_mount, ARCH_CONVERT))) { + if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (bad size %Ld for local inode). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, @@ -332,7 +331,7 @@ xfs_iformat( if (error) { return error; } - if (!XFS_DFORK_Q_ARCH(dip, ARCH_CONVERT)) + if (!XFS_DFORK_Q(dip)) return 0; ASSERT(ip->i_afp == NULL); ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); @@ -340,7 +339,7 @@ xfs_iformat( XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); switch (INT_GET(dip->di_core.di_aformat, ARCH_CONVERT)) { case XFS_DINODE_FMT_LOCAL: - atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); size = (int)INT_GET(atp->hdr.totsize, ARCH_CONVERT); error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); break; @@ -387,11 +386,11 @@ xfs_iformat_local( * is wrong and we just bail out rather than crash in * kmem_alloc() or memcpy() below. */ - if (unlikely(size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT))) { + if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (bad size %d for local fork, size = %d). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, size, - XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT)); + XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW, ip->i_mount, dip); return XFS_ERROR(EFSCORRUPTED); @@ -409,8 +408,7 @@ xfs_iformat_local( ifp->if_bytes = size; ifp->if_real_bytes = real_size; if (size) - memcpy(ifp->if_u1.if_data, - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT), size); + memcpy(ifp->if_u1.if_data, XFS_DFORK_PTR(dip, whichfork), size); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFINLINE; return 0; @@ -439,7 +437,7 @@ xfs_iformat_extents( int i; ifp = XFS_IFORK_PTR(ip, whichfork); - nex = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); + nex = XFS_DFORK_NEXTENTS(dip, whichfork); size = nex * (uint)sizeof(xfs_bmbt_rec_t); /* @@ -447,7 +445,7 @@ xfs_iformat_extents( * is wrong and we just bail out rather than crash in * kmem_alloc() or memcpy() below. */ - if (unlikely(size < 0 || size > XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT))) { + if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu ((a)extents = %d). Unmount and run xfs_repair.", (unsigned long long) ip->i_ino, nex); @@ -469,8 +467,7 @@ xfs_iformat_extents( ifp->if_bytes = size; ifp->if_real_bytes = real_size; if (size) { - dp = (xfs_bmbt_rec_t *) - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork); xfs_validate_extents(dp, nex, 1, XFS_EXTFMT_INODE(ip)); ep = ifp->if_u1.if_extents; for (i = 0; i < nex; i++, ep++, dp++) { @@ -516,7 +513,7 @@ xfs_iformat_btree( int size; ifp = XFS_IFORK_PTR(ip, whichfork); - dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); size = XFS_BMAP_BROOT_SPACE(dfp); nrecs = XFS_BMAP_BROOT_NUMRECS(dfp); @@ -529,7 +526,7 @@ xfs_iformat_btree( */ if (unlikely(XFS_IFORK_NEXTENTS(ip, whichfork) <= ifp->if_ext_max || XFS_BMDR_SPACE_CALC(nrecs) > - XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT) + XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { xfs_fs_cmn_err(CE_WARN, ip->i_mount, "corrupt inode %Lu (btree). Unmount and run xfs_repair.", @@ -546,7 +543,7 @@ xfs_iformat_btree( * Copy and convert from the on-disk structure * to the in-memory structure. */ - xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE_ARCH(dip, ip->i_mount, whichfork, ARCH_CONVERT), + xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), ifp->if_broot, size); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFBROOT; @@ -568,23 +565,13 @@ void xfs_xlate_dinode_core( xfs_caddr_t buf, xfs_dinode_core_t *dip, - int dir, - xfs_arch_t arch) + int dir) { xfs_dinode_core_t *buf_core = (xfs_dinode_core_t *)buf; xfs_dinode_core_t *mem_core = (xfs_dinode_core_t *)dip; + xfs_arch_t arch = ARCH_CONVERT; ASSERT(dir); - if (arch == ARCH_NOCONVERT) { - if (dir > 0) { - memcpy((xfs_caddr_t)mem_core, (xfs_caddr_t)buf_core, - sizeof(xfs_dinode_core_t)); - } else { - memcpy((xfs_caddr_t)buf_core, (xfs_caddr_t)mem_core, - sizeof(xfs_dinode_core_t)); - } - return; - } INT_XLATE(buf_core->di_magic, mem_core->di_magic, dir, arch); INT_XLATE(buf_core->di_mode, mem_core->di_mode, dir, arch); @@ -716,9 +703,9 @@ xfs_iread( * specific information. * Otherwise, just get the truly permanent information. */ - if (!INT_ISZERO(dip->di_core.di_mode, ARCH_CONVERT)) { + if (dip->di_core.di_mode) { xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, - &(ip->i_d), 1, ARCH_CONVERT); + &(ip->i_d), 1); error = xfs_iformat(ip, dip); if (error) { kmem_zone_free(xfs_inode_zone, ip); @@ -1368,7 +1355,7 @@ xfs_iflush_fork( ASSERT(whichfork == XFS_ATTR_FORK); return 0; } - cp = XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + cp = XFS_DFORK_PTR(dip, whichfork); mp = ip->i_mount; switch (XFS_IFORK_FORMAT(ip, whichfork)) { case XFS_DINODE_FMT_LOCAL: @@ -1409,7 +1396,7 @@ xfs_iflush_fork( XFS_BROOT_SIZE_ADJ)); xfs_bmbt_to_bmdr(ifp->if_broot, ifp->if_broot_bytes, (xfs_bmdr_block_t *)cp, - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT)); + XFS_DFORK_SIZE(dip, mp, whichfork)); } break; diff --git a/libxfs/xfs_mount.c b/libxfs/xfs_mount.c index 89eea4e65..5ed565bcb 100644 --- a/libxfs/xfs_mount.c +++ b/libxfs/xfs_mount.c @@ -170,7 +170,6 @@ xfs_xlatesb( void *data, xfs_sb_t *sb, int dir, - xfs_arch_t arch, __int64_t fields) { xfs_caddr_t buf_ptr; @@ -195,9 +194,7 @@ xfs_xlatesb( ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1); - if (arch == ARCH_NOCONVERT || - size == 1 || - xfs_sb_info[f].type == 1) { + if (size == 1 || xfs_sb_info[f].type == 1) { if (dir > 0) { memcpy(mem_ptr + first, buf_ptr + first, size); } else { @@ -208,16 +205,16 @@ xfs_xlatesb( case 2: INT_XLATE(*(__uint16_t*)(buf_ptr+first), *(__uint16_t*)(mem_ptr+first), - dir, arch); + dir, ARCH_CONVERT); break; case 4: INT_XLATE(*(__uint32_t*)(buf_ptr+first), *(__uint32_t*)(mem_ptr+first), - dir, arch); + dir, ARCH_CONVERT); break; case 8: INT_XLATE(*(__uint64_t*)(buf_ptr+first), - *(__uint64_t*)(mem_ptr+first), dir, arch); + *(__uint64_t*)(mem_ptr+first), dir, ARCH_CONVERT); break; default: ASSERT(0); diff --git a/libxfs/xfs_rtalloc.c b/libxfs/xfs_rtalloc.c index 200d859ea..47056c768 100644 --- a/libxfs/xfs_rtalloc.c +++ b/libxfs/xfs_rtalloc.c @@ -745,7 +745,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; } diff --git a/libxlog/util.c b/libxlog/util.c index b2b574164..470c2ac2a 100644 --- a/libxlog/util.c +++ b/libxlog/util.c @@ -62,10 +62,10 @@ xlog_header_check_recover(xfs_mount_t *mp, xlog_rec_header_t *head) { if (print_record_header) printf(_("\nLOG REC AT LSN cycle %d block %d (0x%x, 0x%x)\n"), - CYCLE_LSN(head->h_lsn, ARCH_CONVERT), - BLOCK_LSN(head->h_lsn, ARCH_CONVERT), - CYCLE_LSN(head->h_lsn, ARCH_CONVERT), - BLOCK_LSN(head->h_lsn, ARCH_CONVERT)); + CYCLE_LSN(INT_GET(head->h_lsn, ARCH_CONVERT)), + BLOCK_LSN(INT_GET(head->h_lsn, ARCH_CONVERT)), + CYCLE_LSN(INT_GET(head->h_lsn, ARCH_CONVERT)), + BLOCK_LSN(INT_GET(head->h_lsn, ARCH_CONVERT))); if (INT_GET(head->h_magicno, ARCH_CONVERT) != XLOG_HEADER_MAGIC_NUM) { diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c index 18bd478e2..774346e41 100644 --- a/libxlog/xfs_log_recover.c +++ b/libxlog/xfs_log_recover.c @@ -605,7 +605,7 @@ xlog_find_tail( /* find blk_no of tail of log */ rhead = (xlog_rec_header_t *)offset; - *tail_blk = BLOCK_LSN(rhead->h_tail_lsn, ARCH_CONVERT); + *tail_blk = BLOCK_LSN(INT_GET(rhead->h_tail_lsn, ARCH_CONVERT)); /* * Reset log values according to the state of the log when we @@ -672,11 +672,19 @@ xlog_find_tail( * log records will point recovery to after the * current unmount record. */ - ASSIGN_ANY_LSN(log->l_tail_lsn, log->l_curr_cycle, - after_umount_blk, ARCH_NOCONVERT); - ASSIGN_ANY_LSN(log->l_last_sync_lsn, log->l_curr_cycle, - after_umount_blk, ARCH_NOCONVERT); + ASSIGN_ANY_LSN_HOST(log->l_tail_lsn, log->l_curr_cycle, + after_umount_blk); + ASSIGN_ANY_LSN_HOST(log->l_last_sync_lsn, log->l_curr_cycle, + after_umount_blk); *tail_blk = after_umount_blk; + + /* + * Note that the unmount was clean. If the unmount + * was not clean, we need to know this to rebuild the + * superblock counters from the perag headers if we + * have a filesystem using non-persistent counters. + */ + log->l_mp->m_flags |= XFS_MOUNT_WAS_CLEAN; } } @@ -1203,7 +1211,7 @@ xlog_valid_rec_header( return XFS_ERROR(EFSCORRUPTED); } if (unlikely( - (INT_ISZERO(rhead->h_version, ARCH_CONVERT) || + (!rhead->h_version || (INT_GET(rhead->h_version, ARCH_CONVERT) & (~XLOG_VERSION_OKBITS)) != 0))) { xlog_warn("XFS: %s: unrecognised log version (%d).", diff --git a/logprint/log_dump.c b/logprint/log_dump.c index cd48b2581..2da6d4c54 100644 --- a/logprint/log_dump.c +++ b/logprint/log_dump.c @@ -64,14 +64,14 @@ xfs_log_dump( break; } - if (CYCLE_LSN(buf, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM && - !print_no_data) { + if (CYCLE_LSN(INT_GET(*(xfs_lsn_t *)buf, ARCH_CONVERT)) == + XLOG_HEADER_MAGIC_NUM && !print_no_data) { printf( "%6lld HEADER Cycle %d tail %d:%06d len %6d ops %d\n", (long long)blkno, INT_GET(hdr->h_cycle, ARCH_CONVERT), - CYCLE_LSN(hdr->h_tail_lsn, ARCH_CONVERT), - BLOCK_LSN(hdr->h_tail_lsn, ARCH_CONVERT), + CYCLE_LSN(INT_GET(hdr->h_tail_lsn, ARCH_CONVERT)), + BLOCK_LSN(INT_GET(hdr->h_tail_lsn, ARCH_CONVERT)), INT_GET(hdr->h_len, ARCH_CONVERT), INT_GET(hdr->h_num_logops, ARCH_CONVERT)); } diff --git a/logprint/log_misc.c b/logprint/log_misc.c index 395a7f85f..22436fb65 100644 --- a/logprint/log_misc.c +++ b/logprint/log_misc.c @@ -82,6 +82,7 @@ char *trans_type[] = { "GROWFSRT_ZERO", "GROWFSRT_FREE", "SWAPEXT", + "SB_COUNT", }; typedef struct xlog_split_item { @@ -882,7 +883,7 @@ print_lsn(xfs_caddr_t string, xfs_arch_t arch) { printf("%s: %u,%u", string, - CYCLE_LSN(*lsn, arch), BLOCK_LSN(*lsn, arch)); + CYCLE_LSN(INT_GET(*lsn, arch)), BLOCK_LSN(INT_GET(*lsn, arch))); } @@ -927,8 +928,9 @@ xlog_print_record(int fd, } /* Did we overflow the end? */ if (*read_type == FULL_READ && - BLOCK_LSN(rhead->h_lsn, ARCH_CONVERT)+BTOBB(read_len) >= logBBsize) { - *read_type = BBTOB(logBBsize-BLOCK_LSN(rhead->h_lsn, ARCH_CONVERT)-1); + BLOCK_LSN(INT_GET(rhead->h_lsn, ARCH_CONVERT)) + BTOBB(read_len) >= + logBBsize) { + *read_type = BBTOB(logBBsize - BLOCK_LSN(INT_GET(rhead->h_lsn, ARCH_CONVERT))-1); *partial_buf = buf; return PARTIAL_READ; } @@ -946,7 +948,7 @@ xlog_print_record(int fd, * Unpack the data, by putting the saved cycle-data back * into the first word of each BB. * Do some checks. - */ + */ buf = ptr; for (i = 0; ptr < buf + read_len; ptr += BBSIZE, i++) { xlog_rec_header_t *rechead = (xlog_rec_header_t *)ptr; @@ -1094,7 +1096,7 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len) if (print_no_print) return INT_GET(head->h_num_logops, ARCH_CONVERT); - if (INT_ISZERO(head->h_magicno, ARCH_CONVERT)) + if (!head->h_magicno) return ZEROED_LOG; if (INT_GET(head->h_magicno, ARCH_CONVERT) != XLOG_HEADER_MAGIC_NUM) { @@ -1105,11 +1107,8 @@ xlog_print_rec_head(xlog_rec_header_t *head, int *len) } /* check for cleared blocks written by xlog_clear_stale_blocks() */ - if (INT_ISZERO(head->h_len, ARCH_CONVERT) && - INT_ISZERO(head->h_chksum, ARCH_CONVERT) && - INT_ISZERO(head->h_prev_block, ARCH_CONVERT) && - INT_ISZERO(head->h_num_logops, ARCH_CONVERT) && - INT_ISZERO(head->h_size, ARCH_CONVERT)) + if (!head->h_len && !head->h_chksum && !head->h_prev_block && + !head->h_num_logops && !head->h_size) return CLEARED_BLKS; datalen=INT_GET(head->h_len, ARCH_CONVERT); diff --git a/logprint/logprint.c b/logprint/logprint.c index e2cd26f0a..138f37e06 100644 --- a/logprint/logprint.c +++ b/logprint/logprint.c @@ -101,7 +101,7 @@ logstat(xfs_mount_t *mp) /* * Conjure up a mount structure */ - libxfs_xlate_sb(buf, &(mp->m_sb), 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(buf, &(mp->m_sb), 1, XFS_SB_ALL_BITS); sb = &(mp->m_sb); mp->m_blkbb_log = sb->sb_blocklog - BBSHIFT; diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index e248526e5..8d1765913 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1,32 +1,32 @@ /* * Copyright (c) 2000-2005 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 * published by the Free Software Foundation. - * + * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * + * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. - * + * * You should have received a copy of the GNU General Public License along * with this program; if not, write the Free Software Foundation, Inc., 59 * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * + * * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ */ @@ -1970,12 +1970,14 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), sbp->sb_versionnum = XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, extent_flagging, dirversion == 2, logversion == 2, - (sectorsize != BBSIZE || lsectorsize != BBSIZE), 0); - sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0); + (sectorsize != BBSIZE || lsectorsize != BBSIZE), + (0 /*mmr*/ || 0 /*lazy_sb_counters*/)); + sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0 /*mmr*/, 0); + /* - * Zero out the beginning of the device, to obliterate any old - * filesystem signatures out there. This should take care of - * swap (somewhere around the page size), jfs (32k), + * Zero out the beginning of the device, to obliterate any old + * filesystem signatures out there. This should take care of + * swap (somewhere around the page size), jfs (32k), * ext[2,3] and reiserfs (64k) - and hopefully all else. */ buf = libxfs_getbuf(xi.ddev, 0, BTOBB(WHACK_SIZE)); @@ -1985,8 +1987,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), /* OK, now write the superblock */ buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1)); bzero(XFS_BUF_PTR(buf), sectorsize); - libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, XFS_SB_ALL_BITS); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); /* @@ -2037,8 +2038,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), XFS_AG_DADDR(mp, agno, XFS_SB_DADDR), XFS_FSS_TO_BB(mp, 1)); bzero(XFS_BUF_PTR(buf), sectorsize); - libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, XFS_SB_ALL_BITS); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); /* diff --git a/repair/agheader.c b/repair/agheader.c index 2355fa936..07a4e1017 100644 --- a/repair/agheader.c +++ b/repair/agheader.c @@ -107,7 +107,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i) INT_GET(agf->agf_flfirst, ARCH_CONVERT), i, XFS_AGFL_SIZE(mp)); if (!no_modify) - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; } if (INT_GET(agf->agf_fllast, ARCH_CONVERT) >= XFS_AGFL_SIZE(mp)) { @@ -115,7 +115,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_t *agf, xfs_agnumber_t i) INT_GET(agf->agf_fllast, ARCH_CONVERT), i, XFS_AGFL_SIZE(mp)); if (!no_modify) - INT_ZERO(agf->agf_fllast, ARCH_CONVERT); + agf->agf_fllast = 0; } /* don't check freespace btrees -- will be checked by caller */ diff --git a/repair/attr_repair.c b/repair/attr_repair.c index d64129cfe..b55daba02 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -172,7 +172,7 @@ process_shortform_attr( *repair = 0; - asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR(dip); /* Assumption: hdr.totsize is less than a leaf block and was checked * by lclinode for valid sizes. Check the count though. @@ -987,11 +987,11 @@ process_attributes( xfs_attr_shortform_t *asf; dinoc = &dip->di_core; - asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR(dip); if (dinoc->di_aformat == XFS_DINODE_FMT_LOCAL) { ASSERT(INT_GET(asf->hdr.totsize, ARCH_CONVERT) <= - XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT)); + XFS_DFORK_ASIZE(dip, mp)); err = process_shortform_attr(ino, dip, repair); } else if (dinoc->di_aformat == XFS_DINODE_FMT_EXTENTS || dinoc->di_aformat == XFS_DINODE_FMT_BTREE) { diff --git a/repair/dinode.c b/repair/dinode.c index 2579a269c..6fc08b7be 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -107,7 +107,7 @@ clear_dinode_attr(xfs_mount_t *mp, xfs_dinode_t *dino, xfs_ino_t ino_num) if (INT_GET(dinoc->di_anextents, ARCH_CONVERT) != 0) { if (no_modify) return(1); - INT_ZERO(dinoc->di_anextents, ARCH_CONVERT); + dinoc->di_anextents = 0; } if (dinoc->di_aformat != XFS_DINODE_FMT_EXTENTS) { @@ -129,7 +129,7 @@ clear_dinode_attr(xfs_mount_t *mp, xfs_dinode_t *dino, xfs_ino_t ino_num) if (!no_modify) { xfs_attr_shortform_t *asf = (xfs_attr_shortform_t *) - XFS_DFORK_APTR_ARCH(dino, ARCH_CONVERT); + XFS_DFORK_APTR(dino); INT_SET(asf->hdr.totsize, ARCH_CONVERT, sizeof(xfs_attr_sf_hdr_t)); INT_SET(asf->hdr.count, ARCH_CONVERT, 0); @@ -174,7 +174,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_mode, ARCH_CONVERT); + dinoc->di_mode = 0; } if (INT_GET(dinoc->di_flags, ARCH_CONVERT) != 0) { @@ -183,7 +183,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_flags, ARCH_CONVERT); + dinoc->di_flags = 0; } if (INT_GET(dinoc->di_dmevmask, ARCH_CONVERT) != 0) { @@ -192,7 +192,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_dmevmask, ARCH_CONVERT); + dinoc->di_dmevmask = 0; } if (dinoc->di_forkoff != 0) { @@ -228,7 +228,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_size, ARCH_CONVERT); + dinoc->di_size = 0; } if (INT_GET(dinoc->di_nblocks, ARCH_CONVERT) != 0) { @@ -237,7 +237,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_nblocks, ARCH_CONVERT); + dinoc->di_nblocks = 0; } if (INT_GET(dinoc->di_onlink, ARCH_CONVERT) != 0) { @@ -246,7 +246,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_onlink, ARCH_CONVERT); + dinoc->di_onlink = 0; } if (INT_GET(dinoc->di_nextents, ARCH_CONVERT) != 0) { @@ -255,7 +255,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_nextents, ARCH_CONVERT); + dinoc->di_nextents = 0; } if (INT_GET(dinoc->di_anextents, ARCH_CONVERT) != 0) { @@ -264,7 +264,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_anextents, ARCH_CONVERT); + dinoc->di_anextents = 0; } if (dinoc->di_version > XFS_DINODE_VERSION_1 && @@ -274,7 +274,7 @@ clear_dinode_core(xfs_dinode_core_t *dinoc, xfs_ino_t ino_num) if (no_modify) return(1); - INT_ZERO(dinoc->di_nlink, ARCH_CONVERT); + dinoc->di_nlink = 0; } return(dirty); @@ -887,8 +887,8 @@ getfunc_extlist(xfs_mount_t *mp, xfs_dfsbno_t fsbno; xfs_dfsbno_t final_fsbno = NULLDFSBNO; xfs_bmbt_rec_32_t *rootblock = (xfs_bmbt_rec_32_t *) - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); - xfs_extnum_t nextents = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); + XFS_DFORK_PTR(dip, whichfork); + xfs_extnum_t nextents = XFS_DFORK_NEXTENTS(dip, whichfork); int i; int flag; @@ -927,7 +927,7 @@ getfunc_btree(xfs_mount_t *mp, xfs_dfsbno_t final_fsbno = NULLDFSBNO; xfs_bmbt_block_t *block; xfs_bmdr_block_t *rootblock = (xfs_bmdr_block_t *) - XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + XFS_DFORK_PTR(dip, whichfork); ASSERT(rootblock->bb_level != 0); /* @@ -937,16 +937,16 @@ getfunc_btree(xfs_mount_t *mp, * would be an extent list. */ rkey = XFS_BTREE_KEY_ADDR( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, rootblock, 1, - XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE_ARCH(dip, - mp, whichfork, ARCH_CONVERT), + XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE(dip, + mp, whichfork), xfs_bmdr, 1)); rp = XFS_BTREE_PTR_ADDR( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, rootblock, 1, - XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE_ARCH(dip, - mp, whichfork, ARCH_CONVERT), + XFS_BTREE_BLOCK_MAXRECS(XFS_DFORK_SIZE(dip, + mp, whichfork), xfs_bmdr, 1)); for (found = -1, i = 0; i < rootblock->bb_numrecs - 1; i++) { if (rkey[i].br_startoff <= bno @@ -1090,7 +1090,7 @@ get_bmapi(xfs_mount_t *mp, xfs_dinode_t *dino_p, { xfs_dfsbno_t fsbno; - switch (XFS_DFORK_FORMAT_ARCH(dino_p, whichfork, ARCH_CONVERT)) { + switch (XFS_DFORK_FORMAT(dino_p, whichfork)) { case XFS_DINODE_FMT_EXTENTS: fsbno = getfunc_extlist(mp, ino_num, dino_p, bno, whichfork); break; @@ -1146,7 +1146,7 @@ process_btinode( int i; bmap_cursor_t cursor; - dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); lino = XFS_AGINO_TO_INO(mp, agno, ino); *tot = 0; *nex = 0; @@ -1181,8 +1181,8 @@ process_btinode( if (XFS_BMDR_SPACE_CALC(INT_GET(dib->bb_numrecs, ARCH_CONVERT)) > ((whichfork == XFS_DATA_FORK) ? - XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT) : - XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT))) { + XFS_DFORK_DSIZE(dip, mp) : + XFS_DFORK_ASIZE(dip, mp))) { do_warn( _("indicated size of %s btree root (%d bytes) greater than space in " "inode %llu %s fork\n"), @@ -1193,16 +1193,16 @@ process_btinode( } pp = XFS_BTREE_PTR_ADDR( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, dib, 1, XFS_BTREE_BLOCK_MAXRECS( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, 0)); pkey = XFS_BTREE_KEY_ADDR( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, dib, 1, XFS_BTREE_BLOCK_MAXRECS( - XFS_DFORK_SIZE_ARCH(dip, mp, whichfork, ARCH_CONVERT), + XFS_DFORK_SIZE(dip, mp, whichfork), xfs_bmdr, 0)); last_key = NULLDFILOFF; @@ -1322,9 +1322,9 @@ process_exinode( xfs_dfiloff_t last_key; lino = XFS_AGINO_TO_INO(mp, agno, ino); - rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR_ARCH(dip, whichfork, ARCH_CONVERT); + rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR(dip, whichfork); *tot = 0; - *nex = XFS_DFORK_NEXTENTS_ARCH(dip, whichfork, ARCH_CONVERT); + *nex = XFS_DFORK_NEXTENTS(dip, whichfork); /* * XXX - if we were going to fix up the btree record, * we'd do it right here. For now, if there's a problem, @@ -1368,21 +1368,21 @@ process_lclinode( lino = XFS_AGINO_TO_INO(mp, agno, ino); if (whichfork == XFS_DATA_FORK && INT_GET(dic->di_size, ARCH_CONVERT) > - XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)) { + XFS_DFORK_DSIZE(dip, mp)) { do_warn( _("local inode %llu data fork is too large (size = %lld, max = %d)\n"), lino, INT_GET(dic->di_size, ARCH_CONVERT), - XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)); + XFS_DFORK_DSIZE(dip, mp)); return(1); } else if (whichfork == XFS_ATTR_FORK) { asf = (xfs_attr_shortform_t *) - XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT); + XFS_DFORK_APTR(dip); if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) > - XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT)) { + XFS_DFORK_ASIZE(dip, mp)) { do_warn( _("local inode %llu attr fork too large (size %d, max = %d)\n"), lino, INT_GET(asf->hdr.totsize, ARCH_CONVERT), - XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT)); + XFS_DFORK_ASIZE(dip, mp)); return(1); } if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) < @@ -1413,7 +1413,7 @@ process_symlink_extlist(xfs_mount_t *mp, xfs_ino_t lino, xfs_dinode_t *dino) int flag; if (INT_GET(dino->di_core.di_size, ARCH_CONVERT) <= - XFS_DFORK_SIZE_ARCH(dino, mp, whichfork, ARCH_CONVERT)) { + XFS_DFORK_SIZE(dino, mp, whichfork)) { if (dino->di_core.di_format == XFS_DINODE_FMT_LOCAL) { return(0); } else { @@ -1433,8 +1433,8 @@ process_symlink_extlist(xfs_mount_t *mp, xfs_ino_t lino, xfs_dinode_t *dino) return(1); } - rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR_ARCH(dino, whichfork, ARCH_CONVERT); - numrecs = XFS_DFORK_NEXTENTS_ARCH(dino, whichfork, ARCH_CONVERT); + rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR(dino, whichfork); + numrecs = XFS_DFORK_NEXTENTS(dino, whichfork); /* * the max # of extents in a symlink inode is equal to the @@ -1525,12 +1525,12 @@ process_symlink(xfs_mount_t *mp, xfs_ino_t lino, xfs_dinode_t *dino, */ symlink = &data[0]; if (INT_GET(dinoc->di_size, ARCH_CONVERT) - <= XFS_DFORK_DSIZE_ARCH(dino, mp, ARCH_CONVERT)) { + <= XFS_DFORK_DSIZE(dino, mp)) { /* * local symlink, just copy the symlink out of the * inode into the data area */ - bcopy((char *)XFS_DFORK_DPTR_ARCH(dino, ARCH_CONVERT), + bcopy((char *)XFS_DFORK_DPTR(dino), symlink, INT_GET(dinoc->di_size, ARCH_CONVERT)); } else { /* @@ -2078,7 +2078,7 @@ process_dinode_int(xfs_mount_t *mp, if (!no_modify) { do_warn(_("resetting to zero\n")); - INT_ZERO(dinoc->di_extsize, ARCH_CONVERT); + dinoc->di_extsize = 0; *dirty = 1; } else { do_warn(_("would reset to zero\n")); @@ -2154,7 +2154,7 @@ process_dinode_int(xfs_mount_t *mp, switch (type) { case XR_INO_DIR: if (INT_GET(dinoc->di_size, ARCH_CONVERT) <= - XFS_DFORK_DSIZE_ARCH(dino, mp, ARCH_CONVERT) && + XFS_DFORK_DSIZE(dino, mp) && (dinoc->di_format != XFS_DINODE_FMT_LOCAL)) { do_warn( _("mismatch between format (%d) and size (%lld) in directory ino %llu\n"), @@ -2441,7 +2441,7 @@ _("mismatch between format (%d) and size (%lld) in directory ino %llu\n"), * always stored in the regular filesystem. */ - if (!XFS_DFORK_Q_ARCH(dino, ARCH_CONVERT) && + if (!XFS_DFORK_Q(dino) && dinoc->di_aformat != XFS_DINODE_FMT_EXTENTS) { do_warn(_("bad attribute format %d in inode %llu, "), dinoc->di_aformat, lino); @@ -2452,7 +2452,7 @@ _("mismatch between format (%d) and size (%lld) in directory ino %llu\n"), } else do_warn(_("would reset value\n")); anextents = 0; - } else if (XFS_DFORK_Q_ARCH(dino, ARCH_CONVERT)) { + } else if (XFS_DFORK_Q(dino)) { switch (dinoc->di_aformat) { case XFS_DINODE_FMT_LOCAL: anextents = 0; @@ -2852,7 +2852,7 @@ _("mismatch between format (%d) and size (%lld) in directory ino %llu\n"), do_warn( _("clearing obsolete nlink field in version 2 inode %llu, was %d, now 0\n"), lino, INT_GET(dinoc->di_onlink, ARCH_CONVERT)); - INT_ZERO(dinoc->di_onlink, ARCH_CONVERT); + dinoc->di_onlink = 0; *dirty = 1; } else { do_warn( diff --git a/repair/dir.c b/repair/dir.c index 4ed7a3614..bf4e4db67 100644 --- a/repair/dir.c +++ b/repair/dir.c @@ -120,7 +120,7 @@ process_shortform_dir( sf = &dip->di_u.di_dirsf; - max_size = XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT); + max_size = XFS_DFORK_DSIZE(dip, mp); num_entries = INT_GET(sf->hdr.count, ARCH_CONVERT); ino_dir_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); *repair = 0; @@ -145,7 +145,7 @@ process_shortform_dir( sf_entry = next_sfe; junkit = 0; bad_sfnamelen = 0; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino); /* * if entry points to self, junk it since only '.' or '..' @@ -451,7 +451,7 @@ process_shortform_dir( /* * check parent (..) entry */ - XFS_DIR_SF_GET_DIRINO_ARCH(&sf->hdr.parent, parent, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf->hdr.parent, parent); /* * if parent entry is bogus, null it out. we'll fix it later . @@ -465,8 +465,7 @@ process_shortform_dir( if (!no_modify) { do_warn(_("clearing inode number\n")); - XFS_DIR_SF_PUT_DIRINO_ARCH(parent, - &sf->hdr.parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(parent, &sf->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -481,8 +480,7 @@ process_shortform_dir( _("corrected root directory %llu .. entry, was %llu, now %llu\n"), ino, *parent, ino); *parent = ino; - XFS_DIR_SF_PUT_DIRINO_ARCH(parent, - &sf->hdr.parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(parent, &sf->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -501,8 +499,7 @@ process_shortform_dir( if (!no_modify) { do_warn(_("clearing inode number\n")); - XFS_DIR_SF_PUT_DIRINO_ARCH(parent, - &sf->hdr.parent, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(parent, &sf->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -1514,7 +1511,7 @@ junk_zerolen_dir_leaf_entries( namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); tmp_ino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&tmp_ino, &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&tmp_ino, &namest->inumber); namest->name[0] = '/'; if (INT_GET(entry->nameidx, ARCH_CONVERT) < INT_GET(hdr->firstused, ARCH_CONVERT)) @@ -1583,8 +1580,8 @@ junk_zerolen_dir_leaf_entries( map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, sizeof(xfs_dir_leaf_entry_t)); INT_MOD(map->size, ARCH_CONVERT, INT_GET(hdr->freemap[after].size, ARCH_CONVERT)); - INT_ZERO(hdr->freemap[after].base, ARCH_CONVERT); - INT_ZERO(hdr->freemap[after].size, ARCH_CONVERT); + hdr->freemap[after].base = 0; + hdr->freemap[after].size = 0; } else if (before >= 0) { map = &hdr->freemap[before]; INT_MOD(map->size, ARCH_CONVERT, sizeof(xfs_dir_leaf_entry_t)); @@ -1668,8 +1665,8 @@ junk_zerolen_dir_leaf_entries( namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); tmp_ino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&tmp_ino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&tmp_ino, + &namest->inumber); namest->name[0] = '/'; bytes -= sizeof(xfs_dir_leaf_entry_t); @@ -1872,8 +1869,8 @@ _("nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, marking entry bad\n") INT_GET(entry->nameidx, ARCH_CONVERT)); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, + &namest->inumber); namest->name[0] = '/'; } } else { @@ -1893,7 +1890,7 @@ _("nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, would delete entry\n" */ namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &lino); /* * we may have to blow out an entry because of bad @@ -1922,8 +1919,7 @@ _("nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, would delete entry\n" _("\tclearing ino number in entry %d...\n"), i); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -1940,8 +1936,7 @@ _("entry #%d, bno %d in directory %llu references realtime bitmap inode %llu\n") i); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -1957,8 +1952,7 @@ _("entry #%d, bno %d in directory %llu references realtime summary inode %llu\n" _("\tclearing ino number in entry %d...\n"), i); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -1975,8 +1969,7 @@ _("entry #%d, bno %d in directory %llu references user quota inode %llu\n"), i); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -1993,8 +1986,7 @@ _("entry #%d, bno %d in directory %llu references group quota inode %llu\n"), i); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -2032,8 +2024,8 @@ _("entry #%d, bno %d in directory %llu references group quota inode %llu\n"), _("entry references free inode %llu in directory %llu, will clear entry\n"), lino, ino); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, + &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -2050,8 +2042,7 @@ _("entry references free inode %llu in directory %llu, would clear entry\n"), if (!no_modify) { do_warn(_("clearing inode number...\n")); lino = NULLFSINO; - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); *buf_dirty = 1; } else { do_warn(_("would clear inode number...\n")); @@ -2121,8 +2112,7 @@ _("entry references free inode %llu in directory %llu, would clear entry\n"), namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&lino, &namest->inumber); namest->name[0] = '/'; } } else if (INT_GET(entry->nameidx, ARCH_CONVERT) + @@ -2331,9 +2321,8 @@ _("name \"%s\" (block %u, slot %d) conflicts with used space in dir inode %llu\n do_warn( _("correcting .. entry in root inode %llu, was %llu\n"), ino, *parent); - XFS_DIR_SF_PUT_DIRINO_ARCH( - &ino, - &namest->inumber, ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO( + &ino, &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -2375,9 +2364,8 @@ _("multiple .. entries in directory inode %llu, would clear second entry\n"), do_warn( _(". in directory inode %llu has wrong value (%llu), fixing entry...\n"), ino, lino); - XFS_DIR_SF_PUT_DIRINO_ARCH(&ino, - &namest->inumber, - ARCH_CONVERT); + XFS_DIR_SF_PUT_DIRINO(&ino, + &namest->inumber); *buf_dirty = 1; } else { do_warn( @@ -2635,10 +2623,10 @@ _("- existing hole info for block %d, dir inode %llu (base, size) - \n"), ASSERT(INT_GET(new_leaf->hdr.freemap[0].base, ARCH_CONVERT) + INT_GET(new_leaf->hdr.freemap[0].size, ARCH_CONVERT) == first_used); - INT_ZERO(new_leaf->hdr.freemap[1].base, ARCH_CONVERT); - INT_ZERO(new_leaf->hdr.freemap[1].size, ARCH_CONVERT); - INT_ZERO(new_leaf->hdr.freemap[2].base, ARCH_CONVERT); - INT_ZERO(new_leaf->hdr.freemap[2].size, ARCH_CONVERT); + new_leaf->hdr.freemap[1].base = 0; + new_leaf->hdr.freemap[1].size = 0; + new_leaf->hdr.freemap[2].base = 0; + new_leaf->hdr.freemap[2].size = 0; /* * final step, copy block back @@ -3025,8 +3013,8 @@ process_leaf_dir( do_warn(_("clearing forw/back pointers for " "directory inode %llu\n"), ino); buf_dirty = 1; - INT_ZERO(leaf->hdr.info.forw, ARCH_CONVERT); - INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT); + leaf->hdr.info.forw = 0; + leaf->hdr.info.back = 0; } else { do_warn(_("would clear forw/back pointers for " "directory inode %llu\n"), ino); @@ -3073,7 +3061,7 @@ process_dir( * fix '.' and junk '..' if they're bogus. */ if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <= - XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)) { + XFS_DFORK_DSIZE(dip, mp)) { dot = 1; dotdot = 1; if (process_shortform_dir(mp, ino, dip, ino_discovery, diff --git a/repair/dir2.c b/repair/dir2.c index 8f878284c..3a537ac90 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -772,22 +772,19 @@ process_sf_dir2_fixi8( INT_SET(newsfp->hdr.count, ARCH_CONVERT, INT_GET(oldsfp->hdr.count, ARCH_CONVERT)); newsfp->hdr.i8count = 0; - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - &oldsfp->hdr.parent, ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(newsfp, &ino, - &newsfp->hdr.parent, ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent); + XFS_DIR2_SF_PUT_INUMBER(newsfp, &ino, &newsfp->hdr.parent); oldsfep = XFS_DIR2_SF_FIRSTENTRY(oldsfp); newsfep = XFS_DIR2_SF_FIRSTENTRY(newsfp); while ((int)((char *)oldsfep - (char *)oldsfp) < oldsize) { newsfep->namelen = oldsfep->namelen; - XFS_DIR2_SF_PUT_OFFSET_ARCH(newsfep, - XFS_DIR2_SF_GET_OFFSET_ARCH(oldsfep, ARCH_CONVERT), - ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(newsfep, + XFS_DIR2_SF_GET_OFFSET(oldsfep)); memmove(newsfep->name, oldsfep->name, newsfep->namelen); - ino = XFS_DIR2_SF_GET_INUMBER_ARCH(oldsfp, - XFS_DIR2_SF_INUMBERP(oldsfep), ARCH_CONVERT); - XFS_DIR2_SF_PUT_INUMBER_ARCH(newsfp, &ino, - XFS_DIR2_SF_INUMBERP(newsfep), ARCH_CONVERT); + ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, + XFS_DIR2_SF_INUMBERP(oldsfep)); + XFS_DIR2_SF_PUT_INUMBER(newsfp, &ino, + XFS_DIR2_SF_INUMBERP(newsfep)); oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep); newsfep = XFS_DIR2_SF_NEXTENTRY(newsfp, newsfep); } @@ -812,7 +809,7 @@ process_sf_dir2_fixoff( offset = XFS_DIR2_DATA_FIRST_OFFSET; i < INT_GET(sfp->hdr.count, ARCH_CONVERT); i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) { - XFS_DIR2_SF_PUT_OFFSET_ARCH(sfep, offset, ARCH_CONVERT); + XFS_DIR2_SF_PUT_OFFSET(sfep, offset); offset += XFS_DIR2_DATA_ENTSIZE(sfep->namelen); } } @@ -859,7 +856,7 @@ process_sf_dir2( xfs_ino_t zero = 0; sfp = &dip->di_u.di_dir2sf; - max_size = XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT); + max_size = XFS_DFORK_DSIZE(dip, mp); num_entries = INT_GET(sfp->hdr.count, ARCH_CONVERT); ino_dir_size = INT_GET(dip->di_core.di_size, ARCH_CONVERT); offset = XFS_DIR2_DATA_FIRST_OFFSET; @@ -870,7 +867,7 @@ process_sf_dir2( /* * Initialize i8 based on size of parent inode number. */ - i8 = (XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) + i8 = (XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent) > XFS_DIR2_MAX_SHORT_INUM); /* @@ -893,8 +890,8 @@ process_sf_dir2( sfep = next_sfep; junkit = 0; bad_sfnamelen = 0; - lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + lino = XFS_DIR2_SF_GET_INUMBER(sfp, + XFS_DIR2_SF_INUMBERP(sfep)); /* * if entry points to self, junk it since only '.' or '..' * should do that and shortform dirs don't contain either @@ -1073,13 +1070,13 @@ process_sf_dir2( junkit = 1; } - if (XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) < offset) { + if (XFS_DIR2_SF_GET_OFFSET(sfep) < offset) { do_warn(_("entry contains offset out of order in " "shortform dir %llu\n"), ino); bad_offset = 1; } - offset = XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) + + offset = XFS_DIR2_SF_GET_OFFSET(sfep) + XFS_DIR2_DATA_ENTSIZE(namelen); /* @@ -1240,8 +1237,7 @@ process_sf_dir2( /* * check parent (..) entry */ - *parent = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, - &sfp->hdr.parent, ARCH_CONVERT); + *parent = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent); /* * if parent entry is bogus, null it out. we'll fix it later . @@ -1255,8 +1251,7 @@ process_sf_dir2( if (!no_modify) { do_warn(_("clearing inode number\n")); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &zero, - &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &zero, &sfp->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -1271,8 +1266,7 @@ process_sf_dir2( "was %llu, now %llu\n"), ino, *parent, ino); *parent = ino; - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, parent, - &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, parent, &sfp->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -1292,8 +1286,7 @@ process_sf_dir2( if (!no_modify) { do_warn(_("clearing inode number\n")); - XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &zero, - &sfp->hdr.parent, ARCH_CONVERT); + XFS_DIR2_SF_PUT_INUMBER(sfp, &zero, &sfp->hdr.parent); *dino_dirty = 1; *repair = 1; } else { @@ -1369,9 +1362,8 @@ process_dir2_data( INT_GET(dup->length, ARCH_CONVERT) == 0 || (INT_GET(dup->length, ARCH_CONVERT) & (XFS_DIR2_DATA_ALIGN - 1))) break; - if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH(dup, - ARCH_CONVERT), ARCH_CONVERT) != - (char *)dup - (char *)d) + if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), + ARCH_CONVERT) != (char *)dup - (char *)d) break; badbest |= lastfree != 0; dfp = xfs_dir2_data_freefind(d, dup); @@ -1726,7 +1718,7 @@ process_block_dir2( * this also checks & fixes the bestfree */ btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); /* * Don't let this go past the end of the block. */ @@ -2084,7 +2076,7 @@ process_dir2( if (blkmap) last = blkmap_last_off(blkmap); if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <= - XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT) && + XFS_DFORK_DSIZE(dip, mp) && dip->di_core.di_format == XFS_DINODE_FMT_LOCAL) { dot = dotdot = 1; res = process_sf_dir2(mp, ino, dip, ino_discovery, dino_dirty, diff --git a/repair/incore.h b/repair/incore.h index 15a45f49e..5fa7f5e5b 100644 --- a/repair/incore.h +++ b/repair/incore.h @@ -478,17 +478,17 @@ void clear_uncertain_ino_cache(xfs_agnumber_t agno); */ #define set_inode_free(ino_rec, ino_offset) \ XFS_INOCF_SET_CF((ino_rec), (ino_offset)), \ - XFS_INOBT_SET_FREE((ino_rec), (ino_offset),(ARCH_NOCONVERT)) + XFS_INOBT_SET_FREE((ino_rec), (ino_offset), ARCH_NOCONVERT) #define set_inode_used(ino_rec, ino_offset) \ XFS_INOCF_SET_CF((ino_rec), (ino_offset)), \ - XFS_INOBT_CLR_FREE((ino_rec), (ino_offset),(ARCH_NOCONVERT)) + XFS_INOBT_CLR_FREE((ino_rec), (ino_offset), ARCH_NOCONVERT) #define is_inode_used(ino_rec, ino_offset) \ - !XFS_INOBT_IS_FREE((ino_rec), (ino_offset),(ARCH_NOCONVERT)) + !XFS_INOBT_IS_FREE((ino_rec), (ino_offset), ARCH_NOCONVERT) #define is_inode_free(ino_rec, ino_offset) \ - XFS_INOBT_IS_FREE((ino_rec), (ino_offset),(ARCH_NOCONVERT)) + XFS_INOBT_IS_FREE((ino_rec), (ino_offset), ARCH_NOCONVERT) /* * add_inode_reached() is set on inode I only if I has been reached diff --git a/repair/phase4.c b/repair/phase4.c index bf0da1cdc..ba078aef1 100644 --- a/repair/phase4.c +++ b/repair/phase4.c @@ -81,7 +81,7 @@ lf_block_delete_orphanage(xfs_mount_t *mp, for (i = 0; i < INT_GET(leaf->hdr.count, ARCH_CONVERT); entry++, i++) { namest = XFS_DIR_LEAF_NAMESTRUCT(leaf, INT_GET(entry->nameidx, ARCH_CONVERT)); - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &lino); bcopy(namest->name, fname, entry->namelen); fname[entry->namelen] = '\0'; @@ -316,7 +316,7 @@ shortform_delete_orphanage(xfs_mount_t *mp, res = 0; irec = NULL; ino_dir_size = INT_GET(root_dino->di_core.di_size, ARCH_CONVERT); - max_size = XFS_DFORK_DSIZE_ARCH(root_dino, mp, ARCH_CONVERT); + max_size = XFS_DFORK_DSIZE(root_dino, mp); use_rbuf = 0; root_agno = XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rootino); root_agino = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rootino); @@ -329,8 +329,7 @@ shortform_delete_orphanage(xfs_mount_t *mp, (__psint_t)next_sfe - (__psint_t)sf; i++) { tmp_sfe = NULL; sf_entry = next_sfe; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, - &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino); bcopy(sf_entry->name, fname, sf_entry->namelen); fname[sf_entry->namelen] = '\0'; @@ -526,7 +525,7 @@ lf2_block_delete_orphanage(xfs_mount_t *mp, ptr = (char *)data->u; if (INT_GET(data->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)data); - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } else endptr = (char *)data + mp->m_dirblksize; *dirty = 0; @@ -796,7 +795,7 @@ shortform2_delete_orphanage(xfs_mount_t *mp, *ino_dirty = 0; irec = NULL; ino_dir_size = INT_GET(root_dino->di_core.di_size, ARCH_CONVERT); - max_size = XFS_DFORK_DSIZE_ARCH(root_dino, mp, ARCH_CONVERT); + max_size = XFS_DFORK_DSIZE(root_dino, mp); use_rbuf = 0; res = 0; root_agno = XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rootino); @@ -810,8 +809,8 @@ shortform2_delete_orphanage(xfs_mount_t *mp, (__psint_t)next_sfe - (__psint_t)sf; i++) { tmp_sfe = NULL; sf_entry = next_sfe; - lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sf, - XFS_DIR2_SF_INUMBERP(sf_entry), ARCH_CONVERT); + lino = XFS_DIR2_SF_GET_INUMBER(sf, + XFS_DIR2_SF_INUMBERP(sf_entry)); bcopy(sf_entry->name, fname, sf_entry->namelen); fname[sf_entry->namelen] = '\0'; diff --git a/repair/phase5.c b/repair/phase5.c index cbb53c80f..76e7389c8 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000-2001,2005 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 @@ -684,7 +684,7 @@ prop_freespace_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, INT_SET(bt_hdr->bb_level, ARCH_CONVERT, level); INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, lptr->prev_agbno); INT_SET(bt_hdr->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); - INT_ZERO(bt_hdr->bb_numrecs, ARCH_CONVERT); + bt_hdr->bb_numrecs = 0; /* * propagate extent record for first extent in new block up @@ -761,7 +761,7 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno, INT_SET(bt_hdr->bb_level, ARCH_CONVERT, i); INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, bt_hdr->bb_rightsib = NULLAGBLOCK); - INT_ZERO(bt_hdr->bb_numrecs, ARCH_CONVERT); + bt_hdr->bb_numrecs = 0; } /* * run along leaf, setting up records. as we have to switch @@ -789,7 +789,7 @@ build_freespace_tree(xfs_mount_t *mp, xfs_agnumber_t agno, bzero(bt_hdr, mp->m_sb.sb_blocksize); INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, magic); - INT_ZERO(bt_hdr->bb_level, ARCH_CONVERT); + bt_hdr->bb_level = 0; INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, lptr->prev_agbno); INT_SET(bt_hdr->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); INT_SET(bt_hdr->bb_numrecs, ARCH_CONVERT, @@ -1041,7 +1041,7 @@ prop_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs, INT_SET(bt_hdr->bb_level, ARCH_CONVERT, level); INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, lptr->prev_agbno); INT_SET(bt_hdr->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); - INT_ZERO(bt_hdr->bb_numrecs, ARCH_CONVERT); + bt_hdr->bb_numrecs = 0; /* * propagate extent record for first extent in new block up */ @@ -1144,7 +1144,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno, INT_SET(bt_hdr->bb_level, ARCH_CONVERT, i); INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, bt_hdr->bb_rightsib = NULLAGBLOCK); - INT_ZERO(bt_hdr->bb_numrecs, ARCH_CONVERT); + bt_hdr->bb_numrecs = 0; } /* * run along leaf, setting up records. as we have to switch @@ -1169,7 +1169,7 @@ build_ino_tree(xfs_mount_t *mp, xfs_agnumber_t agno, bzero(bt_hdr, mp->m_sb.sb_blocksize); INT_SET(bt_hdr->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC); - INT_ZERO(bt_hdr->bb_level, ARCH_CONVERT); + bt_hdr->bb_level = 0; INT_SET(bt_hdr->bb_leftsib, ARCH_CONVERT, lptr->prev_agbno); INT_SET(bt_hdr->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK); INT_SET(bt_hdr->bb_numrecs, ARCH_CONVERT, @@ -1340,7 +1340,7 @@ build_agf_agfl(xfs_mount_t *mp, lostblocks, j, agno); } - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; INT_SET(agf->agf_fllast, ARCH_CONVERT, i - 1); INT_SET(agf->agf_flcount, ARCH_CONVERT, i); @@ -1350,9 +1350,9 @@ build_agf_agfl(xfs_mount_t *mp, libxfs_writebuf(agfl_buf, 0); } else { - INT_ZERO(agf->agf_flfirst, ARCH_CONVERT); + agf->agf_flfirst = 0; INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE(mp) - 1); - INT_ZERO(agf->agf_flcount, ARCH_CONVERT); + agf->agf_flcount = 0; } ext_ptr = findbiggest_bcnt_extent(agno); @@ -1394,8 +1394,7 @@ sync_sb(xfs_mount_t *mp) update_sb_version(mp); *sbp = mp->m_sb; - libxfs_xlate_sb(XFS_BUF_PTR(bp), sbp, -1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(bp), sbp, -1, XFS_SB_ALL_BITS); libxfs_writebuf(bp, 0); } @@ -1568,18 +1567,19 @@ phase5(xfs_mount_t *mp) fprintf(stderr, "# of bcnt extents is %d\n", count_bcnt_extents(agno)); #endif + /* * now rebuild the freespace trees */ - freeblks1 = build_freespace_tree(mp, agno, &bno_btree_curs, - XFS_ABTB_MAGIC); + freeblks1 = build_freespace_tree(mp, agno, + &bno_btree_curs, XFS_ABTB_MAGIC); #ifdef XR_BLD_FREE_TRACE fprintf(stderr, "# of free blocks == %d\n", freeblks1); #endif write_cursor(&bno_btree_curs); - freeblks2 = build_freespace_tree(mp, agno, &bcnt_btree_curs, - XFS_ABTC_MAGIC); + freeblks2 = build_freespace_tree(mp, agno, + &bcnt_btree_curs, XFS_ABTC_MAGIC); write_cursor(&bcnt_btree_curs); ASSERT(freeblks1 == freeblks2); diff --git a/repair/phase6.c b/repair/phase6.c index df2374788..c932106fe 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -347,7 +347,7 @@ mk_rbmino(xfs_mount_t *mp) if ((i = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0))) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip); + error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime bitmap inode -- error - %d\n"), @@ -440,7 +440,7 @@ fill_rbmino(xfs_mount_t *mp) if ((error = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0))) res_failed(error); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, &ip); + error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime bitmap inode -- error - %d\n"), @@ -510,7 +510,7 @@ fill_rsumino(xfs_mount_t *mp) if ((error = libxfs_trans_reserve(tp, 10, 0, 0, 0, 0))) res_failed(error); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip); + error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime summary inode -- error - %d\n"), @@ -582,7 +582,7 @@ mk_rsumino(xfs_mount_t *mp) XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT))) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, &ip); + error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 0, &ip); if (error) { do_error( _("couldn't iget realtime summary inode -- error - %d\n"), @@ -679,7 +679,7 @@ mk_root_dir(xfs_mount_t *mp) XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT))) res_failed(i); - error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, &ip); + error = libxfs_trans_iget(mp, tp, mp->m_sb.sb_rootino, 0, 0, &ip); if (error) { do_error(_("could not iget root inode -- error - %d\n"), error); } @@ -1353,7 +1353,7 @@ lf_block_dir_entry_check(xfs_mount_t *mp, junkit = 0; - XFS_DIR_SF_GET_DIRINO_ARCH(&namest->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&namest->inumber, &lino); bcopy(namest->name, fname, entry->namelen); fname[entry->namelen] = '\0'; @@ -1745,7 +1745,7 @@ longform_dir2_entry_check_data( freetab = *freetabp; if (isblock) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, d); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); endptr = (char *)blp; if (endptr > (char *)btp) endptr = (char *)btp; @@ -1789,9 +1789,8 @@ longform_dir2_entry_check_data( break; /* check for invalid tag */ - if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P_ARCH( - dup, ARCH_CONVERT), ARCH_CONVERT) != - (char *)dup - (char *)d) + if (INT_GET(*XFS_DIR2_DATA_UNUSED_TAG_P(dup), + ARCH_CONVERT) != (char *)dup - (char *)d) break; /* check for block with no data entries */ @@ -2117,7 +2116,7 @@ longform_dir2_check_leaf( } leaf = bp->data; ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf); - bestsp = XFS_DIR2_LEAF_BESTS_P_ARCH(ltp, ARCH_CONVERT); + bestsp = XFS_DIR2_LEAF_BESTS_P(ltp); if (INT_GET(leaf->hdr.info.magic, ARCH_CONVERT) != XFS_DIR2_LEAF1_MAGIC || INT_GET(leaf->hdr.info.forw, ARCH_CONVERT) || @@ -2352,7 +2351,7 @@ longform_dir2_rebuild_setup( /* construct freelist */ block = (xfs_dir2_block_t *)data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); needlog = needscan = 0; libxfs_dir2_data_make_free(tp, dbp, (char *)blp - (char *)block, (char *)block + mp->m_dirblksize - (char *)blp, @@ -2490,7 +2489,7 @@ longform_dir2_rebuild_data( ptr = (char *)data->u; if (INT_GET(data->hdr.magic, ARCH_CONVERT) == XFS_DIR2_BLOCK_MAGIC) { btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)data); - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp); } else endptr = (char *)data + mp->m_dirblksize; fblock = fbp->data; @@ -2740,7 +2739,7 @@ longform_dir2_entry_check(xfs_mount_t *mp, ASSERT(bp); block = bp->data; btp = XFS_DIR2_BLOCK_TAIL_P(mp, block); - blp = XFS_DIR2_BLOCK_LEAF_P_ARCH(btp, ARCH_CONVERT); + blp = XFS_DIR2_BLOCK_LEAF_P(btp); seeval = dir_hash_see_all(hashtab, blp, INT_GET(btp->count, ARCH_CONVERT), INT_GET(btp->stale, ARCH_CONVERT)); if (dir_hash_check(hashtab, ip, seeval)) fixit |= 1; @@ -2823,7 +2822,7 @@ shortform_dir_entry_check(xfs_mount_t *mp, bad_sfnamelen = 0; tmp_sfe = NULL; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino); namelen = sf_entry->namelen; @@ -3082,7 +3081,7 @@ prune_sf_dir_entry(xfs_mount_t *mp, xfs_ino_t ino, xfs_inode_t *ip) sf_entry = next_sfe, i++) { tmp_sfe = NULL; - XFS_DIR_SF_GET_DIRINO_ARCH(&sf_entry->inumber, &lino, ARCH_CONVERT); + XFS_DIR_SF_GET_DIRINO(&sf_entry->inumber, &lino); bcopy(sf_entry->name, fname, sf_entry->namelen); fname[sf_entry->namelen] = '\0'; @@ -3193,7 +3192,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, /* * Initialise i8 counter -- the parent inode number counts as well. */ - i8 = (XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM); + i8 = (XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent) > XFS_DIR2_MAX_SHORT_INUM); /* * now run through entries, stop at first bad entry, don't need @@ -3209,7 +3208,7 @@ shortform_dir2_entry_check(xfs_mount_t *mp, bad_sfnamelen = 0; tmp_sfep = NULL; - lino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT); + lino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep)); namelen = sfep->namelen; diff --git a/repair/phase7.c b/repair/phase7.c index 4f3b52ad3..70cb0323e 100644 --- a/repair/phase7.c +++ b/repair/phase7.c @@ -124,7 +124,7 @@ phase7(xfs_mount_t *mp) ino = XFS_AGINO_TO_INO(mp, i, irec->ino_startnum + j); - error = libxfs_trans_iget(mp, tp, ino, 0, &ip); + error = libxfs_trans_iget(mp, tp, ino, 0, 0, &ip); if (error) { if (!no_modify) diff --git a/repair/sb.c b/repair/sb.c index 079559be5..e901f1237 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -147,8 +147,7 @@ find_secondary_sb(xfs_sb_t *rsb) */ for (i = 0; !done && i < bsize; i += BBSIZE) { c_bufsb = (char *) sb + i; - libxfs_xlate_sb(c_bufsb, &bufsb, 1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(c_bufsb, &bufsb, 1, XFS_SB_ALL_BITS); if (verify_sb(&bufsb, 0) != XR_OK) continue; @@ -476,7 +475,7 @@ write_primary_sb(xfs_sb_t *sbp, int size) do_error(_("couldn't seek to offset 0 in filesystem\n")); } - libxfs_xlate_sb(buf, sbp, -1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(buf, sbp, -1, XFS_SB_ALL_BITS); if (write(fs_fd, buf, size) != size) { free(buf); @@ -518,7 +517,7 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno) off, size, rval, agno); do_error("%s\n", strerror(error)); } - libxfs_xlate_sb(buf, sbp, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(buf, sbp, 1, XFS_SB_ALL_BITS); free(buf); return (verify_sb(sbp, 0)); diff --git a/repair/scan.c b/repair/scan.c index 5e8d01d25..9400b5b62 100644 --- a/repair/scan.c +++ b/repair/scan.c @@ -1196,8 +1196,7 @@ scan_ag( libxfs_putbuf(sbbuf); return; } - libxfs_xlate_sb(XFS_BUF_TO_SBP(sbbuf), sb, 1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_TO_SBP(sbbuf), sb, 1, XFS_SB_ALL_BITS); agfbuf = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), @@ -1326,8 +1325,7 @@ scan_ag( ASSERT(sb_dirty == 0 || (sb_dirty && !no_modify)); if (sb_dirty && !no_modify) { - libxfs_xlate_sb(XFS_BUF_PTR(sbbuf), sb, -1, ARCH_CONVERT, - XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(sbbuf), sb, -1, XFS_SB_ALL_BITS); libxfs_writebuf(sbbuf, 0); } else libxfs_putbuf(sbbuf); diff --git a/repair/versions.c b/repair/versions.c index 5c072821c..c69b1e798 100644 --- a/repair/versions.c +++ b/repair/versions.c @@ -79,7 +79,7 @@ update_sb_version(xfs_mount_t *mp) */ if (sb->sb_qflags & ~(XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| XFS_PQUOTA_ACCT)) { /* * update the incore superblock, if we're in @@ -90,12 +90,12 @@ update_sb_version(xfs_mount_t *mp) sb->sb_qflags & ~(XFS_UQUOTA_ACCT| XFS_UQUOTA_ENFD| XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| XFS_PQUOTA_ACCT)); sb->sb_qflags &= (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD| XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT| - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD| + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD| XFS_PQUOTA_ACCT); if (!no_modify) diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 0de0130ed..eba1ae2be 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -468,7 +468,7 @@ main(int argc, char **argv) sbp = libxfs_readbuf(x.ddev, XFS_SB_DADDR, 1, 0); memset(&xfs_m, 0, sizeof(xfs_mount_t)); sb = &xfs_m.m_sb; - libxfs_xlate_sb(XFS_BUF_PTR(sbp), sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS); + libxfs_xlate_sb(XFS_BUF_PTR(sbp), sb, 1, XFS_SB_ALL_BITS); mp = libxfs_mount(&xfs_m, sb, x.ddev, x.logdev, x.rtdev, 0); @@ -599,10 +599,10 @@ _("Warning: project quota information would be cleared.\n" sb = XFS_BUF_TO_SBP(sbp); - if (sb->sb_qflags & (XFS_UQUOTA_CHKD|XFS_GQUOTA_CHKD)) { + if (sb->sb_qflags & (XFS_UQUOTA_CHKD|XFS_OQUOTA_CHKD)) { do_warn( _("Note - quota info will be regenerated on next quota mount.\n")); - sb->sb_qflags &= ~(XFS_UQUOTA_CHKD|XFS_GQUOTA_CHKD); + sb->sb_qflags &= ~(XFS_UQUOTA_CHKD|XFS_OQUOTA_CHKD); } if (clear_sunit) {