Commit 61a25848 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tim Shimmin
Browse files

[XFS] endianess annotations for xfs_inobt_rec_t / xfs_inobt_key_t



SGI-PV: 954580
SGI-Modid: xfs-linux-melb:xfs-kern:26556a

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
parent e2101005
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ xfs_btree_check_key(

		k1 = ak1;
		k2 = ak2;
		ASSERT(INT_GET(k1->ir_startino, ARCH_CONVERT) < INT_GET(k2->ir_startino, ARCH_CONVERT));
		ASSERT(be32_to_cpu(k1->ir_startino) < be32_to_cpu(k2->ir_startino));
		break;
	    }
	default:
@@ -285,8 +285,8 @@ xfs_btree_check_rec(

		r1 = ar1;
		r2 = ar2;
		ASSERT(INT_GET(r1->ir_startino, ARCH_CONVERT) + XFS_INODES_PER_CHUNK <=
		       INT_GET(r2->ir_startino, ARCH_CONVERT));
		ASSERT(be32_to_cpu(r1->ir_startino) + XFS_INODES_PER_CHUNK <=
		       be32_to_cpu(r2->ir_startino));
		break;
	    }
	default:
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ typedef struct xfs_btree_cur
	union {
		xfs_alloc_rec_incore_t	a;
		xfs_bmbt_irec_t		b;
		xfs_inobt_rec_t		i;
		xfs_inobt_rec_incore_t	i;
	}		bc_rec;		/* current insert/search record value */
	struct xfs_buf	*bc_bufs[XFS_BTREE_MAXLEVELS];	/* buf ptr per level */
	int		bc_ptrs[XFS_BTREE_MAXLEVELS];	/* key/record # */
+3 −3
Original line number Diff line number Diff line
@@ -529,10 +529,10 @@ xfs_dialloc(
	int		offset;		/* index of inode in chunk */
	xfs_agino_t	pagino;		/* parent's a.g. relative inode # */
	xfs_agnumber_t	pagno;		/* parent's allocation group number */
	xfs_inobt_rec_t	rec;		/* inode allocation record */
	xfs_inobt_rec_incore_t rec;	/* inode allocation record */
	xfs_agnumber_t	tagno;		/* testing allocation group number */
	xfs_btree_cur_t	*tcur;		/* temp cursor */
	xfs_inobt_rec_t	trec;		/* temp inode allocation record */
	xfs_inobt_rec_incore_t trec;	/* temp inode allocation record */


	if (*IO_agbp == NULL) {
@@ -945,7 +945,7 @@ xfs_difree(
	int		ilen;	/* inodes in an inode cluster */
	xfs_mount_t	*mp;	/* mount structure for filesystem */
	int		off;	/* offset of inode in inode chunk */
	xfs_inobt_rec_t	rec;	/* btree record */
	xfs_inobt_rec_incore_t rec;	/* btree record */

	mp = tp->t_mountp;

+19 −19
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ xfs_inobt_insrec(
	/*
	 * Make a key out of the record data to be inserted, and save it.
	 */
	key.ir_startino = recp->ir_startino; /* INT_: direct copy */
	key.ir_startino = recp->ir_startino;
	optr = ptr = cur->bc_ptrs[level];
	/*
	 * If we're off the left edge, return failure.
@@ -641,7 +641,7 @@ xfs_inobt_insrec(
						return error;
#endif
					ptr = cur->bc_ptrs[level];
					nrec.ir_startino = nkey.ir_startino; /* INT_: direct copy */
					nrec.ir_startino = nkey.ir_startino;
				} else {
					/*
					 * Otherwise the insert fails.
@@ -950,12 +950,12 @@ xfs_inobt_lookup(
					xfs_inobt_key_t	*kkp;

					kkp = kkbase + keyno - 1;
					startino = INT_GET(kkp->ir_startino, ARCH_CONVERT);
					startino = be32_to_cpu(kkp->ir_startino);
				} else {
					xfs_inobt_rec_t	*krp;

					krp = krbase + keyno - 1;
					startino = INT_GET(krp->ir_startino, ARCH_CONVERT);
					startino = be32_to_cpu(krp->ir_startino);
				}
				/*
				 * Compute difference to get next direction.
@@ -1160,7 +1160,7 @@ xfs_inobt_lshift(
	} else {
		memmove(rrp, rrp + 1, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
		xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
		key.ir_startino = rrp->ir_startino; /* INT_: direct copy */
		key.ir_startino = rrp->ir_startino;
		rkp = &key;
	}
	/*
@@ -1301,9 +1301,9 @@ xfs_inobt_newroot(
		kp[1] = *XFS_INOBT_KEY_ADDR(right, 1, cur); /* INT_: struct copy */
	} else {
		rp = XFS_INOBT_REC_ADDR(left, 1, cur);
		INT_COPY(kp[0].ir_startino, rp->ir_startino, ARCH_CONVERT);
		kp[0].ir_startino = rp->ir_startino;
		rp = XFS_INOBT_REC_ADDR(right, 1, cur);
		INT_COPY(kp[1].ir_startino, rp->ir_startino, ARCH_CONVERT);
		kp[1].ir_startino = rp->ir_startino;
	}
	xfs_inobt_log_keys(cur, nbp, 1, 2);
	/*
@@ -1420,7 +1420,7 @@ xfs_inobt_rshift(
		memmove(rrp + 1, rrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
		*rrp = *lrp;
		xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs) + 1);
		key.ir_startino = rrp->ir_startino; /* INT_: direct copy */
		key.ir_startino = rrp->ir_startino;
		rkp = &key;
	}
	/*
@@ -1559,7 +1559,7 @@ xfs_inobt_split(
		rrp = XFS_INOBT_REC_ADDR(right, 1, cur);
		memcpy(rrp, lrp, be16_to_cpu(right->bb_numrecs) * sizeof(*rrp));
		xfs_inobt_log_recs(cur, rbp, 1, be16_to_cpu(right->bb_numrecs));
		keyp->ir_startino = rrp->ir_startino; /* INT_: direct copy */
		keyp->ir_startino = rrp->ir_startino;
	}
	/*
	 * Find the left block number by looking in the buffer.
@@ -1813,9 +1813,9 @@ xfs_inobt_get_rec(
	 * Point to the record and extract its data.
	 */
	rec = XFS_INOBT_REC_ADDR(block, ptr, cur);
	*ino = INT_GET(rec->ir_startino, ARCH_CONVERT);
	*fcnt = INT_GET(rec->ir_freecount, ARCH_CONVERT);
	*free = INT_GET(rec->ir_free, ARCH_CONVERT);
	*ino = be32_to_cpu(rec->ir_startino);
	*fcnt = be32_to_cpu(rec->ir_freecount);
	*free = be64_to_cpu(rec->ir_free);
	*stat = 1;
	return 0;
}
@@ -1930,9 +1930,9 @@ xfs_inobt_insert(

	level = 0;
	nbno = NULLAGBLOCK;
	INT_SET(nrec.ir_startino, ARCH_CONVERT, cur->bc_rec.i.ir_startino);
	INT_SET(nrec.ir_freecount, ARCH_CONVERT, cur->bc_rec.i.ir_freecount);
	INT_SET(nrec.ir_free, ARCH_CONVERT, cur->bc_rec.i.ir_free);
	nrec.ir_startino = cpu_to_be32(cur->bc_rec.i.ir_startino);
	nrec.ir_freecount = cpu_to_be32(cur->bc_rec.i.ir_freecount);
	nrec.ir_free = cpu_to_be64(cur->bc_rec.i.ir_free);
	ncur = (xfs_btree_cur_t *)0;
	pcur = cur;
	/*
@@ -2060,9 +2060,9 @@ xfs_inobt_update(
	/*
	 * Fill in the new contents and log them.
	 */
	INT_SET(rp->ir_startino, ARCH_CONVERT, ino);
	INT_SET(rp->ir_freecount, ARCH_CONVERT, fcnt);
	INT_SET(rp->ir_free, ARCH_CONVERT, free);
	rp->ir_startino = cpu_to_be32(ino);
	rp->ir_freecount = cpu_to_be32(fcnt);
	rp->ir_free = cpu_to_be64(free);
	xfs_inobt_log_recs(cur, bp, ptr, ptr);
	/*
	 * Updating first record in leaf. Pass new key value up to our parent.
@@ -2070,7 +2070,7 @@ xfs_inobt_update(
	if (ptr == 1) {
		xfs_inobt_key_t	key;	/* key containing [ino] */

		INT_SET(key.ir_startino, ARCH_CONVERT, ino);
		key.ir_startino = cpu_to_be32(ino);
		if ((error = xfs_inobt_updkey(cur, &key, 1)))
			return error;
	}
+12 −7
Original line number Diff line number Diff line
@@ -47,19 +47,24 @@ static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
/*
 * Data record structure
 */
typedef struct xfs_inobt_rec
{
typedef struct xfs_inobt_rec {
	__be32		ir_startino;	/* starting inode number */
	__be32		ir_freecount;	/* count of free inodes (set bits) */
	__be64		ir_free;	/* free inode mask */
} xfs_inobt_rec_t;

typedef struct xfs_inobt_rec_incore {
	xfs_agino_t	ir_startino;	/* starting inode number */
	__int32_t	ir_freecount;	/* count of free inodes (set bits) */
	xfs_inofree_t	ir_free;	/* free inode mask */
} xfs_inobt_rec_t;
} xfs_inobt_rec_incore_t;


/*
 * Key structure
 */
typedef struct xfs_inobt_key
{
	xfs_agino_t	ir_startino;	/* starting inode number */
typedef struct xfs_inobt_key {
	__be32		ir_startino;	/* starting inode number */
} xfs_inobt_key_t;

/* btree pointer type */
@@ -77,7 +82,7 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
#define	XFS_INOBT_IS_FREE(rp,i)		\
		(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
#define	XFS_INOBT_IS_FREE_DISK(rp,i)	\
		((INT_GET((rp)->ir_free,ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0)
		((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
#define	XFS_INOBT_SET_FREE(rp,i)	((rp)->ir_free |= XFS_INOBT_MASK(i))
#define	XFS_INOBT_CLR_FREE(rp,i)	((rp)->ir_free &= ~XFS_INOBT_MASK(i))

Loading