Commit 16259e7d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott

[XFS] Endianess annotations for various allocator data structures

SGI-PV: 943272
SGI-Modid: xfs-linux:xfs-kern:201006a
Signed-off-by: default avatarChristoph Hellwig <hch@sgi.com>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent e2ed81fb
......@@ -48,27 +48,26 @@ struct xfs_trans;
* are > 64k, our value cannot be confused for an EFS superblock's.
*/
typedef struct xfs_agf
{
typedef struct xfs_agf {
/*
* Common allocation group header information
*/
__uint32_t agf_magicnum; /* magic number == XFS_AGF_MAGIC */
__uint32_t agf_versionnum; /* header version == XFS_AGF_VERSION */
xfs_agnumber_t agf_seqno; /* sequence # starting from 0 */
xfs_agblock_t agf_length; /* size in blocks of a.g. */
__be32 agf_magicnum; /* magic number == XFS_AGF_MAGIC */
__be32 agf_versionnum; /* header version == XFS_AGF_VERSION */
__be32 agf_seqno; /* sequence # starting from 0 */
__be32 agf_length; /* size in blocks of a.g. */
/*
* Freespace information
*/
xfs_agblock_t agf_roots[XFS_BTNUM_AGF]; /* root blocks */
__uint32_t agf_spare0; /* spare field */
__uint32_t agf_levels[XFS_BTNUM_AGF]; /* btree levels */
__uint32_t agf_spare1; /* spare field */
__uint32_t agf_flfirst; /* first freelist block's index */
__uint32_t agf_fllast; /* last freelist block's index */
__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 */
__be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */
__be32 agf_spare0; /* spare field */
__be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */
__be32 agf_spare1; /* spare field */
__be32 agf_flfirst; /* first freelist block's index */
__be32 agf_fllast; /* last freelist block's index */
__be32 agf_flcount; /* count of blocks in freelist */
__be32 agf_freeblks; /* total free blocks */
__be32 agf_longest; /* longest free space */
} xfs_agf_t;
#define XFS_AGF_MAGICNUM 0x00000001
......@@ -96,31 +95,30 @@ typedef struct xfs_agf
*/
#define XFS_AGI_UNLINKED_BUCKETS 64
typedef struct xfs_agi
{
typedef struct xfs_agi {
/*
* Common allocation group header information
*/
__uint32_t agi_magicnum; /* magic number == XFS_AGI_MAGIC */
__uint32_t agi_versionnum; /* header version == XFS_AGI_VERSION */
xfs_agnumber_t agi_seqno; /* sequence # starting from 0 */
xfs_agblock_t agi_length; /* size in blocks of a.g. */
__be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */
__be32 agi_versionnum; /* header version == XFS_AGI_VERSION */
__be32 agi_seqno; /* sequence # starting from 0 */
__be32 agi_length; /* size in blocks of a.g. */
/*
* Inode information
* Inodes are mapped by interpreting the inode number, so no
* mapping data is needed here.
*/
xfs_agino_t agi_count; /* count of allocated inodes */
xfs_agblock_t agi_root; /* root of inode btree */
__uint32_t agi_level; /* levels in inode btree */
xfs_agino_t agi_freecount; /* number of free inodes */
xfs_agino_t agi_newino; /* new inode just allocated */
xfs_agino_t agi_dirino; /* last directory inode chunk */
__be32 agi_count; /* count of allocated inodes */
__be32 agi_root; /* root of inode btree */
__be32 agi_level; /* levels in inode btree */
__be32 agi_freecount; /* number of free inodes */
__be32 agi_newino; /* new inode just allocated */
__be32 agi_dirino; /* last directory inode chunk */
/*
* Hash table of inodes which have been unlinked but are
* still being referenced.
*/
xfs_agino_t agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
__be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
} xfs_agi_t;
#define XFS_AGI_MAGICNUM 0x00000001
......@@ -201,8 +199,8 @@ typedef struct xfs_perag
(MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
#define XFS_MIN_FREELIST(a,mp) \
(XFS_MIN_FREELIST_RAW( \
INT_GET((a)->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT), \
INT_GET((a)->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT), mp))
be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
#define XFS_MIN_FREELIST_PAG(pag,mp) \
(XFS_MIN_FREELIST_RAW( \
(uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,14 +38,19 @@ struct xfs_mount;
/*
* Data record/key structure
*/
typedef struct xfs_alloc_rec
{
typedef struct xfs_alloc_rec {
__be32 ar_startblock; /* starting block number */
__be32 ar_blockcount; /* count of free blocks */
} xfs_alloc_rec_t, xfs_alloc_key_t;
typedef struct xfs_alloc_rec_incore {
xfs_agblock_t ar_startblock; /* starting block number */
xfs_extlen_t ar_blockcount; /* count of free blocks */
} xfs_alloc_rec_t, xfs_alloc_key_t;
} xfs_alloc_rec_incore_t;
typedef xfs_agblock_t xfs_alloc_ptr_t; /* btree pointer type */
/* btree block header type */
/* btree pointer type */
typedef __be32 xfs_alloc_ptr_t;
/* btree block header type */
typedef struct xfs_btree_sblock xfs_alloc_block_t;
#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp))
......
......@@ -2763,8 +2763,8 @@ xfs_bmap_btree_to_extents(
ASSERT(ifp->if_flags & XFS_IFEXTENTS);
ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE);
rblock = ifp->if_broot;
ASSERT(INT_GET(rblock->bb_level, ARCH_CONVERT) == 1);
ASSERT(INT_GET(rblock->bb_numrecs, ARCH_CONVERT) == 1);
ASSERT(be16_to_cpu(rblock->bb_level) == 1);
ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1);
ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1);
mp = ip->i_mount;
pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes);
......@@ -3207,11 +3207,11 @@ xfs_bmap_extents_to_btree(
* Fill in the root.
*/
block = ifp->if_broot;
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC);
INT_SET(block->bb_level, ARCH_CONVERT, 1);
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLDFSBNO);
INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
block->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC);
block->bb_level = cpu_to_be16(1);
block->bb_numrecs = cpu_to_be16(1);
block->bb_leftsib = cpu_to_be64(NULLDFSBNO);
block->bb_rightsib = cpu_to_be64(NULLDFSBNO);
/*
* Need a cursor. Can't allocate until bb_level is filled in.
*/
......@@ -3264,10 +3264,10 @@ xfs_bmap_extents_to_btree(
* Fill in the child block.
*/
ablock = XFS_BUF_TO_BMBT_BLOCK(abp);
INT_SET(ablock->bb_magic, ARCH_CONVERT, XFS_BMAP_MAGIC);
ablock->bb_magic = cpu_to_be32(XFS_BMAP_MAGIC);
ablock->bb_level = 0;
INT_SET(ablock->bb_leftsib, ARCH_CONVERT, NULLDFSBNO);
INT_SET(ablock->bb_rightsib, ARCH_CONVERT, NULLDFSBNO);
ablock->bb_leftsib = cpu_to_be64(NULLDFSBNO);
ablock->bb_rightsib = cpu_to_be64(NULLDFSBNO);
arp = XFS_BMAP_REC_IADDR(ablock, 1, cur);
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
for (ep = ifp->if_u1.if_extents, cnt = i = 0; i < nextents; i++, ep++) {
......@@ -3277,8 +3277,8 @@ xfs_bmap_extents_to_btree(
arp++; cnt++;
}
}
INT_SET(ablock->bb_numrecs, ARCH_CONVERT, cnt);
ASSERT(INT_GET(ablock->bb_numrecs, ARCH_CONVERT) == XFS_IFORK_NEXTENTS(ip, whichfork));
ASSERT(cnt == XFS_IFORK_NEXTENTS(ip, whichfork));
ablock->bb_numrecs = cpu_to_be16(cnt);
/*
* Fill in the root key and pointer.
*/
......@@ -3292,7 +3292,7 @@ xfs_bmap_extents_to_btree(
* the root is at the right level.
*/
xfs_bmbt_log_block(cur, abp, XFS_BB_ALL_BITS);
xfs_bmbt_log_recs(cur, abp, 1, INT_GET(ablock->bb_numrecs, ARCH_CONVERT));
xfs_bmbt_log_recs(cur, abp, 1, be16_to_cpu(ablock->bb_numrecs));
ASSERT(*curp == NULL);
*curp = cur;
*logflagsp = XFS_ILOG_CORE | XFS_ILOG_FBROOT(whichfork);
......@@ -4371,8 +4371,8 @@ xfs_bmap_read_extents(
/*
* Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
*/
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
level = INT_GET(block->bb_level, ARCH_CONVERT);
level = be16_to_cpu(block->bb_level);
ASSERT(level > 0);
pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount);
......@@ -4415,7 +4415,7 @@ xfs_bmap_read_extents(
xfs_extnum_t num_recs;
num_recs = INT_GET(block->bb_numrecs, ARCH_CONVERT);
num_recs = be16_to_cpu(block->bb_numrecs);
if (unlikely(i + num_recs > room)) {
ASSERT(i + num_recs <= room);
xfs_fs_cmn_err(CE_WARN, ip->i_mount,
......@@ -4432,7 +4432,7 @@ xfs_bmap_read_extents(
/*
* Read-ahead the next leaf block, if any.
*/
nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT);
nextbno = be64_to_cpu(block->bb_rightsib);
if (nextbno != NULLFSBLOCK)
xfs_btree_reada_bufl(mp, nextbno, 1);
/*
......@@ -4689,7 +4689,7 @@ xfs_bmapi(
}
if (wr && *firstblock == NULLFSBLOCK) {
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE)
minleft = INT_GET(ifp->if_broot->bb_level, ARCH_CONVERT) + 1;
minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1;
else
minleft = 1;
} else
......@@ -5967,10 +5967,10 @@ xfs_check_block(
xfs_bmbt_ptr_t *pp, *thispa; /* pointer to block address */
xfs_bmbt_key_t *prevp, *keyp;
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
ASSERT(be16_to_cpu(block->bb_level) > 0);
prevp = NULL;
for( i = 1; i <= INT_GET(block->bb_numrecs, ARCH_CONVERT);i++) {
for( i = 1; i <= be16_to_cpu(block->bb_numrecs); i++) {
dmxr = mp->m_bmap_dmxr[0];
if (root) {
......@@ -5995,7 +5995,7 @@ xfs_check_block(
pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize,
xfs_bmbt, block, i, dmxr);
}
for (j = i+1; j <= INT_GET(block->bb_numrecs, ARCH_CONVERT); j++) {
for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) {
if (root) {
thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz);
} else {
......@@ -6048,8 +6048,8 @@ xfs_bmap_check_leaf_extents(
/*
* Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
*/
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
level = INT_GET(block->bb_level, ARCH_CONVERT);
level = be16_to_cpu(block->bb_level);
ASSERT(level > 0);
xfs_check_block(block, mp, 1, ifp->if_broot_bytes);
pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
......@@ -6109,13 +6109,13 @@ xfs_bmap_check_leaf_extents(
xfs_extnum_t num_recs;
num_recs = INT_GET(block->bb_numrecs, ARCH_CONVERT);
num_recs = be16_to_cpu(block->bb_numrecs);
/*
* Read-ahead the next leaf block, if any.
*/
nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT);
nextbno = be64_to_cpu(block->bb_rightsib);
/*
* Check all the extents to make sure they are OK.
......@@ -6212,8 +6212,8 @@ xfs_bmap_count_blocks(
* Root level must use BMAP_BROOT_PTR_ADDR macro to get ptr out.
*/
block = ifp->if_broot;
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
level = INT_GET(block->bb_level, ARCH_CONVERT);
level = be16_to_cpu(block->bb_level);
ASSERT(level > 0);
pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes);
ASSERT(INT_GET(*pp, ARCH_CONVERT) != NULLDFSBNO);
ASSERT(XFS_FSB_TO_AGNO(mp, INT_GET(*pp, ARCH_CONVERT)) < mp->m_sb.sb_agcount);
......@@ -6258,14 +6258,14 @@ xfs_bmap_count_tree(
if (--level) {
/* Not at node above leafs, count this level of nodes */
nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT);
nextbno = be64_to_cpu(block->bb_rightsib);
while (nextbno != NULLFSBLOCK) {
if ((error = xfs_btree_read_bufl(mp, tp, nextbno,
0, &nbp, XFS_BMAP_BTREE_REF)))
return error;
*count += 1;
nextblock = XFS_BUF_TO_BMBT_BLOCK(nbp);
nextbno = INT_GET(nextblock->bb_rightsib, ARCH_CONVERT);
nextbno = be64_to_cpu(nextblock->bb_rightsib);
xfs_trans_brelse(tp, nbp);
}
......@@ -6284,8 +6284,8 @@ xfs_bmap_count_tree(
} else {
/* count all level 1 nodes and their leaves */
for (;;) {
nextbno = INT_GET(block->bb_rightsib, ARCH_CONVERT);
numrecs = INT_GET(block->bb_numrecs, ARCH_CONVERT);
nextbno = be64_to_cpu(block->bb_rightsib);
numrecs = be16_to_cpu(block->bb_numrecs);
frp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize,
xfs_bmbt, block, 1, mp->m_bmap_dmxr[0]);
if (unlikely(xfs_bmap_disk_count_leaves(frp, numrecs, count) < 0)) {
......
This diff is collapsed.
......@@ -28,10 +28,9 @@ struct xfs_inode;
/*
* Bmap root header, on-disk form only.
*/
typedef struct xfs_bmdr_block
{
__uint16_t bb_level; /* 0 is a leaf */
__uint16_t bb_numrecs; /* current # of data records */
typedef struct xfs_bmdr_block {
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
} xfs_bmdr_block_t;
/*
......@@ -212,36 +211,36 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BMAP_REC_DADDR(bb,i,cur) \
(XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_REC_IADDR(bb,i,cur) \
(XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_KEY_DADDR(bb,i,cur) \
(XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
(XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
(XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
(XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
be16_to_cpu((bb)->bb_level), cur)))
/*
* These are to be used when we know the size of the block and
......@@ -254,7 +253,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
(XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
#define XFS_BMAP_BROOT_NUMRECS(bb) INT_GET((bb)->bb_numrecs, ARCH_CONVERT)
#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs)
#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
......@@ -262,7 +261,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
#define XFS_BMAP_BROOT_SPACE(bb) \
(XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)))
(XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
#define XFS_BMDR_SPACE_CALC(nrecs) \
(int)(sizeof(xfs_bmdr_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
......@@ -273,11 +272,10 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
(INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \
INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \
INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= \
(mp)->m_bmap_dmxr[(level) != 0])
(be32_to_cpu((bb)->bb_magic) == XFS_BMAP_MAGIC && \
be16_to_cpu((bb)->bb_level) == level && \
be16_to_cpu((bb)->bb_numrecs) > 0 && \
be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0])
#ifdef __KERNEL__
......
......@@ -90,11 +90,14 @@ xfs_btree_maxrecs(
switch (cur->bc_btnum) {
case XFS_BTNUM_BNO:
case XFS_BTNUM_CNT:
return (int)XFS_ALLOC_BLOCK_MAXRECS(INT_GET(block->bb_h.bb_level, ARCH_CONVERT), cur);
return (int)XFS_ALLOC_BLOCK_MAXRECS(
be16_to_cpu(block->bb_h.bb_level), cur);
case XFS_BTNUM_BMAP:
return (int)XFS_BMAP_BLOCK_IMAXRECS(INT_GET(block->bb_h.bb_level, ARCH_CONVERT), cur);
return (int)XFS_BMAP_BLOCK_IMAXRECS(
be16_to_cpu(block->bb_h.bb_level), cur);
case XFS_BTNUM_INO:
return (int)XFS_INOBT_BLOCK_MAXRECS(INT_GET(block->bb_h.bb_level, ARCH_CONVERT), cur);
return (int)XFS_INOBT_BLOCK_MAXRECS(
be16_to_cpu(block->bb_h.bb_level), cur);
default:
ASSERT(0);
return 0;
......@@ -140,7 +143,7 @@ xfs_btree_check_key(
k1 = ak1;
k2 = ak2;
ASSERT(INT_GET(k1->ar_startblock, ARCH_CONVERT) < INT_GET(k2->ar_startblock, ARCH_CONVERT));
ASSERT(be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock));
break;
}
case XFS_BTNUM_CNT: {
......@@ -149,9 +152,9 @@ xfs_btree_check_key(
k1 = ak1;
k2 = ak2;
ASSERT(INT_GET(k1->ar_blockcount, ARCH_CONVERT) < INT_GET(k2->ar_blockcount, ARCH_CONVERT) ||
(INT_GET(k1->ar_blockcount, ARCH_CONVERT) == INT_GET(k2->ar_blockcount, ARCH_CONVERT) &&
INT_GET(k1->ar_startblock, ARCH_CONVERT) < INT_GET(k2->ar_startblock, ARCH_CONVERT)));
ASSERT(be32_to_cpu(k1->ar_blockcount) < be32_to_cpu(k2->ar_blockcount) ||
(k1->ar_blockcount == k2->ar_blockcount &&
be32_to_cpu(k1->ar_startblock) < be32_to_cpu(k2->ar_startblock)));
break;
}
case XFS_BTNUM_BMAP: {
......@@ -194,16 +197,16 @@ xfs_btree_check_lblock(
mp = cur->bc_mp;
lblock_ok =
INT_GET(block->bb_magic, ARCH_CONVERT) == xfs_magics[cur->bc_btnum] &&
INT_GET(block->bb_level, ARCH_CONVERT) == level &&
INT_GET(block->bb_numrecs, ARCH_CONVERT) <=
be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
be16_to_cpu(block->bb_level) == level &&
be16_to_cpu(block->bb_numrecs) <=
xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) &&
block->bb_leftsib &&
(INT_GET(block->bb_leftsib, ARCH_CONVERT) == NULLDFSBNO ||
XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_leftsib, ARCH_CONVERT))) &&
(be64_to_cpu(block->bb_leftsib) == NULLDFSBNO ||
XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_leftsib))) &&
block->bb_rightsib &&
(INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLDFSBNO ||
XFS_FSB_SANITY_CHECK(mp, INT_GET(block->bb_rightsib, ARCH_CONVERT)));
(be64_to_cpu(block->bb_rightsib) == NULLDFSBNO ||
XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_rightsib)));
if (unlikely(XFS_TEST_ERROR(!lblock_ok, mp, XFS_ERRTAG_BTREE_CHECK_LBLOCK,
XFS_RANDOM_BTREE_CHECK_LBLOCK))) {
if (bp)
......@@ -251,8 +254,9 @@ xfs_btree_check_rec(
r1 = ar1;
r2 = ar2;
ASSERT(INT_GET(r1->ar_startblock, ARCH_CONVERT) + INT_GET(r1->ar_blockcount, ARCH_CONVERT) <=
INT_GET(r2->ar_startblock, ARCH_CONVERT));
ASSERT(be32_to_cpu(r1->ar_startblock) +
be32_to_cpu(r1->ar_blockcount) <=
be32_to_cpu(r2->ar_startblock));
break;
}
case XFS_BTNUM_CNT: {
......@@ -261,9 +265,9 @@ xfs_btree_check_rec(
r1 = ar1;
r2 = ar2;
ASSERT(INT_GET(r1->ar_blockcount, ARCH_CONVERT) < INT_GET(r2->ar_blockcount, ARCH_CONVERT) ||
(INT_GET(r1->ar_blockcount, ARCH_CONVERT) == INT_GET(r2->ar_blockcount, ARCH_CONVERT) &&
INT_GET(r1->ar_startblock, ARCH_CONVERT) < INT_GET(r2->ar_startblock, ARCH_CONVERT)));
ASSERT(be32_to_cpu(r1->ar_blockcount) < be32_to_cpu(r2->ar_blockcount) ||
(r1->ar_blockcount == r2->ar_blockcount &&
be32_to_cpu(r1->ar_startblock) < be32_to_cpu(r2->ar_startblock)));
break;
}
case XFS_BTNUM_BMAP: {
......@@ -311,17 +315,17 @@ xfs_btree_check_sblock(
agbp = cur->bc_private.a.agbp;
agf = XFS_BUF_TO_AGF(agbp);
agflen = INT_GET(agf->agf_length, ARCH_CONVERT);
agflen = be32_to_cpu(agf->agf_length);
sblock_ok =
INT_GET(block->bb_magic, ARCH_CONVERT) == xfs_magics[cur->bc_btnum] &&
INT_GET(block->bb_level, ARCH_CONVERT) == level &&
INT_GET(block->bb_numrecs, ARCH_CONVERT) <=
be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
be16_to_cpu(block->bb_level) == level &&
be16_to_cpu(block->bb_numrecs) <=
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) &&
(be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK ||
be32_to_cpu(block->bb_leftsib) < agflen) &&
block->bb_leftsib &&
(INT_GET(block->bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK ||
INT_GET(block->bb_rightsib, ARCH_CONVERT) < agflen) &&
(be32_to_cpu(block->bb_rightsib) == NULLAGBLOCK ||
be32_to_cpu(block->bb_rightsib) < agflen) &&
block->bb_rightsib;
if (unlikely(XFS_TEST_ERROR(!sblock_ok, cur->bc_mp,
XFS_ERRTAG_BTREE_CHECK_SBLOCK,
......@@ -352,7 +356,7 @@ xfs_btree_check_sptr(
XFS_WANT_CORRUPTED_RETURN(
level > 0 &&
ptr != NULLAGBLOCK && ptr != 0 &&
ptr < INT_GET(agf->agf_length, ARCH_CONVERT));
ptr < be32_to_cpu(agf->agf_length));
return 0;
}
......@@ -591,15 +595,15 @@ xfs_btree_init_cursor(
case XFS_BTNUM_BNO:
case XFS_BTNUM_CNT:
agf = XFS_BUF_TO_AGF(agbp);
nlevels = INT_GET(agf->agf_levels[btnum], ARCH_CONVERT);
nlevels = be32_to_cpu(agf->agf_levels[btnum]);
break;
case XFS_BTNUM_BMAP:
ifp = XFS_IFORK_PTR(ip, whichfork);
nlevels = INT_GET(ifp->if_broot->bb_level, ARCH_CONVERT) + 1;
nlevels = be16_to_cpu(ifp->if_broot->bb_level) + 1;
break;
case XFS_BTNUM_INO:
agi = XFS_BUF_TO_AGI(agbp);
nlevels = INT_GET(agi->agi_level, ARCH_CONVERT);
nlevels = be32_to_cpu(agi->agi_level);
break;
default:
ASSERT(0);
......@@ -663,9 +667,9 @@ xfs_btree_islastblock(
block = xfs_btree_get_block(cur, level, &bp);
xfs_btree_check_block(cur, block, level, bp);
if (XFS_BTREE_LONG_PTRS(cur->bc_btnum))
return INT_GET(block->bb_u.l.bb_rightsib, ARCH_CONVERT) == NULLDFSBNO;
return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO;
else
return INT_GET(block->bb_u.s.bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK;
return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
}
/*
......@@ -693,7 +697,7 @@ xfs_btree_lastrec(
/*
* Set the ptr value to numrecs, that's the last record/key.
*/
cur->bc_ptrs[level] = INT_GET(block->bb_h.bb_numrecs, ARCH_CONVERT);
cur->bc_ptrs[level] = be16_to_cpu(block->bb_h.bb_numrecs);
return 1;
}
......@@ -863,38 +867,38 @@ xfs_btree_readahead_core(
case XFS_BTNUM_BNO:
case XFS_BTNUM_CNT:
a = XFS_BUF_TO_ALLOC_BLOCK(cur->bc_bufs[lev]);
if ((lr & XFS_BTCUR_LEFTRA) && INT_GET(a->bb_leftsib, ARCH_CONVERT) != NULLAGBLOCK) {
if ((lr & XFS_BTCUR_LEFTRA) && be32_to_cpu(a->bb_leftsib) != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
INT_GET(a->bb_leftsib, ARCH_CONVERT), 1);
be32_to_cpu(a->bb_leftsib), 1);
rval++;
}
if ((lr & XFS_BTCUR_RIGHTRA) && INT_GET(a->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) {
if ((lr & XFS_BTCUR_RIGHTRA) && be32_to_cpu(a->bb_rightsib) != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.a.agno,
INT_GET(a->bb_rightsib, ARCH_CONVERT), 1);
be32_to_cpu(a->bb_rightsib), 1);
rval++;
}
break;
case XFS_BTNUM_BMAP:
b = XFS_BUF_TO_BMBT_BLOCK(cur->bc_bufs[lev]);
if ((lr & XFS_BTCUR_LEFTRA) && INT_GET(b->bb_leftsib, ARCH_CONVERT) != NULLDFSBNO) {
xfs_btree_reada_bufl(cur->bc_mp, INT_GET(b->bb_leftsib, ARCH_CONVERT), 1);
if ((lr & XFS_BTCUR_LEFTRA) && be64_to_cpu(b->bb_leftsib) != NULLDFSBNO) {
xfs_btree_reada_bufl(cur->bc_mp, be64_to_cpu(b->bb_leftsib), 1);
rval++;
}
if ((lr & XFS_BTCUR_RIGHTRA) && INT_GET(b->bb_rightsib, ARCH_CONVERT) != NULLDFSBNO) {
xfs_btree_reada_bufl(cur->bc_mp, INT_GET(b->bb_rightsib, ARCH_CONVERT), 1);
if ((lr & XFS_BTCUR_RIGHTRA) && be64_to_cpu(b->bb_rightsib) != NULLDFSBNO) {
xfs_btree_reada_bufl(cur->bc_mp, be64_to_cpu(b->bb_rightsib), 1);
rval++;
}
break;
case XFS_BTNUM_INO:
i = XFS_BUF_TO_INOBT_BLOCK(cur->bc_bufs[lev]);
if ((lr & XFS_BTCUR_LEFTRA) && INT_GET(i->bb_leftsib, ARCH_CONVERT) != NULLAGBLOCK) {
if ((lr & XFS_BTCUR_LEFTRA) && be32_to_cpu(i->bb_leftsib) != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.i.agno,
INT_GET(i->bb_leftsib, ARCH_CONVERT), 1);
be32_to_cpu(i->bb_leftsib), 1);
rval++;
}
if ((lr & XFS_BTCUR_RIGHTRA) && INT_GET(i->bb_rightsib, ARCH_CONVERT) != NULLAGBLOCK) {
if ((lr & XFS_BTCUR_RIGHTRA) && be32_to_cpu(i->bb_rightsib) != NULLAGBLOCK) {
xfs_btree_reada_bufs(cur->bc_mp, cur->bc_private.i.agno,
INT_GET(i->bb_rightsib, ARCH_CONVERT), 1);
be32_to_cpu(i->bb_rightsib), 1);
rval++;
}
break;
......@@ -926,14 +930,14 @@ xfs_btree_setbuf(
return;
b = XFS_BUF_TO_BLOCK(bp);
if (XFS_BTREE_LONG_PTRS(cur->bc_btnum)) {
if (INT_GET(b->bb_u.l.bb_leftsib, ARCH_CONVERT) == NULLDFSBNO)
if (be64_to_cpu(b->bb_u.l.bb_leftsib) == NULLDFSBNO)
cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
if (INT_GET(b->bb_u.l.bb_rightsib, ARCH_CONVERT) == NULLDFSBNO)
if (be64_to_cpu(b->bb_u.l.bb_rightsib) == NULLDFSBNO)
cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
} else {
if (INT_GET(b->bb_u.s.bb_leftsib, ARCH_CONVERT) == NULLAGBLOCK)
if (be32_to_cpu(b->bb_u.s.bb_leftsib) == NULLAGBLOCK)
cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
if (INT_GET(b->bb_u.s.bb_rightsib, ARCH_CONVERT) == NULLAGBLOCK)
if (be32_to_cpu(b->bb_u.s.bb_rightsib) == NULLAGBLOCK)
cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
}
}
......@@ -39,25 +39,23 @@ struct xfs_trans;
/*
* Short form header: space allocation btrees.
*/
typedef struct xfs_btree_sblock
{
__uint32_t bb_magic; /* magic number for block type */
__uint16_t bb_level; /* 0 is a leaf */
__uint16_t bb_numrecs; /* current # of data records */
xfs_agblock_t bb_leftsib; /* left sibling block or NULLAGBLOCK */
xfs_agblock_t bb_rightsib; /* right sibling block or NULLAGBLOCK */
typedef struct xfs_btree_sblock {
__be32 bb_magic; /* magic number for block type */
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
__be32 bb_leftsib; /* left sibling block or NULLAGBLOCK */
__be32 bb_rightsib; /* right sibling block or NULLAGBLOCK */
} xfs_btree_sblock_t;
/*
* Long form header: bmap btrees.
*/
typedef struct xfs_btree_lblock
{
__uint32_t bb_magic; /* magic number for block type */
__uint16_t bb_level; /* 0 is a leaf */
__uint16_t bb_numrecs; /* current # of data records */
xfs_dfsbno_t bb_leftsib; /* left sibling block or NULLDFSBNO */
xfs_dfsbno_t bb_rightsib; /* right sibling block or NULLDFSBNO */
typedef struct xfs_btree_lblock {
__be32 bb_magic; /* magic number for block type */
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
__be64 bb_leftsib; /* left sibling block or NULLDFSBNO */
__be64 bb_rightsib; /* right sibling block or NULLDFSBNO */
} xfs_btree_lblock_t;
/*
......@@ -65,22 +63,21 @@ typedef struct xfs_btree_lblock
*/
typedef struct xfs_btree_hdr
{
__uint32_t bb_magic; /* magic number for block type */
__uint16_t bb_level; /* 0 is a leaf */
__uint16_t bb_numrecs; /* current # of data records */
__be32 bb_magic; /* magic number for block type */
__be16 bb_level; /* 0 is a leaf */
__be16 bb_numrecs; /* current # of data records */
} xfs_btree_hdr_t;
typedef struct xfs_btree_block
{
typedef struct xfs_btree_block {
xfs_btree_hdr_t bb_h; /* header */
union {
struct {
xfs_agblock_t bb_leftsib;
xfs_agblock_t bb_rightsib;
__be32 bb_leftsib;
__be32 bb_rightsib;
} s; /* short form pointers */
struct {
xfs_dfsbno_t bb_leftsib;
xfs_dfsbno_t bb_rightsib;
__be64 bb_leftsib;
__be64 bb_rightsib;
} l; /* long form pointers */
} bb_u; /* rest */
} xfs_btree_block_t;
......@@ -146,7 +143,7 @@ typedef struct xfs_btree_cur
struct xfs_trans *bc_tp; /* transaction we're in, if any */
struct xfs_mount *bc_mp; /* file system mount struct */
union {
xfs_alloc_rec_t a;
xfs_alloc_rec_incore_t a;
xfs_bmbt_irec_t b;
xfs_inobt_rec_t i;
} bc_rec; /* current insert/search record value */
......
......@@ -191,28 +191,26 @@ xfs_growfs_data_private(
XFS_FSS_TO_BB(mp, 1), 0);
agf = XFS_BUF_TO_AGF(bp);
memset(agf, 0, mp->m_sb.sb_sectsize);
INT_SET(agf->agf_magicnum, ARCH_CONVERT, XFS_AGF_MAGIC);
INT_SET(agf->agf_versionnum, ARCH_CONVERT, XFS_AGF_VERSION);
INT_SET(agf->agf_seqno, ARCH_CONVERT, agno);
agf->agf_magicnum = cpu_to_be32(XFS_AGF_MAGIC);
agf->agf_versionnum = cpu_to_be32(XFS_AGF_VERSION);
agf->agf_seqno = cpu_to_be32(agno);
if (agno == nagcount - 1)
agsize =
nb -
(agno * (xfs_rfsblock_t)mp->m_sb.sb_agblocks);
else
agsize = mp->m_sb.sb_agblocks;
INT_SET(agf->agf_length, ARCH_CONVERT, agsize);
INT_SET(agf->agf_roots[XFS_BTNUM_BNOi], ARCH_CONVERT,
XFS_BNO_BLOCK(mp));
INT_SET(agf->agf_roots[XFS_BTNUM_CNTi], ARCH_CONVERT,
XFS_CNT_BLOCK(mp));
INT_SET(agf->agf_levels[XFS_BTNUM_BNOi], ARCH_CONVERT, 1);
INT_SET(agf->agf_levels[XFS_BTNUM_CNTi], ARCH_CONVERT, 1);
agf->agf_length = cpu_to_be32(agsize);
agf->agf_roots[XFS_BTNUM_BNOi] = cpu_to_be32(XFS_BNO_BLOCK(mp));
agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp));
agf->agf_levels[XFS_BTNUM_BNOi] = cpu_to_be32(1);
agf->agf_levels[XFS_BTNUM_CNTi] = cpu_to_be32(1);
agf->agf_flfirst = 0;
INT_SET(agf->agf_fllast, ARCH_CONVERT, XFS_AGFL_SIZE(mp) - 1);
agf->agf_fllast = cpu_to_be32(XFS_AGFL_SIZE(mp) - 1);
agf->agf_flcount = 0;
tmpsize = agsize - XFS_PREALLOC_BLOCKS(mp);
INT_SET(agf->agf_freeblks, ARCH_CONVERT, tmpsize);
INT_SET(agf->agf_longest, ARCH_CONVERT, tmpsize);
agf->agf_freeblks = cpu_to_be32(tmpsize);
agf->agf_longest = cpu_to_be32(tmpsize);
error = xfs_bwrite(mp, bp);
if (error) {
goto error0;
......@@ -225,19 +223,18 @@ xfs_growfs_data_private(
XFS_FSS_TO_BB(mp, 1), 0);
agi = XFS_BUF_TO_AGI(bp);
memset(agi, 0, mp->m_sb.sb_sectsize);
INT_SET(agi->agi_magicnum, ARCH_CONVERT, XFS_AGI_MAGIC);
INT_SET(agi->agi_versionnum, ARCH_CONVERT, XFS_AGI_VERSION);
INT_SET(agi->agi_seqno, ARCH_CONVERT, agno);
INT_SET(agi->agi_length, ARCH_CONVERT, agsize);
agi->agi_magicnum = cpu_to_be32(XFS_AGI_MAGIC);
agi->agi_versionnum = cpu_to_be32(XFS_AGI_VERSION);
agi->agi_seqno = cpu_to_be32(agno);
agi->agi_length = cpu_to_be32(agsize);
agi->agi_count = 0;
INT_SET(agi->agi_root, ARCH_CONVERT, XFS_IBT_BLOCK(mp));
INT_SET(agi->agi_level, ARCH_CONVERT, 1);
agi->agi_root = cpu_to_be32(XFS_IBT_BLOCK(mp));
agi->agi_level = cpu_to_be32(1);
agi->agi_freecount = 0;
INT_SET(agi->agi_newino, ARCH_CONVERT, NULLAGINO);
INT_SET(agi->agi_dirino, ARCH_CONVERT, NULLAGINO);
agi->agi_newino = cpu_to_be32(NULLAGINO);
agi->agi_dirino = cpu_to_be32(NULLAGINO);
for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++)
INT_SET(agi->agi_unlinked[bucket], ARCH_CONVERT,
NULLAGINO);
agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
error = xfs_bwrite(mp, bp);
if (error) {
goto error0;
......@@ -250,17 +247,16 @@ xfs_growfs_data_private(
BTOBB(mp->m_sb.sb_blocksize), 0);
block = XFS_BUF_TO_SBLOCK(bp);
memset(block, 0, mp->m_sb.sb_blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTB_MAGIC);
block->bb_magic = cpu_to_be32(XFS_ABTB_MAGIC);
block->bb_level = 0;
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
block->bb_numrecs = cpu_to_be16(1);
block->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
block->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
arec = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_alloc,
block, 1, mp->m_alloc_mxr[0]);
INT_SET(arec->ar_startblock, ARCH_CONVERT,
XFS_PREALLOC_BLOCKS(mp));
INT_SET(arec->ar_blockcount, ARCH_CONVERT,
agsize - INT_GET(arec->ar_startblock, ARCH_CONVERT));
arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp));
arec->ar_blockcount = cpu_to_be32(
agsize - be32_to_cpu(arec->ar_startblock));
error = xfs_bwrite(mp, bp);
if (error) {
goto error0;
......@@ -273,18 +269,17 @@ xfs_growfs_data_private(
BTOBB(mp->m_sb.sb_blocksize), 0);
block = XFS_BUF_TO_SBLOCK(bp);
memset(block, 0, mp->m_sb.sb_blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_ABTC_MAGIC);
block->bb_magic = cpu_to_be32(XFS_ABTC_MAGIC);
block->bb_level = 0;
INT_SET(block->bb_numrecs, ARCH_CONVERT, 1);
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
block->bb_numrecs = cpu_to_be16(1);
block->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
block->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
arec = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_alloc,
block, 1, mp->m_alloc_mxr[0]);
INT_SET(arec->ar_startblock, ARCH_CONVERT,
XFS_PREALLOC_BLOCKS(mp));
INT_SET(arec->ar_blockcount, ARCH_CONVERT,
agsize - INT_GET(arec->ar_startblock, ARCH_CONVERT));
nfree += INT_GET(arec->ar_blockcount, ARCH_CONVERT);
arec->ar_startblock = cpu_to_be32(XFS_PREALLOC_BLOCKS(mp));
arec->ar_blockcount = cpu_to_be32(
agsize - be32_to_cpu(arec->ar_startblock));
nfree += be32_to_cpu(arec->ar_blockcount);
error = xfs_bwrite(mp, bp);
if (error) {
goto error0;
......@@ -297,11 +292,11 @@ xfs_growfs_data_private(
BTOBB(mp->m_sb.sb_blocksize), 0);
block = XFS_BUF_TO_SBLOCK(bp);
memset(block, 0, mp->m_sb.sb_blocksize);
INT_SET(block->bb_magic, ARCH_CONVERT, XFS_IBT_MAGIC);
block->bb_magic = cpu_to_be32(XFS_IBT_MAGIC);
block->bb_level = 0;
block->bb_numrecs = 0;
INT_SET(block->bb_leftsib, ARCH_CONVERT, NULLAGBLOCK);
INT_SET(block->bb_rightsib, ARCH_CONVERT, NULLAGBLOCK);
block->bb_leftsib = cpu_to_be32(NULLAGBLOCK);
block->bb_rightsib = cpu_to_be32(NULLAGBLOCK);
error = xfs_bwrite(mp, bp);
if (error) {
goto error0;
......@@ -321,10 +316,9 @@ xfs_growfs_data_private(
}
ASSERT(bp);
agi = XFS_BUF_TO_AGI(bp);
INT_MOD(agi->agi_length, ARCH_CONVERT, new);
be32_add(&agi->agi_length, new);
ASSERT(nagcount == oagcount ||
INT_GET(agi->agi_length, ARCH_CONVERT) ==
mp->m_sb.sb_agblocks);
be32_to_cpu(agi->agi_length) == mp->m_sb.sb_agblocks);
xfs_ialloc_log_agi(tp, bp, XFS_AGI_LENGTH);
/*
* Change agf length.
......@@ -335,14 +329,14 @@ xfs_growfs_data_private(
}
ASSERT(bp);
agf = XFS_BUF_TO_AGF(bp);
INT_MOD(agf->agf_length, ARCH_CONVERT, new);
ASSERT(INT_GET(agf->agf_length, ARCH_CONVERT) ==
INT_GET(agi->agi_length, ARCH_CONVERT));
be32_add(&agf->agf_length, new);
ASSERT(be32_to_cpu(agf->agf_length) ==
be32_to_cpu(agi->agi_length));
/*
* Free the new space.
*/
error = xfs_free_extent(tp, XFS_AGB_TO_FSB(mp, agno,
INT_GET(agf->agf_length, ARCH_CONVERT) - new), new);
be32_to_cpu(agf->agf_length) - new), new);
if (error) {
goto error0;
}
......
......@@ -178,8 +178,8 @@ xfs_ialloc_ag_alloc(
* Ideally they should be spaced out through the a.g.
* For now, just allocate blocks up front.
*/
args.agbno = INT_GET(agi->agi_root, ARCH_CONVERT);
args.fsbno = XFS_AGB_TO_FSB(args.mp, INT_GET(agi->agi_seqno, ARCH_CONVERT),
args.agbno = be32_to_cpu(agi->agi_root);
args.fsbno = XFS_AGB_TO_FSB(args.mp, be32_to_cpu(agi->agi_seqno),
args.agbno);
/*
* Allocate a fixed-size extent of inodes.
......@@ -201,9 +201,9 @@ xfs_ialloc_ag_alloc(
*/
if (isaligned && args.fsbno == NULLFSBLOCK) {
args.type = XFS_ALLOCTYPE_NEAR_BNO;
args.agbno = INT_GET(agi->agi_root, ARCH_CONVERT);
args.agbno = be32_to_cpu(agi->agi_root);
args.fsbno = XFS_AGB_TO_FSB(args.mp,
INT_GET(agi->agi_seqno, ARCH_CONVERT), args.agbno);
be32_to_cpu(agi->agi_seqno), args.agbno);
if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) &&
args.mp->m_sb.sb_inoalignmt >=
XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp)))
......@@ -258,7 +258,7 @@ xfs_ialloc_ag_alloc(
/*
* Get the block.
*/
d = XFS_AGB_TO_DADDR(args.mp, INT_GET(agi->agi_seqno, ARCH_CONVERT),
d = XFS_AGB_TO_DADDR(args.mp, be32_to_cpu(agi->agi_seqno),
args.agbno + (j * blks_per_cluster));
fbuf = xfs_trans_get_buf(tp, args.mp->m_ddev_targp, d,
args.mp->m_bsize * blks_per_cluster,
......@@ -278,17 +278,17 @@ xfs_ialloc_ag_alloc(
}
xfs_trans_inode_alloc_buf(tp, fbuf);
}
INT_MOD(agi->agi_count, ARCH_CONVERT, newlen);
INT_MOD(agi->agi_freecount, ARCH_CONVERT, newlen);
be32_add(&agi->agi_count, newlen);
be32_add(&agi->agi_freecount, newlen);
down_read(&args.mp->m_peraglock);
args.mp->m_perag[INT_GET(agi->agi_seqno, ARCH_CONVERT)].pagi_freecount += newlen;
args.mp->m_perag[be32_to_cpu(agi->agi_seqno)].pagi_freecount += newlen;
up_read(&args.mp->m_peraglock);
INT_SET(agi->agi_newino, ARCH_CONVERT, newino);
agi->agi_newino = cpu_to_be32(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),
be32_to_cpu(agi->agi_seqno),
XFS_BTNUM_INO, (xfs_inode_t *)0, 0);
for (thisino = newino;
thisino < newino + newlen;
......@@ -528,7 +528,7 @@ xfs_dialloc(
return 0;
}
agi = XFS_BUF_TO_AGI(agbp);
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC);
} else {
/*
* Continue where we left off before. In this case, we
......@@ -536,12 +536,12 @@ xfs_dialloc(
*/
agbp = *IO_agbp;
agi = XFS_BUF_TO_AGI(agbp);
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
ASSERT(INT_GET(agi->agi_freecount, ARCH_CONVERT) > 0);
ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC);
ASSERT(be32_to_cpu(agi->agi_freecount) > 0);
}
mp = tp->t_mountp;
agcount = mp->m_sb.sb_agcount;
agno = INT_GET(agi->agi_seqno, ARCH_CONVERT);
agno = be32_to_cpu(agi->agi_seqno);
tagno = agno;
pagno = XFS_INO_TO_AGNO(mp, parent);
pagino = XFS_INO_TO_AGINO(mp, parent);
......@@ -589,7 +589,7 @@ xfs_dialloc(
* can commit the current transaction and call
* us again where we left off.
*/
ASSERT(INT_GET(agi->agi_freecount, ARCH_CONVERT) > 0);
ASSERT(be32_to_cpu(agi->agi_freecount) > 0);
*alloc_done = B_TRUE;
*IO_agbp = agbp;
*inop = NULLFSINO;
......@@ -620,7 +620,7 @@ xfs_dialloc(
if (error)
goto nextag;
agi = XFS_BUF_TO_AGI(agbp);
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC);
}
/*
* Here with an allocation group that has a free inode.
......@@ -629,14 +629,14 @@ xfs_dialloc(
*/
agno = tagno;
*IO_agbp = NULL;
cur = xfs_btree_init_cursor(mp, tp, agbp, INT_GET(agi->agi_seqno, ARCH_CONVERT),
cur = xfs_btree_init_cursor(mp, tp, agbp, be32_to_cpu(agi->agi_seqno),
XFS_BTNUM_INO, (xfs_inode_t *)0, 0);
/*
* If pagino is 0 (this is the root inode allocation) use newino.
* This must work because we've just allocated some.
*/
if (!pagino)
pagino = INT_GET(agi->agi_newino, ARCH_CONVERT);
pagino = be32_to_cpu(agi->agi_newino);
#ifdef DEBUG
if (cur->bc_nlevels == 1) {
int freecount = 0;
......@@ -654,7 +654,7 @@ xfs_dialloc(
goto error0;
} while (i == 1);
ASSERT(freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT) ||
ASSERT(freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
}
#endif
......@@ -813,9 +813,9 @@ xfs_dialloc(
* In a different a.g. from the parent.
* See if the most recently allocated block has any free.
*/
else if (INT_GET(agi->agi_newino, ARCH_CONVERT) != NULLAGINO) {
else if (be32_to_cpu(agi->agi_newino) != NULLAGINO) {
if ((error = xfs_inobt_lookup_eq(cur,
INT_GET(agi->agi_newino, ARCH_CONVERT), 0, 0, &i)))
be32_to_cpu(agi->agi_newino), 0, 0, &i)))
goto error0;
if (i == 1 &&
(error = xfs_inobt_get_rec(cur, &rec.ir_startino,
......@@ -862,7 +862,7 @@ xfs_dialloc(
if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
rec.ir_free)))
goto error0;
INT_MOD(agi->agi_freecount, ARCH_CONVERT, -1);
be32_add(&agi->agi_freecount, -1);
xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
down_read(&mp->m_peraglock);
mp->m_perag[tagno].pagi_freecount--;
......@@ -882,7 +882,7 @@ xfs_dialloc(
if ((error = xfs_inobt_increment(cur, 0, &i)))
goto error0;
} while (i == 1);
ASSERT(freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT) ||
ASSERT(freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
}
#endif
......@@ -970,8 +970,8 @@ xfs_difree(
return error;
}
agi = XFS_BUF_TO_AGI(agbp);
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
ASSERT(agbno < INT_GET(agi->agi_length, ARCH_CONVERT));
ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC);
ASSERT(agbno < be32_to_cpu(agi->agi_length));
/*
* Initialize the cursor.
*/
......@@ -993,7 +993,7 @@ xfs_difree(
goto error0;
}
} while (i == 1);
ASSERT(freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT) ||
ASSERT(freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
}
#endif
......@@ -1042,8 +1042,8 @@ xfs_difree(
* to be freed when the transaction is committed.
*/
ilen = XFS_IALLOC_INODES(mp);
INT_MOD(agi->agi_count, ARCH_CONVERT, -ilen);
INT_MOD(agi->agi_freecount, ARCH_CONVERT, -(ilen - 1));
be32_add(&agi->agi_count, -ilen);
be32_add(&agi->agi_freecount, -(ilen - 1));
xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
down_read(&mp->m_peraglock);
mp->m_perag[agno].pagi_freecount -= ilen - 1;
......@@ -1072,7 +1072,7 @@ xfs_difree(
/*
* Change the inode free counts and log the ag/sb changes.
*/
INT_MOD(agi->agi_freecount, ARCH_CONVERT, 1);
be32_add(&agi->agi_freecount, 1);
xfs_ialloc_log_agi(tp, agbp, XFS_AGI_FREECOUNT);
down_read(&mp->m_peraglock);
mp->m_perag[agno].pagi_freecount++;
......@@ -1098,7 +1098,7 @@ xfs_difree(
goto error0;
}
} while (i == 1);
ASSERT(freecount == INT_GET(agi->agi_freecount, ARCH_CONVERT) ||
ASSERT(freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
}
#endif
......@@ -1307,7 +1307,7 @@ xfs_ialloc_log_agi(
xfs_agi_t *agi; /* allocation group header */
agi = XFS_BUF_TO_AGI(bp);
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
ASSERT(be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC);
#endif
/*
* Compute byte offsets for the first and last fields.
......@@ -1349,9 +1349,8 @@ xfs_ialloc_read_agi(
*/
agi = XFS_BUF_TO_AGI(bp);
agi_ok =
INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(
INT_GET(agi->agi_versionnum, ARCH_CONVERT));
be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum));
if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IALLOC_READ_AGI,
XFS_RANDOM_IALLOC_READ_AGI))) {
XFS_CORRUPTION_ERROR("xfs_ialloc_read_agi", XFS_ERRLEVEL_LOW,
......@@ -1361,16 +1360,15 @@ 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_freecount = be32_to_cpu(agi->agi_freecount);
pag->pagi_init = 1;
} else {
/*
* It's possible for these to be out of sync if
* we are in the middle of a forced shutdown.
*/
ASSERT(pag->pagi_freecount ==
INT_GET(agi->agi_freecount, ARCH_CONVERT)
|| XFS_FORCED_SHUTDOWN(mp));
ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
}
#ifdef DEBUG
......
This diff is collapsed.
......@@ -62,8 +62,10 @@ typedef struct xfs_inobt_key
xfs_agino_t ir_startino; /* starting inode number */
} xfs_inobt_key_t;
typedef xfs_agblock_t xfs_inobt_ptr_t; /* btree pointer type */
/* btree block header type */
/* btree pointer type */
typedef __be32 xfs_inobt_ptr_t;
/* btree block header type */
typedef struct xfs_btree_sblock xfs_inobt_block_t;
#define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)XFS_BUF_PTR(bp))
......@@ -86,7 +88,7 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
#define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0])
#define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0])
#define XFS_INOBT_IS_LAST_REC(cur) \
((cur)->bc_ptrs[0] == INT_GET(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs, ARCH_CONVERT))
((cur)->bc_ptrs[0] == be16_to_cpu(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs))
/*
* Maximum number of inode btree levels.
......
......@@ -1864,8 +1864,8 @@ xfs_iunlink(
*/
agi = XFS_BUF_TO_AGI(agibp);
agi_ok =
INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(INT_GET(agi->agi_versionnum, ARCH_CONVERT));
be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum));
if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IUNLINK,
XFS_RANDOM_IUNLINK))) {
XFS_CORRUPTION_ERROR("xfs_iunlink", XFS_ERRLEVEL_LOW, mp, agi);
......@@ -1880,9 +1880,9 @@ xfs_iunlink(
ASSERT(agino != 0);
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
ASSERT(agi->agi_unlinked[bucket_index]);
ASSERT(INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != agino);
ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != agino);
if (INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != NULLAGINO) {
if (be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO) {
/*
* There is already another inode in the bucket we need
* to add ourselves to. Add us at the front of the list.
......@@ -1909,7 +1909,7 @@ xfs_iunlink(
* Point the bucket head pointer at the inode being inserted.
*/
ASSERT(agino != 0);
INT_SET(agi->agi_unlinked[bucket_index], ARCH_CONVERT, agino);
agi->agi_unlinked[bucket_index] = cpu_to_be32(agino);
offset = offsetof(xfs_agi_t, agi_unlinked) +
(sizeof(xfs_agino_t) * bucket_index);
xfs_trans_log_buf(tp, agibp, offset,
......@@ -1967,8 +1967,8 @@ xfs_iunlink_remove(
*/
agi = XFS_BUF_TO_AGI(agibp);
agi_ok =
INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(INT_GET(agi->agi_versionnum, ARCH_CONVERT));
be32_to_cpu(agi->agi_magicnum) == XFS_AGI_MAGIC &&
XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum));
if (unlikely(XFS_TEST_ERROR(!agi_ok, mp, XFS_ERRTAG_IUNLINK_REMOVE,
XFS_RANDOM_IUNLINK_REMOVE))) {
XFS_CORRUPTION_ERROR("xfs_iunlink_remove", XFS_ERRLEVEL_LOW,
......@@ -1986,10 +1986,10 @@ xfs_iunlink_remove(
agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
ASSERT(agino != 0);
bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS;
ASSERT(INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) != NULLAGINO);
ASSERT(be32_to_cpu(agi->agi_unlinked[bucket_index]) != NULLAGINO);
ASSERT(agi->agi_unlinked[bucket_index]);
if (INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT) == agino) {
if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) {
/*
* We're at the head of the list. Get the inode's
* on-disk buffer to see if there is anyone after us
......@@ -2023,7 +2023,7 @@ xfs_iunlink_remove(
*/
ASSERT(next_agino != 0);
ASSERT(next_agino != agino);
INT_SET(agi->agi_unlinked[bucket_index], ARCH_CONVERT, next_agino);
agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
offset = offsetof(xfs_agi_t, agi_unlinked) +
(sizeof(xfs_agino_t) * bucket_index);
xfs_trans_log_buf(tp, agibp, offset,
......@@ -2032,7 +2032,7 @@ xfs_iunlink_remove(
/*
* We need to search the list for the inode being freed.
*/
next_agino = INT_GET(agi->agi_unlinked[bucket_index], ARCH_CONVERT);
next_agino = be32_to_cpu(agi->agi_unlinked[bucket_index]);
last_ibp = NULL;
while (next_agino != agino) {
/*
......
......@@ -448,7 +448,7 @@ xfs_bulkstat(
while (error) {
agino += XFS_INODES_PER_CHUNK;
if (XFS_AGINO_TO_AGBNO(mp, agino) >=
INT_GET(agi->agi_length, ARCH_CONVERT))
be32_to_cpu(agi->agi_length))
break;
error = xfs_inobt_lookup_ge(cur, agino, 0, 0,
&tmp);
......
......@@ -3160,13 +3160,12 @@ xlog_recover_clear_agi_bucket(
}
agi = XFS_BUF_TO_AGI(agibp);
if (INT_GET(agi->agi_magicnum, ARCH_CONVERT) != XFS_AGI_MAGIC) {
if (be32_to_cpu(agi->agi_magicnum) != XFS_AGI_MAGIC) {
xfs_trans_cancel(tp, XFS_TRANS_ABORT);
return;
}
ASSERT(INT_GET(agi->agi_magicnum, ARCH_CONVERT) == XFS_AGI_MAGIC);
INT_SET(agi->agi_unlinked[bucket], ARCH_CONVERT, NULLAGINO);
agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
offset = offsetof(xfs_agi_t, agi_unlinked) +
(sizeof(xfs_agino_t) * bucket);
xfs_trans_log_buf(tp, agibp, offset,
......@@ -3225,12 +3224,11 @@ xlog_recover_process_iunlinks(
XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)));
}
agi = XFS_BUF_TO_AGI(agibp);
ASSERT(XFS_AGI_MAGIC ==
INT_GET(agi->agi_magicnum, ARCH_CONVERT));
ASSERT(XFS_AGI_MAGIC == be32_to_cpu(agi->agi_magicnum));
for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++) {
agino = INT_GET(agi->agi_unlinked[bucket], ARCH_CONVERT);
agino = be32_to_cpu(agi->agi_unlinked[bucket]);
while (agino != NULLAGINO) {
/*
......@@ -3318,8 +3316,8 @@ xlog_recover_process_iunlinks(
XFS_AGI_DADDR(mp)));
}
agi = XFS_BUF_TO_AGI(agibp);
ASSERT(XFS_AGI_MAGIC == INT_GET(
agi->agi_magicnum, ARCH_CONVERT));
ASSERT(XFS_AGI_MAGIC == be32_to_cpu(
agi->agi_magicnum));
}
}
......@@ -4022,14 +4020,12 @@ xlog_recover_check_summary(
mp, agfbp, agfdaddr);
}
agfp = XFS_BUF_TO_AGF(agfbp);
ASSERT(XFS_AGF_MAGIC ==
INT_GET(agfp->agf_magicnum, ARCH_CONVERT));
ASSERT(XFS_AGF_GOOD_VERSION(
INT_GET(agfp->agf_versionnum, ARCH_CONVERT)));
ASSERT(INT_GET(agfp->agf_seqno, ARCH_CONVERT) == agno);
freeblks += INT_GET(agfp->agf_freeblks, ARCH_CONVERT) +
INT_GET(agfp->agf_flcount, ARCH_CONVERT);
ASSERT(XFS_AGF_MAGIC == be32_to_cpu(agfp->agf_magicnum));
ASSERT(XFS_AGF_GOOD_VERSION(be32_to_cpu(agfp->agf_versionnum)));
ASSERT(be32_to_cpu(agfp->agf_seqno) == agno);
freeblks += be32_to_cpu(agfp->agf_freeblks) +
be32_to_cpu(agfp->agf_flcount);
xfs_buf_relse(agfbp);
agidaddr = XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp));
......@@ -4040,14 +4036,12 @@ xlog_recover_check_summary(
mp, agibp, agidaddr);
}
agip = XFS_BUF_TO_AGI(agibp);
ASSERT(XFS_AGI_MAGIC ==
INT_GET(agip->agi_magicnum, ARCH_CONVERT));
ASSERT(XFS_AGI_GOOD_VERSION(
INT_GET(agip->agi_versionnum, ARCH_CONVERT)));
ASSERT(INT_GET(agip->agi_seqno, ARCH_CONVERT) == agno);
itotal += INT_GET(agip->agi_count, ARCH_CONVERT);
ifree += INT_GET(agip->agi_freecount, ARCH_CONVERT);
ASSERT(XFS_AGI_MAGIC == be32_to_cpu(agip->agi_magicnum));
ASSERT(XFS_AGI_GOOD_VERSION(be32_to_cpu(agip->agi_versionnum)));
ASSERT(be32_to_cpu(agip->agi_seqno) == agno);
itotal += be32_to_cpu(agip->agi_count);
ifree += be32_to_cpu(agip->agi_freecount);
xfs_buf_relse(agibp);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment