diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-04-03 16:11:22 +1100 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-04-27 12:00:00 -0500 |
commit | 33363feed1614def83d0a6870051f0a7828cd61b (patch) | |
tree | 87fc721e32537e981264a1662de2c44d1d195607 /fs/xfs/xfs_dir2_format.h | |
parent | cbc8adf89724b961c08b823d8bfb6dadbfa8733d (diff) | |
download | linux-33363feed1614def83d0a6870051f0a7828cd61b.tar.bz2 |
xfs: add CRC checking to dir2 data blocks
This addition follows the same pattern as the dir2 block CRCs.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_format.h')
-rw-r--r-- | fs/xfs/xfs_dir2_format.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/xfs/xfs_dir2_format.h b/fs/xfs/xfs_dir2_format.h index ec5044a92b70..0ac09502b830 100644 --- a/fs/xfs/xfs_dir2_format.h +++ b/fs/xfs/xfs_dir2_format.h @@ -283,7 +283,8 @@ struct xfs_dir3_data_hdr { static inline struct xfs_dir2_data_free * xfs_dir3_data_bestfree_p(struct xfs_dir2_data_hdr *hdr) { - if (hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { + if (hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || + hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { struct xfs_dir3_data_hdr *hdr3 = (struct xfs_dir3_data_hdr *)hdr; return hdr3->best_free; } @@ -345,17 +346,6 @@ xfs_dir2_data_unused_tag_p(struct xfs_dir2_data_unused *dup) be16_to_cpu(dup->length) - sizeof(__be16)); } -static inline struct xfs_dir2_data_unused * -xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) -{ - if (hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) { - return (struct xfs_dir2_data_unused *) - ((char *)hdr + sizeof(struct xfs_dir3_data_hdr)); - } - return (struct xfs_dir2_data_unused *) - ((char *)hdr + sizeof(struct xfs_dir2_data_hdr)); -} - static inline size_t xfs_dir3_data_hdr_size(bool dir3) { @@ -379,6 +369,13 @@ xfs_dir3_data_entry_p(struct xfs_dir2_data_hdr *hdr) ((char *)hdr + xfs_dir3_data_entry_offset(hdr)); } +static inline struct xfs_dir2_data_unused * +xfs_dir3_data_unused_p(struct xfs_dir2_data_hdr *hdr) +{ + return (struct xfs_dir2_data_unused *) + ((char *)hdr + xfs_dir3_data_entry_offset(hdr)); +} + /* * Offsets of . and .. in data space (always block 0) */ |