summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_data.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 14:35:42 +0200
committerChristoph Hellwig <hch@lst.de>2011-07-08 14:35:42 +0200
commit0ba9cd84ef2af58645333a86f9c901684ab1fef6 (patch)
tree0c25f43b83bb77ceb44cf29d207a295ac0b77b31 /fs/xfs/xfs_dir2_data.c
parentc2066e2662070e794f57a96a129c42575e77cfcb (diff)
downloadop-kernel-dev-0ba9cd84ef2af58645333a86f9c901684ab1fef6.zip
op-kernel-dev-0ba9cd84ef2af58645333a86f9c901684ab1fef6.tar.gz
xfs: kill struct xfs_dir2_data
Remove the confusing xfs_dir2_data structure. It is supposed to describe an XFS dir2 data 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_data.c')
-rw-r--r--fs/xfs/xfs_dir2_data.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c
index 2bbc216..8e47ac3 100644
--- a/fs/xfs/xfs_dir2_data.c
+++ b/fs/xfs/xfs_dir2_data.c
@@ -53,7 +53,6 @@ xfs_dir2_data_check(
xfs_dir2_data_free_t *bf; /* bestfree table */
xfs_dir2_block_tail_t *btp=NULL; /* block tail */
int count; /* count of entries found */
- xfs_dir2_data_t *d; /* data block pointer */
xfs_dir2_data_hdr_t *hdr; /* data block header */
xfs_dir2_data_entry_t *dep; /* data entry */
xfs_dir2_data_free_t *dfp; /* bestfree entry */
@@ -70,10 +69,9 @@ xfs_dir2_data_check(
struct xfs_name name;
mp = dp->i_mount;
- d = bp->data;
- hdr = &d->hdr;
+ hdr = bp->data;
bf = hdr->bestfree;
- p = (char *)d->u;
+ p = (char *)(hdr + 1);
if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) {
btp = xfs_dir2_block_tail_p(mp, hdr);
@@ -336,7 +334,6 @@ xfs_dir2_data_freescan(
xfs_dir2_data_hdr_t *hdr, /* data block header */
int *loghead) /* out: log data header */
{
- xfs_dir2_data_t *d = (xfs_dir2_data_t *)hdr;
xfs_dir2_block_tail_t *btp; /* block tail */
xfs_dir2_data_entry_t *dep; /* active data entry */
xfs_dir2_data_unused_t *dup; /* unused data entry */
@@ -355,7 +352,7 @@ xfs_dir2_data_freescan(
/*
* Set up pointers.
*/
- p = (char *)d->u;
+ p = (char *)(hdr + 1);
if (be32_to_cpu(hdr->magic) == XFS_DIR2_BLOCK_MAGIC) {
btp = xfs_dir2_block_tail_p(mp, hdr);
endp = (char *)xfs_dir2_block_leaf_p(btp);
@@ -398,7 +395,6 @@ xfs_dir2_data_init(
xfs_dabuf_t **bpp) /* output block buffer */
{
xfs_dabuf_t *bp; /* block buffer */
- xfs_dir2_data_t *d; /* pointer to block */
xfs_dir2_data_hdr_t *hdr; /* data block header */
xfs_inode_t *dp; /* incore directory inode */
xfs_dir2_data_unused_t *dup; /* unused entry pointer */
@@ -424,8 +420,7 @@ xfs_dir2_data_init(
/*
* Initialize the header.
*/
- d = bp->data;
- hdr = &d->hdr;
+ hdr = bp->data;
hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
hdr->bestfree[0].offset = cpu_to_be16(sizeof(*hdr));
for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
@@ -436,7 +431,7 @@ xfs_dir2_data_init(
/*
* Set up an unused entry for the block's body.
*/
- dup = &d->u[0].unused;
+ dup = (xfs_dir2_data_unused_t *)(hdr + 1);
dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
t = mp->m_dirblksize - (uint)sizeof(*hdr);
OpenPOWER on IntegriCloud