Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255137
b: refs/heads/master
c: 0ba9cd8
h: refs/heads/master
i:
  255135: 3702141
v: v3
  • Loading branch information
Christoph Hellwig committed Jul 8, 2011
1 parent dd95c55 commit 5079610
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2066e2662070e794f57a96a129c42575e77cfcb
refs/heads/master: 0ba9cd84ef2af58645333a86f9c901684ab1fef6
15 changes: 5 additions & 10 deletions trunk/fs/xfs/xfs_dir2_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
Expand Down Expand Up @@ -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 */
Expand All @@ -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);
Expand Down Expand Up @@ -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 */
Expand All @@ -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++) {
Expand All @@ -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);
Expand Down
33 changes: 16 additions & 17 deletions trunk/fs/xfs/xfs_dir2_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@

/*
* Directory format 2, data block structures.
*
* A pure data block looks like the following drawing on disk:
*
* +-------------------------------------------------+
* | xfs_dir2_data_hdr_t |
* +-------------------------------------------------+
* | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
* | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
* | xfs_dir2_data_entry_t OR xfs_dir2_data_unused_t |
* | ... |
* +-------------------------------------------------+
* | unused space |
* +-------------------------------------------------+
*
* As all the entries are variable size structures the accessors in this
* file should be used to iterate over them.
*/

struct xfs_dabuf;
Expand Down Expand Up @@ -103,23 +119,6 @@ typedef struct xfs_dir2_data_unused {
__be16 tag; /* starting offset of us */
} xfs_dir2_data_unused_t;

typedef union {
xfs_dir2_data_entry_t entry;
xfs_dir2_data_unused_t unused;
} xfs_dir2_data_union_t;

/*
* Generic data block structure, for xfs_db.
*/
typedef struct xfs_dir2_data {
xfs_dir2_data_hdr_t hdr; /* magic XFS_DIR2_DATA_MAGIC */
xfs_dir2_data_union_t u[1];
} xfs_dir2_data_t;

/*
* Macros.
*/

/*
* Size of a data entry.
*/
Expand Down
6 changes: 2 additions & 4 deletions trunk/fs/xfs/xfs_dir2_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ xfs_dir2_leaf_getdents(
int byteoff; /* offset in current block */
xfs_dir2_db_t curdb; /* db for current block */
xfs_dir2_off_t curoff; /* current overall offset */
xfs_dir2_data_t *data; /* data block structure */
xfs_dir2_data_hdr_t *hdr; /* data block header */
xfs_dir2_data_entry_t *dep; /* data entry */
xfs_dir2_data_unused_t *dup; /* unused entry */
Expand Down Expand Up @@ -1044,13 +1043,12 @@ xfs_dir2_leaf_getdents(
else if (curoff > newoff)
ASSERT(xfs_dir2_byte_to_db(mp, curoff) ==
curdb);
data = bp->data;
hdr = &data->hdr;
hdr = bp->data;
xfs_dir2_data_check(dp, bp);
/*
* Find our position in the block.
*/
ptr = (char *)&data->u;
ptr = (char *)(hdr + 1);
byteoff = xfs_dir2_byte_to_off(mp, curoff);
/*
* Skip past the header.
Expand Down

0 comments on commit 5079610

Please sign in to comment.