diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-27 23:58:06 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:49:09 -0400 |
commit | 2bdf7cd0baa67608ada1517a281af359faf4c58c (patch) | |
tree | 645d283fd4938a9b21b4b9e2585224ed4eeb4adb /fs/xfs/xfs_sb.h | |
parent | 347d1c01956d567c18afef0cc253eb235cafacd8 (diff) |
[XFS] superblock endianess annotations
Creates a new xfs_dsb_t that is __be annotated and keeps xfs_sb_t for the
incore one. xfs_xlatesb is renamed to xfs_sb_to_disk and only handles the
incore -> disk conversion. A new helper xfs_sb_from_disk handles the other
direction and doesn't need the slightly hacky table-driven approach
because we only ever read the full sb from disk.
The handling of shared r/o filesystems has been buggy on little endian
system and fixing this required shuffling around of some code in that
area.
SGI-PV: 968563
SGI-Modid: xfs-linux-melb:xfs-kern:29477a
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_sb.h')
-rw-r--r-- | fs/xfs/xfs_sb.h | 68 |
1 files changed, 65 insertions, 3 deletions
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h index ef42537a607a..94660b1a6ccc 100644 --- a/fs/xfs/xfs_sb.h +++ b/fs/xfs/xfs_sb.h | |||
@@ -87,8 +87,10 @@ struct xfs_mount; | |||
87 | (XFS_SB_VERSION2_OKREALFBITS | \ | 87 | (XFS_SB_VERSION2_OKREALFBITS | \ |
88 | XFS_SB_VERSION2_OKSASHFBITS ) | 88 | XFS_SB_VERSION2_OKSASHFBITS ) |
89 | 89 | ||
90 | typedef struct xfs_sb | 90 | /* |
91 | { | 91 | * Superblock - in core version. Must match the ondisk version below. |
92 | */ | ||
93 | typedef struct xfs_sb { | ||
92 | __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ | 94 | __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ |
93 | __uint32_t sb_blocksize; /* logical block size, bytes */ | 95 | __uint32_t sb_blocksize; /* logical block size, bytes */ |
94 | xfs_drfsbno_t sb_dblocks; /* number of data blocks */ | 96 | xfs_drfsbno_t sb_dblocks; /* number of data blocks */ |
@@ -146,6 +148,66 @@ typedef struct xfs_sb | |||
146 | } xfs_sb_t; | 148 | } xfs_sb_t; |
147 | 149 | ||
148 | /* | 150 | /* |
151 | * Superblock - on disk version. Must match the in core version below. | ||
152 | */ | ||
153 | typedef struct xfs_dsb { | ||
154 | __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ | ||
155 | __be32 sb_blocksize; /* logical block size, bytes */ | ||
156 | __be64 sb_dblocks; /* number of data blocks */ | ||
157 | __be64 sb_rblocks; /* number of realtime blocks */ | ||
158 | __be64 sb_rextents; /* number of realtime extents */ | ||
159 | uuid_t sb_uuid; /* file system unique id */ | ||
160 | __be64 sb_logstart; /* starting block of log if internal */ | ||
161 | __be64 sb_rootino; /* root inode number */ | ||
162 | __be64 sb_rbmino; /* bitmap inode for realtime extents */ | ||
163 | __be64 sb_rsumino; /* summary inode for rt bitmap */ | ||
164 | __be32 sb_rextsize; /* realtime extent size, blocks */ | ||
165 | __be32 sb_agblocks; /* size of an allocation group */ | ||
166 | __be32 sb_agcount; /* number of allocation groups */ | ||
167 | __be32 sb_rbmblocks; /* number of rt bitmap blocks */ | ||
168 | __be32 sb_logblocks; /* number of log blocks */ | ||
169 | __be16 sb_versionnum; /* header version == XFS_SB_VERSION */ | ||
170 | __be16 sb_sectsize; /* volume sector size, bytes */ | ||
171 | __be16 sb_inodesize; /* inode size, bytes */ | ||
172 | __be16 sb_inopblock; /* inodes per block */ | ||
173 | char sb_fname[12]; /* file system name */ | ||
174 | __u8 sb_blocklog; /* log2 of sb_blocksize */ | ||
175 | __u8 sb_sectlog; /* log2 of sb_sectsize */ | ||
176 | __u8 sb_inodelog; /* log2 of sb_inodesize */ | ||
177 | __u8 sb_inopblog; /* log2 of sb_inopblock */ | ||
178 | __u8 sb_agblklog; /* log2 of sb_agblocks (rounded up) */ | ||
179 | __u8 sb_rextslog; /* log2 of sb_rextents */ | ||
180 | __u8 sb_inprogress; /* mkfs is in progress, don't mount */ | ||
181 | __u8 sb_imax_pct; /* max % of fs for inode space */ | ||
182 | /* statistics */ | ||
183 | /* | ||
184 | * These fields must remain contiguous. If you really | ||
185 | * want to change their layout, make sure you fix the | ||
186 | * code in xfs_trans_apply_sb_deltas(). | ||
187 | */ | ||
188 | __be64 sb_icount; /* allocated inodes */ | ||
189 | __be64 sb_ifree; /* free inodes */ | ||
190 | __be64 sb_fdblocks; /* free data blocks */ | ||
191 | __be64 sb_frextents; /* free realtime extents */ | ||
192 | /* | ||
193 | * End contiguous fields. | ||
194 | */ | ||
195 | __be64 sb_uquotino; /* user quota inode */ | ||
196 | __be64 sb_gquotino; /* group quota inode */ | ||
197 | __be16 sb_qflags; /* quota flags */ | ||
198 | __u8 sb_flags; /* misc. flags */ | ||
199 | __u8 sb_shared_vn; /* shared version number */ | ||
200 | __be32 sb_inoalignmt; /* inode chunk alignment, fsblocks */ | ||
201 | __be32 sb_unit; /* stripe or raid unit */ | ||
202 | __be32 sb_width; /* stripe or raid width */ | ||
203 | __u8 sb_dirblklog; /* log2 of dir block size (fsbs) */ | ||
204 | __u8 sb_logsectlog; /* log2 of the log sector size */ | ||
205 | __be16 sb_logsectsize; /* sector size for the log, bytes */ | ||
206 | __be32 sb_logsunit; /* stripe unit size for the log */ | ||
207 | __be32 sb_features2; /* additional feature bits */ | ||
208 | } xfs_dsb_t; | ||
209 | |||
210 | /* | ||
149 | * Sequence number values for the fields. | 211 | * Sequence number values for the fields. |
150 | */ | 212 | */ |
151 | typedef enum { | 213 | typedef enum { |
@@ -446,7 +508,7 @@ static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) | |||
446 | 508 | ||
447 | #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ | 509 | #define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ |
448 | #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) | 510 | #define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) |
449 | #define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) | 511 | #define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp)) |
450 | 512 | ||
451 | #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) | 513 | #define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) |
452 | #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ | 514 | #define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ |