aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_block.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 08:35:32 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-08 08:35:32 -0400
commita64b04179735de6bfd9f00c130a68ed7f20d18ef (patch)
tree36fe9aec30550aed6aecf6c2734fa365d1e7c83f /fs/xfs/xfs_dir2_block.c
parent4f6ae1a49ed5c81501d6f7385416bb4e07289e99 (diff)
xfs: kill struct xfs_dir2_block
Remove the confusing xfs_dir2_block structure. It is supposed to describe an XFS dir2 block format btree block, but due to the variable sized nature of almost all elements in it it can't actuall do anything close to that job. In addition to accessing the fixed offset header structure it was only used to get a pointer to the first dir or unused entry after it, which can be trivially replaced by pointer arithmetics on the header pointer. For most users that is actually more natural anyway, as they don't use a typed pointer but rather a character pointer for further arithmetics. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r--fs/xfs/xfs_dir2_block.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index a0037cc4dd8c..9adaf803957a 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -437,7 +437,6 @@ xfs_dir2_block_getdents(
437 xfs_off_t *offset, 437 xfs_off_t *offset,
438 filldir_t filldir) 438 filldir_t filldir)
439{ 439{
440 xfs_dir2_block_t *block; /* directory block structure */
441 xfs_dir2_data_hdr_t *hdr; /* block header */ 440 xfs_dir2_data_hdr_t *hdr; /* block header */
442 xfs_dabuf_t *bp; /* buffer for block */ 441 xfs_dabuf_t *bp; /* buffer for block */
443 xfs_dir2_block_tail_t *btp; /* block tail */ 442 xfs_dir2_block_tail_t *btp; /* block tail */
@@ -471,14 +470,13 @@ xfs_dir2_block_getdents(
471 * We'll skip entries before this. 470 * We'll skip entries before this.
472 */ 471 */
473 wantoff = xfs_dir2_dataptr_to_off(mp, *offset); 472 wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
474 block = bp->data; 473 hdr = bp->data;
475 hdr = &block->hdr;
476 xfs_dir2_data_check(dp, bp); 474 xfs_dir2_data_check(dp, bp);
477 /* 475 /*
478 * Set up values for the loop. 476 * Set up values for the loop.
479 */ 477 */
480 btp = xfs_dir2_block_tail_p(mp, hdr); 478 btp = xfs_dir2_block_tail_p(mp, hdr);
481 ptr = (char *)block->u; 479 ptr = (char *)(hdr + 1);
482 endptr = (char *)xfs_dir2_block_leaf_p(btp); 480 endptr = (char *)xfs_dir2_block_leaf_p(btp);
483 481
484 /* 482 /*
@@ -1020,7 +1018,6 @@ xfs_dir2_sf_to_block(
1020 xfs_da_args_t *args) /* operation arguments */ 1018 xfs_da_args_t *args) /* operation arguments */
1021{ 1019{
1022 xfs_dir2_db_t blkno; /* dir-relative block # (0) */ 1020 xfs_dir2_db_t blkno; /* dir-relative block # (0) */
1023 xfs_dir2_block_t *block; /* block structure */
1024 xfs_dir2_data_hdr_t *hdr; /* block header */ 1021 xfs_dir2_data_hdr_t *hdr; /* block header */
1025 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */ 1022 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
1026 xfs_dabuf_t *bp; /* block buffer */ 1023 xfs_dabuf_t *bp; /* block buffer */
@@ -1091,8 +1088,7 @@ xfs_dir2_sf_to_block(
1091 kmem_free(sfp); 1088 kmem_free(sfp);
1092 return error; 1089 return error;
1093 } 1090 }
1094 block = bp->data; 1091 hdr = bp->data;
1095 hdr = &block->hdr;
1096 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC); 1092 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC);
1097 /* 1093 /*
1098 * Compute size of block "tail" area. 1094 * Compute size of block "tail" area.
@@ -1103,7 +1099,7 @@ xfs_dir2_sf_to_block(
1103 * The whole thing is initialized to free by the init routine. 1099 * The whole thing is initialized to free by the init routine.
1104 * Say we're using the leaf and tail area. 1100 * Say we're using the leaf and tail area.
1105 */ 1101 */
1106 dup = (xfs_dir2_data_unused_t *)block->u; 1102 dup = (xfs_dir2_data_unused_t *)(hdr + 1);
1107 needlog = needscan = 0; 1103 needlog = needscan = 0;
1108 xfs_dir2_data_use_free(tp, bp, dup, mp->m_dirblksize - i, i, &needlog, 1104 xfs_dir2_data_use_free(tp, bp, dup, mp->m_dirblksize - i, i, &needlog,
1109 &needscan); 1105 &needscan);