aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_sf.c
diff options
context:
space:
mode:
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);
59static void xfs_dir2_sf_toino8(xfs_da_args_t *args); 59static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
60#endif /* XFS_BIG_INUMS */ 60#endif /* XFS_BIG_INUMS */
61 61
62
63/* 62/*
64 * Inode numbers in short-form directories can come in two versions, 63 * Inode numbers in short-form directories can come in two versions,
65 * either 4 bytes or 8 bytes wide. These helpers deal with the 64 * either 4 bytes or 8 bytes wide. These helpers deal with the
66 * two forms transparently by looking at the headers i8count field. 65 * two forms transparently by looking at the headers i8count field.
66 *
67 * For 64-bit inode number the most significant byte must be zero.
67 */ 68 */
68static xfs_ino_t 69static xfs_ino_t
69xfs_dir2_sf_get_ino( 70xfs_dir2_sf_get_ino(
@@ -71,9 +72,9 @@ xfs_dir2_sf_get_ino(
71 xfs_dir2_inou_t *from) 72 xfs_dir2_inou_t *from)
72{ 73{
73 if (hdr->i8count) 74 if (hdr->i8count)
74 return XFS_GET_DIR_INO8(from->i8); 75 return get_unaligned_be64(&from->i8.i) & 0x00ffffffffffffffULL;
75 else 76 else
76 return XFS_GET_DIR_INO4(from->i4); 77 return get_unaligned_be32(&from->i4.i);
77} 78}
78 79
79static void 80static void
@@ -82,10 +83,12 @@ xfs_dir2_sf_put_ino(
82 xfs_dir2_inou_t *to, 83 xfs_dir2_inou_t *to,
83 xfs_ino_t ino) 84 xfs_ino_t ino)
84{ 85{
86 ASSERT((ino & 0xff00000000000000ULL) == 0);
87
85 if (hdr->i8count) 88 if (hdr->i8count)
86 XFS_PUT_DIR_INO8(ino, to->i8); 89 put_unaligned_be64(ino, &to->i8.i);
87 else 90 else
88 XFS_PUT_DIR_INO4(ino, to->i4); 91 put_unaligned_be32(ino, &to->i4.i);
89} 92}
90 93
91xfs_ino_t 94xfs_ino_t