summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_dir2_sf.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 14:35:58 +0200
committerChristoph Hellwig <hch@lst.de>2011-07-08 14:35:58 +0200
commit218106a1104c598011e5df9d9aac7e0416be03e6 (patch)
treebdec31d1f6fd5fe11eed76bac56017affd3d1606 /fs/xfs/xfs_dir2_sf.c
parent2282396d8157033503318fe4dee77ba82dc9d144 (diff)
xfs: use generic get_unaligned_beXX helpers
Switch the shortform directory code over to use the generic get_unaligned_beXX helpers instead of reinventing them. As a result kill off xfs_arch.h and move the setting of XFS_NATIVE_HOST into xfs_linux.h. 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_sf.c')
-rw-r--r--fs/xfs/xfs_dir2_sf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index b47a99c8f244..9d3dff2ae4c5 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -59,11 +59,12 @@ static void xfs_dir2_sf_toino4(xfs_da_args_t *args);
static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
#endif /* XFS_BIG_INUMS */
-
/*
* Inode numbers in short-form directories can come in two versions,
* either 4 bytes or 8 bytes wide. These helpers deal with the
* two forms transparently by looking at the headers i8count field.
+ *
+ * For 64-bit inode number the most significant byte must be zero.
*/
static xfs_ino_t
xfs_dir2_sf_get_ino(
@@ -71,9 +72,9 @@ xfs_dir2_sf_get_ino(
xfs_dir2_inou_t *from)
{
if (hdr->i8count)
- return XFS_GET_DIR_INO8(from->i8);
+ return get_unaligned_be64(&from->i8.i) & 0x00ffffffffffffffULL;
else
- return XFS_GET_DIR_INO4(from->i4);
+ return get_unaligned_be32(&from->i4.i);
}
static void
@@ -82,10 +83,12 @@ xfs_dir2_sf_put_ino(
xfs_dir2_inou_t *to,
xfs_ino_t ino)
{
+ ASSERT((ino & 0xff00000000000000ULL) == 0);
+
if (hdr->i8count)
- XFS_PUT_DIR_INO8(ino, to->i8);
+ put_unaligned_be64(ino, &to->i8.i);
else
- XFS_PUT_DIR_INO4(ino, to->i4);
+ put_unaligned_be32(ino, &to->i4.i);
}
xfs_ino_t