aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_itable.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-27 23:57:51 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 02:48:30 -0400
commit347d1c01956d567c18afef0cc253eb235cafacd8 (patch)
tree55c61ae9390e013978cef21099a65965b2bb0ab5 /fs/xfs/xfs_itable.c
parentddc6d3b32a8a732c343dc225048fae06c129e48a (diff)
[XFS] dinode endianess annotations
Biggest bit is duplicating the dinode structure so we have one annotated for native endianess and one for disk endianess. The other significant change is that xfs_xlate_dinode_core is split into one helper per direction to allow for proper annotations, everything else is trivial. As a sidenode splitting out the incore dinode means we can move it into xfs_inode.h in a later patch and severely improving on the include hell in xfs. SGI-PV: 968563 SGI-Modid: xfs-linux-melb:xfs-kern:29476a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_itable.c')
-rw-r--r--fs/xfs/xfs_itable.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 4c2454bcc714..efeeafe275b9 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -57,7 +57,7 @@ xfs_bulkstat_one_iget(
57 xfs_bstat_t *buf, /* return buffer */ 57 xfs_bstat_t *buf, /* return buffer */
58 int *stat) /* BULKSTAT_RV_... */ 58 int *stat) /* BULKSTAT_RV_... */
59{ 59{
60 xfs_dinode_core_t *dic; /* dinode core info pointer */ 60 xfs_icdinode_t *dic; /* dinode core info pointer */
61 xfs_inode_t *ip; /* incore inode pointer */ 61 xfs_inode_t *ip; /* incore inode pointer */
62 bhv_vnode_t *vp; 62 bhv_vnode_t *vp;
63 int error; 63 int error;
@@ -151,37 +151,37 @@ xfs_bulkstat_one_dinode(
151 * the new format. We don't change the version number so that we 151 * the new format. We don't change the version number so that we
152 * can distinguish this from a real new format inode. 152 * can distinguish this from a real new format inode.
153 */ 153 */
154 if (INT_GET(dic->di_version, ARCH_CONVERT) == XFS_DINODE_VERSION_1) { 154 if (dic->di_version == XFS_DINODE_VERSION_1) {
155 buf->bs_nlink = INT_GET(dic->di_onlink, ARCH_CONVERT); 155 buf->bs_nlink = be16_to_cpu(dic->di_onlink);
156 buf->bs_projid = 0; 156 buf->bs_projid = 0;
157 } else { 157 } else {
158 buf->bs_nlink = INT_GET(dic->di_nlink, ARCH_CONVERT); 158 buf->bs_nlink = be32_to_cpu(dic->di_nlink);
159 buf->bs_projid = INT_GET(dic->di_projid, ARCH_CONVERT); 159 buf->bs_projid = be16_to_cpu(dic->di_projid);
160 } 160 }
161 161
162 buf->bs_ino = ino; 162 buf->bs_ino = ino;
163 buf->bs_mode = INT_GET(dic->di_mode, ARCH_CONVERT); 163 buf->bs_mode = be16_to_cpu(dic->di_mode);
164 buf->bs_uid = INT_GET(dic->di_uid, ARCH_CONVERT); 164 buf->bs_uid = be32_to_cpu(dic->di_uid);
165 buf->bs_gid = INT_GET(dic->di_gid, ARCH_CONVERT); 165 buf->bs_gid = be32_to_cpu(dic->di_gid);
166 buf->bs_size = INT_GET(dic->di_size, ARCH_CONVERT); 166 buf->bs_size = be64_to_cpu(dic->di_size);
167 buf->bs_atime.tv_sec = INT_GET(dic->di_atime.t_sec, ARCH_CONVERT); 167 buf->bs_atime.tv_sec = be32_to_cpu(dic->di_atime.t_sec);
168 buf->bs_atime.tv_nsec = INT_GET(dic->di_atime.t_nsec, ARCH_CONVERT); 168 buf->bs_atime.tv_nsec = be32_to_cpu(dic->di_atime.t_nsec);
169 buf->bs_mtime.tv_sec = INT_GET(dic->di_mtime.t_sec, ARCH_CONVERT); 169 buf->bs_mtime.tv_sec = be32_to_cpu(dic->di_mtime.t_sec);
170 buf->bs_mtime.tv_nsec = INT_GET(dic->di_mtime.t_nsec, ARCH_CONVERT); 170 buf->bs_mtime.tv_nsec = be32_to_cpu(dic->di_mtime.t_nsec);
171 buf->bs_ctime.tv_sec = INT_GET(dic->di_ctime.t_sec, ARCH_CONVERT); 171 buf->bs_ctime.tv_sec = be32_to_cpu(dic->di_ctime.t_sec);
172 buf->bs_ctime.tv_nsec = INT_GET(dic->di_ctime.t_nsec, ARCH_CONVERT); 172 buf->bs_ctime.tv_nsec = be32_to_cpu(dic->di_ctime.t_nsec);
173 buf->bs_xflags = xfs_dic2xflags(dic); 173 buf->bs_xflags = xfs_dic2xflags(dic);
174 buf->bs_extsize = INT_GET(dic->di_extsize, ARCH_CONVERT) << mp->m_sb.sb_blocklog; 174 buf->bs_extsize = be32_to_cpu(dic->di_extsize) << mp->m_sb.sb_blocklog;
175 buf->bs_extents = INT_GET(dic->di_nextents, ARCH_CONVERT); 175 buf->bs_extents = be32_to_cpu(dic->di_nextents);
176 buf->bs_gen = INT_GET(dic->di_gen, ARCH_CONVERT); 176 buf->bs_gen = be32_to_cpu(dic->di_gen);
177 memset(buf->bs_pad, 0, sizeof(buf->bs_pad)); 177 memset(buf->bs_pad, 0, sizeof(buf->bs_pad));
178 buf->bs_dmevmask = INT_GET(dic->di_dmevmask, ARCH_CONVERT); 178 buf->bs_dmevmask = be32_to_cpu(dic->di_dmevmask);
179 buf->bs_dmstate = INT_GET(dic->di_dmstate, ARCH_CONVERT); 179 buf->bs_dmstate = be16_to_cpu(dic->di_dmstate);
180 buf->bs_aextents = INT_GET(dic->di_anextents, ARCH_CONVERT); 180 buf->bs_aextents = be16_to_cpu(dic->di_anextents);
181 181
182 switch (INT_GET(dic->di_format, ARCH_CONVERT)) { 182 switch (dic->di_format) {
183 case XFS_DINODE_FMT_DEV: 183 case XFS_DINODE_FMT_DEV:
184 buf->bs_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT); 184 buf->bs_rdev = be32_to_cpu(dip->di_u.di_dev);
185 buf->bs_blksize = BLKDEV_IOSIZE; 185 buf->bs_blksize = BLKDEV_IOSIZE;
186 buf->bs_blocks = 0; 186 buf->bs_blocks = 0;
187 break; 187 break;
@@ -195,7 +195,7 @@ xfs_bulkstat_one_dinode(
195 case XFS_DINODE_FMT_BTREE: 195 case XFS_DINODE_FMT_BTREE:
196 buf->bs_rdev = 0; 196 buf->bs_rdev = 0;
197 buf->bs_blksize = mp->m_sb.sb_blocksize; 197 buf->bs_blksize = mp->m_sb.sb_blocksize;
198 buf->bs_blocks = INT_GET(dic->di_nblocks, ARCH_CONVERT); 198 buf->bs_blocks = be64_to_cpu(dic->di_nblocks);
199 break; 199 break;
200 } 200 }
201 201
@@ -290,16 +290,15 @@ xfs_bulkstat_use_dinode(
290 return 1; 290 return 1;
291 dip = (xfs_dinode_t *) 291 dip = (xfs_dinode_t *)
292 xfs_buf_offset(bp, clustidx << mp->m_sb.sb_inodelog); 292 xfs_buf_offset(bp, clustidx << mp->m_sb.sb_inodelog);
293 if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC || 293 if (be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC ||
294 !XFS_DINODE_GOOD_VERSION( 294 !XFS_DINODE_GOOD_VERSION(dip->di_core.di_version))
295 INT_GET(dip->di_core.di_version, ARCH_CONVERT)))
296 return 0; 295 return 0;
297 if (flags & BULKSTAT_FG_QUICK) { 296 if (flags & BULKSTAT_FG_QUICK) {
298 *dipp = dip; 297 *dipp = dip;
299 return 1; 298 return 1;
300 } 299 }
301 /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */ 300 /* BULKSTAT_FG_INLINE: if attr fork is local, or not there, use it */
302 aformat = INT_GET(dip->di_core.di_aformat, ARCH_CONVERT); 301 aformat = dip->di_core.di_aformat;
303 if ((XFS_CFORK_Q(&dip->di_core) == 0) || 302 if ((XFS_CFORK_Q(&dip->di_core) == 0) ||
304 (aformat == XFS_DINODE_FMT_LOCAL) || 303 (aformat == XFS_DINODE_FMT_LOCAL) ||
305 (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_core.di_anextents)) { 304 (aformat == XFS_DINODE_FMT_EXTENTS && !dip->di_core.di_anextents)) {