aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_dir2_block.c26
-rw-r--r--fs/xfs/xfs_dir2_data.c10
-rw-r--r--fs/xfs/xfs_dir2_data.h7
-rw-r--r--fs/xfs/xfs_dir2_leaf.c6
-rw-r--r--fs/xfs/xfs_dir2_node.c6
5 files changed, 27 insertions, 28 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index fa372b2b433d..25d3a04f2e46 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -81,7 +81,7 @@ xfs_dir2_block_addname(
81 xfs_mount_t *mp; /* filesystem mount point */ 81 xfs_mount_t *mp; /* filesystem mount point */
82 int needlog; /* need to log header */ 82 int needlog; /* need to log header */
83 int needscan; /* need to rescan freespace */ 83 int needscan; /* need to rescan freespace */
84 xfs_dir2_data_off_t *tagp; /* pointer to tag value */ 84 __be16 *tagp; /* pointer to tag value */
85 xfs_trans_t *tp; /* transaction structure */ 85 xfs_trans_t *tp; /* transaction structure */
86 86
87 xfs_dir2_trace_args("block_addname", args); 87 xfs_dir2_trace_args("block_addname", args);
@@ -120,11 +120,11 @@ xfs_dir2_block_addname(
120 /* 120 /*
121 * Tag just before the first leaf entry. 121 * Tag just before the first leaf entry.
122 */ 122 */
123 tagp = (xfs_dir2_data_off_t *)blp - 1; 123 tagp = (__be16 *)blp - 1;
124 /* 124 /*
125 * Data object just before the first leaf entry. 125 * Data object just before the first leaf entry.
126 */ 126 */
127 enddup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); 127 enddup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
128 /* 128 /*
129 * If it's not free then can't do this add without cleaning up: 129 * If it's not free then can't do this add without cleaning up:
130 * the space before the first leaf entry needs to be free so it 130 * the space before the first leaf entry needs to be free so it
@@ -183,11 +183,11 @@ xfs_dir2_block_addname(
183 /* 183 /*
184 * Tag just before the first leaf entry. 184 * Tag just before the first leaf entry.
185 */ 185 */
186 tagp = (xfs_dir2_data_off_t *)blp - 1; 186 tagp = (__be16 *)blp - 1;
187 /* 187 /*
188 * Data object just before the first leaf entry. 188 * Data object just before the first leaf entry.
189 */ 189 */
190 dup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); 190 dup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
191 /* 191 /*
192 * If it's not free then the data will go where the 192 * If it's not free then the data will go where the
193 * leaf data starts now, if it works at all. 193 * leaf data starts now, if it works at all.
@@ -404,7 +404,7 @@ xfs_dir2_block_addname(
404 dep->namelen = args->namelen; 404 dep->namelen = args->namelen;
405 memcpy(dep->name, args->name, args->namelen); 405 memcpy(dep->name, args->name, args->namelen);
406 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 406 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
407 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); 407 *tagp = cpu_to_be16((char *)dep - (char *)block);
408 /* 408 /*
409 * Clean up the bestfree array and log the header, tail, and entry. 409 * Clean up the bestfree array and log the header, tail, and entry.
410 */ 410 */
@@ -896,7 +896,7 @@ xfs_dir2_leaf_to_block(
896 int needscan; /* need to scan for bestfree */ 896 int needscan; /* need to scan for bestfree */
897 xfs_dir2_sf_hdr_t sfh; /* shortform header */ 897 xfs_dir2_sf_hdr_t sfh; /* shortform header */
898 int size; /* bytes used */ 898 int size; /* bytes used */
899 xfs_dir2_data_off_t *tagp; /* end of entry (tag) */ 899 __be16 *tagp; /* end of entry (tag) */
900 int to; /* block/leaf to index */ 900 int to; /* block/leaf to index */
901 xfs_trans_t *tp; /* transaction pointer */ 901 xfs_trans_t *tp; /* transaction pointer */
902 902
@@ -944,8 +944,8 @@ xfs_dir2_leaf_to_block(
944 /* 944 /*
945 * Look at the last data entry. 945 * Look at the last data entry.
946 */ 946 */
947 tagp = (xfs_dir2_data_off_t *)((char *)block + mp->m_dirblksize) - 1; 947 tagp = (__be16 *)((char *)block + mp->m_dirblksize) - 1;
948 dup = (xfs_dir2_data_unused_t *)((char *)block + INT_GET(*tagp, ARCH_CONVERT)); 948 dup = (xfs_dir2_data_unused_t *)((char *)block + be16_to_cpu(*tagp));
949 /* 949 /*
950 * If it's not free or is too short we can't do it. 950 * If it's not free or is too short we can't do it.
951 */ 951 */
@@ -1044,7 +1044,7 @@ xfs_dir2_sf_to_block(
1044 int offset; /* target block offset */ 1044 int offset; /* target block offset */
1045 xfs_dir2_sf_entry_t *sfep; /* sf entry pointer */ 1045 xfs_dir2_sf_entry_t *sfep; /* sf entry pointer */
1046 xfs_dir2_sf_t *sfp; /* shortform structure */ 1046 xfs_dir2_sf_t *sfp; /* shortform structure */
1047 xfs_dir2_data_off_t *tagp; /* end of data entry */ 1047 __be16 *tagp; /* end of data entry */
1048 xfs_trans_t *tp; /* transaction pointer */ 1048 xfs_trans_t *tp; /* transaction pointer */
1049 1049
1050 xfs_dir2_trace_args("sf_to_block", args); 1050 xfs_dir2_trace_args("sf_to_block", args);
@@ -1134,7 +1134,7 @@ xfs_dir2_sf_to_block(
1134 dep->namelen = 1; 1134 dep->namelen = 1;
1135 dep->name[0] = '.'; 1135 dep->name[0] = '.';
1136 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 1136 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
1137 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); 1137 *tagp = cpu_to_be16((char *)dep - (char *)block);
1138 xfs_dir2_data_log_entry(tp, bp, dep); 1138 xfs_dir2_data_log_entry(tp, bp, dep);
1139 blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot); 1139 blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
1140 blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, 1140 blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
@@ -1148,7 +1148,7 @@ xfs_dir2_sf_to_block(
1148 dep->namelen = 2; 1148 dep->namelen = 2;
1149 dep->name[0] = dep->name[1] = '.'; 1149 dep->name[0] = dep->name[1] = '.';
1150 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 1150 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
1151 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); 1151 *tagp = cpu_to_be16((char *)dep - (char *)block);
1152 xfs_dir2_data_log_entry(tp, bp, dep); 1152 xfs_dir2_data_log_entry(tp, bp, dep);
1153 blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot); 1153 blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
1154 blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp, 1154 blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
@@ -1198,7 +1198,7 @@ xfs_dir2_sf_to_block(
1198 dep->namelen = sfep->namelen; 1198 dep->namelen = sfep->namelen;
1199 memcpy(dep->name, sfep->name, dep->namelen); 1199 memcpy(dep->name, sfep->name, dep->namelen);
1200 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 1200 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
1201 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)block)); 1201 *tagp = cpu_to_be16((char *)dep - (char *)block);
1202 xfs_dir2_data_log_entry(tp, bp, dep); 1202 xfs_dir2_data_log_entry(tp, bp, dep);
1203 blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname( 1203 blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
1204 (char *)sfep->name, sfep->namelen)); 1204 (char *)sfep->name, sfep->namelen));
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index 084b134361aa..bb3d03ff002b 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -134,7 +134,7 @@ xfs_dir2_data_check(
134 dep = (xfs_dir2_data_entry_t *)p; 134 dep = (xfs_dir2_data_entry_t *)p;
135 ASSERT(dep->namelen != 0); 135 ASSERT(dep->namelen != 0);
136 ASSERT(xfs_dir_ino_validate(mp, INT_GET(dep->inumber, ARCH_CONVERT)) == 0); 136 ASSERT(xfs_dir_ino_validate(mp, INT_GET(dep->inumber, ARCH_CONVERT)) == 0);
137 ASSERT(INT_GET(*XFS_DIR2_DATA_ENTRY_TAG_P(dep), ARCH_CONVERT) == 137 ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) ==
138 (char *)dep - (char *)d); 138 (char *)dep - (char *)d);
139 count++; 139 count++;
140 lastfree = 0; 140 lastfree = 0;
@@ -376,7 +376,7 @@ xfs_dir2_data_freescan(
376 else { 376 else {
377 dep = (xfs_dir2_data_entry_t *)p; 377 dep = (xfs_dir2_data_entry_t *)p;
378 ASSERT((char *)dep - (char *)d == 378 ASSERT((char *)dep - (char *)d ==
379 INT_GET(*XFS_DIR2_DATA_ENTRY_TAG_P(dep), ARCH_CONVERT)); 379 be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)));
380 p += XFS_DIR2_DATA_ENTSIZE(dep->namelen); 380 p += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
381 } 381 }
382 } 382 }
@@ -549,10 +549,10 @@ xfs_dir2_data_make_free(
549 * the previous entry and see if it's free. 549 * the previous entry and see if it's free.
550 */ 550 */
551 if (offset > sizeof(d->hdr)) { 551 if (offset > sizeof(d->hdr)) {
552 xfs_dir2_data_off_t *tagp; /* tag just before us */ 552 __be16 *tagp; /* tag just before us */
553 553
554 tagp = (xfs_dir2_data_off_t *)((char *)d + offset) - 1; 554 tagp = (__be16 *)((char *)d + offset) - 1;
555 prevdup = (xfs_dir2_data_unused_t *)((char *)d + INT_GET(*tagp, ARCH_CONVERT)); 555 prevdup = (xfs_dir2_data_unused_t *)((char *)d + be16_to_cpu(*tagp));
556 if (be16_to_cpu(prevdup->freetag) != XFS_DIR2_DATA_FREE_TAG) 556 if (be16_to_cpu(prevdup->freetag) != XFS_DIR2_DATA_FREE_TAG)
557 prevdup = NULL; 557 prevdup = NULL;
558 } else 558 } else
diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h
index 479b59f50dbc..0847cbb53e17 100644
--- a/fs/xfs/xfs_dir2_data.h
+++ b/fs/xfs/xfs_dir2_data.h
@@ -134,12 +134,11 @@ static inline int xfs_dir2_data_entsize(int n)
134 * Pointer to an entry's tag word. 134 * Pointer to an entry's tag word.
135 */ 135 */
136#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) 136#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
137static inline xfs_dir2_data_off_t * 137static inline __be16 *
138xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep) 138xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
139{ 139{
140 return (xfs_dir2_data_off_t *) \ 140 return (__be16 *)((char *)dep +
141 ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ 141 XFS_DIR2_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
142 (uint)sizeof(xfs_dir2_data_off_t));
143} 142}
144 143
145/* 144/*
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 752fc67354ea..b5036512d02f 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -187,7 +187,7 @@ xfs_dir2_leaf_addname(
187 int needbytes; /* leaf block bytes needed */ 187 int needbytes; /* leaf block bytes needed */
188 int needlog; /* need to log data header */ 188 int needlog; /* need to log data header */
189 int needscan; /* need to rescan data free */ 189 int needscan; /* need to rescan data free */
190 xfs_dir2_data_off_t *tagp; /* end of data entry */ 190 __be16 *tagp; /* end of data entry */
191 xfs_trans_t *tp; /* transaction pointer */ 191 xfs_trans_t *tp; /* transaction pointer */
192 xfs_dir2_db_t use_block; /* data block number */ 192 xfs_dir2_db_t use_block; /* data block number */
193 193
@@ -411,7 +411,7 @@ xfs_dir2_leaf_addname(
411 dep->namelen = args->namelen; 411 dep->namelen = args->namelen;
412 memcpy(dep->name, args->name, dep->namelen); 412 memcpy(dep->name, args->name, dep->namelen);
413 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 413 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
414 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); 414 *tagp = cpu_to_be16((char *)dep - (char *)data);
415 /* 415 /*
416 * Need to scan fix up the bestfree table. 416 * Need to scan fix up the bestfree table.
417 */ 417 */
@@ -533,7 +533,7 @@ xfs_dir2_leaf_addname(
533 */ 533 */
534 lep->hashval = cpu_to_be32(args->hashval); 534 lep->hashval = cpu_to_be32(args->hashval);
535 lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block, 535 lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block,
536 INT_GET(*tagp, ARCH_CONVERT))); 536 be16_to_cpu(*tagp)));
537 /* 537 /*
538 * Log the leaf fields and give up the buffers. 538 * Log the leaf fields and give up the buffers.
539 */ 539 */
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 062e4a99209c..56b7cc89645e 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -1379,7 +1379,7 @@ xfs_dir2_node_addname_int(
1379 xfs_mount_t *mp; /* filesystem mount point */ 1379 xfs_mount_t *mp; /* filesystem mount point */
1380 int needlog; /* need to log data header */ 1380 int needlog; /* need to log data header */
1381 int needscan; /* need to rescan data frees */ 1381 int needscan; /* need to rescan data frees */
1382 xfs_dir2_data_off_t *tagp; /* data entry tag pointer */ 1382 __be16 *tagp; /* data entry tag pointer */
1383 xfs_trans_t *tp; /* transaction pointer */ 1383 xfs_trans_t *tp; /* transaction pointer */
1384 1384
1385 dp = args->dp; 1385 dp = args->dp;
@@ -1699,7 +1699,7 @@ xfs_dir2_node_addname_int(
1699 dep->namelen = args->namelen; 1699 dep->namelen = args->namelen;
1700 memcpy(dep->name, args->name, dep->namelen); 1700 memcpy(dep->name, args->name, dep->namelen);
1701 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep); 1701 tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
1702 INT_SET(*tagp, ARCH_CONVERT, (xfs_dir2_data_off_t)((char *)dep - (char *)data)); 1702 *tagp = cpu_to_be16((char *)dep - (char *)data);
1703 xfs_dir2_data_log_entry(tp, dbp, dep); 1703 xfs_dir2_data_log_entry(tp, dbp, dep);
1704 /* 1704 /*
1705 * Rescan the block for bestfree if needed. 1705 * Rescan the block for bestfree if needed.
@@ -1732,7 +1732,7 @@ xfs_dir2_node_addname_int(
1732 * Return the data block and offset in args, then drop the data block. 1732 * Return the data block and offset in args, then drop the data block.
1733 */ 1733 */
1734 args->blkno = (xfs_dablk_t)dbno; 1734 args->blkno = (xfs_dablk_t)dbno;
1735 args->index = INT_GET(*tagp, ARCH_CONVERT); 1735 args->index = be16_to_cpu(*tagp);
1736 xfs_da_buf_done(dbp); 1736 xfs_da_buf_done(dbp);
1737 return 0; 1737 return 0;
1738} 1738}