[XFS] endianess annotations for xfs_dir2_leaf_tail_t
SGI-PV: 943272 SGI-Modid: xfs-linux-melb:xfs-kern:25487a Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
parent
68b3a1024a
commit
afbcb3f919
@ -914,11 +914,11 @@ xfs_dir2_leaf_to_block(
|
||||
*/
|
||||
while (dp->i_d.di_size > mp->m_dirblksize) {
|
||||
bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
|
||||
if (be16_to_cpu(bestsp[INT_GET(ltp->bestcount, ARCH_CONVERT) - 1]) ==
|
||||
if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) ==
|
||||
mp->m_dirblksize - (uint)sizeof(block->hdr)) {
|
||||
if ((error =
|
||||
xfs_dir2_leaf_trim_data(args, lbp,
|
||||
(xfs_dir2_db_t)(INT_GET(ltp->bestcount, ARCH_CONVERT) - 1))))
|
||||
(xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1))))
|
||||
goto out;
|
||||
} else {
|
||||
error = 0;
|
||||
|
@ -141,7 +141,7 @@ xfs_dir2_block_to_leaf(
|
||||
* Set up leaf tail and bests table.
|
||||
*/
|
||||
ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
|
||||
INT_SET(ltp->bestcount, ARCH_CONVERT, 1);
|
||||
ltp->bestcount = cpu_to_be32(1);
|
||||
bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
|
||||
bestsp[0] = block->hdr.bestfree[0].length;
|
||||
/*
|
||||
@ -227,7 +227,7 @@ xfs_dir2_leaf_addname(
|
||||
if (INT_GET(lep->address, ARCH_CONVERT) == XFS_DIR2_NULL_DATAPTR)
|
||||
continue;
|
||||
i = XFS_DIR2_DATAPTR_TO_DB(mp, INT_GET(lep->address, ARCH_CONVERT));
|
||||
ASSERT(i < INT_GET(ltp->bestcount, ARCH_CONVERT));
|
||||
ASSERT(i < be32_to_cpu(ltp->bestcount));
|
||||
ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF);
|
||||
if (be16_to_cpu(bestsp[i]) >= length) {
|
||||
use_block = i;
|
||||
@ -238,7 +238,7 @@ xfs_dir2_leaf_addname(
|
||||
* Didn't find a block yet, linear search all the data blocks.
|
||||
*/
|
||||
if (use_block == -1) {
|
||||
for (i = 0; i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++) {
|
||||
for (i = 0; i < be32_to_cpu(ltp->bestcount); i++) {
|
||||
/*
|
||||
* Remember a block we see that's missing.
|
||||
*/
|
||||
@ -358,13 +358,13 @@ xfs_dir2_leaf_addname(
|
||||
* If we're adding a new data block on the end we need to
|
||||
* extend the bests table. Copy it up one entry.
|
||||
*/
|
||||
if (use_block >= INT_GET(ltp->bestcount, ARCH_CONVERT)) {
|
||||
if (use_block >= be32_to_cpu(ltp->bestcount)) {
|
||||
bestsp--;
|
||||
memmove(&bestsp[0], &bestsp[1],
|
||||
INT_GET(ltp->bestcount, ARCH_CONVERT) * sizeof(bestsp[0]));
|
||||
INT_MOD(ltp->bestcount, ARCH_CONVERT, +1);
|
||||
be32_to_cpu(ltp->bestcount) * sizeof(bestsp[0]));
|
||||
be32_add(<p->bestcount, 1);
|
||||
xfs_dir2_leaf_log_tail(tp, lbp);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
|
||||
}
|
||||
/*
|
||||
* If we're filling in a previously empty block just log it.
|
||||
@ -1537,7 +1537,7 @@ xfs_dir2_leaf_removename(
|
||||
* If this is the last data block then compact the
|
||||
* bests table by getting rid of entries.
|
||||
*/
|
||||
if (db == INT_GET(ltp->bestcount, ARCH_CONVERT) - 1) {
|
||||
if (db == be32_to_cpu(ltp->bestcount) - 1) {
|
||||
/*
|
||||
* Look for the last active entry (i).
|
||||
*/
|
||||
@ -1550,10 +1550,10 @@ xfs_dir2_leaf_removename(
|
||||
* end are removed.
|
||||
*/
|
||||
memmove(&bestsp[db - i], bestsp,
|
||||
(INT_GET(ltp->bestcount, ARCH_CONVERT) - (db - i)) * sizeof(*bestsp));
|
||||
INT_MOD(ltp->bestcount, ARCH_CONVERT, -(db - i));
|
||||
(be32_to_cpu(ltp->bestcount) - (db - i)) * sizeof(*bestsp));
|
||||
be32_add(<p->bestcount, -(db - i));
|
||||
xfs_dir2_leaf_log_tail(tp, lbp);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
|
||||
} else
|
||||
bestsp[db] = cpu_to_be16(NULLDATAOFF);
|
||||
}
|
||||
@ -1719,7 +1719,7 @@ xfs_dir2_leaf_trim_data(
|
||||
ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
|
||||
ASSERT(be16_to_cpu(data->hdr.bestfree[0].length) ==
|
||||
mp->m_dirblksize - (uint)sizeof(data->hdr));
|
||||
ASSERT(db == INT_GET(ltp->bestcount, ARCH_CONVERT) - 1);
|
||||
ASSERT(db == be32_to_cpu(ltp->bestcount) - 1);
|
||||
/*
|
||||
* Get rid of the data block.
|
||||
*/
|
||||
@ -1732,10 +1732,10 @@ xfs_dir2_leaf_trim_data(
|
||||
* Eliminate the last bests entry from the table.
|
||||
*/
|
||||
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));
|
||||
be32_add(<p->bestcount, -1);
|
||||
memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
|
||||
xfs_dir2_leaf_log_tail(tp, lbp);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, INT_GET(ltp->bestcount, ARCH_CONVERT) - 1);
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1848,8 +1848,8 @@ xfs_dir2_node_to_leaf(
|
||||
* Set up the leaf bests table.
|
||||
*/
|
||||
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);
|
||||
be32_to_cpu(ltp->bestcount) * sizeof(leaf->bests[0]));
|
||||
xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
|
||||
xfs_dir2_leaf_log_tail(tp, lbp);
|
||||
xfs_dir2_leaf_check(dp, lbp);
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@ typedef struct xfs_dir2_leaf_entry {
|
||||
* Leaf block tail.
|
||||
*/
|
||||
typedef struct xfs_dir2_leaf_tail {
|
||||
__uint32_t bestcount;
|
||||
__be32 bestcount;
|
||||
} xfs_dir2_leaf_tail_t;
|
||||
|
||||
/*
|
||||
@ -108,7 +108,7 @@ xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp)
|
||||
static inline __be16 *
|
||||
xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp)
|
||||
{
|
||||
return (__be16 *)(ltp) - INT_GET((ltp)->bestcount, ARCH_CONVERT);
|
||||
return (__be16 *)ltp - be32_to_cpu(ltp->bestcount);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -151,14 +151,14 @@ xfs_dir2_leaf_to_node(
|
||||
*/
|
||||
free->hdr.magic = cpu_to_be32(XFS_DIR2_FREE_MAGIC);
|
||||
free->hdr.firstdb = 0;
|
||||
ASSERT(INT_GET(ltp->bestcount, ARCH_CONVERT) <= (uint)dp->i_d.di_size / mp->m_dirblksize);
|
||||
ASSERT(be32_to_cpu(ltp->bestcount) <= (uint)dp->i_d.di_size / mp->m_dirblksize);
|
||||
free->hdr.nvalid = ltp->bestcount;
|
||||
/*
|
||||
* Copy freespace entries from the leaf block to the new block.
|
||||
* Count active entries.
|
||||
*/
|
||||
for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests;
|
||||
i < INT_GET(ltp->bestcount, ARCH_CONVERT); i++, from++, to++) {
|
||||
i < be32_to_cpu(ltp->bestcount); i++, from++, to++) {
|
||||
if ((off = be16_to_cpu(*from)) != NULLDATAOFF)
|
||||
n++;
|
||||
*to = cpu_to_be16(off);
|
||||
|
Loading…
Reference in New Issue
Block a user