aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ag.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2013-04-03 01:11:14 -0400
committerBen Myers <bpm@sgi.com>2013-04-21 15:55:34 -0400
commit77c95bba013089fa868217283eb6d98a05913e53 (patch)
tree7b694c2baa200ac1bf2770d7bdfa4f2a292a2a58 /fs/xfs/xfs_ag.h
parent4e0e6040c4052aff15a494ac05778f4086d24c33 (diff)
xfs: add CRC checks to the AGFL
Add CRC checks, location information and a magic number to the AGFL. Previously the AGFL was just a block containing nothing but the free block pointers. The new AGFL has a real header with the usual boilerplate instead, so that we can verify it's not corrupted and written into the right place. [dchinner@redhat.com] Added LSN field, reworked significantly to fit into new verifier structure and growfs structure, enabled full verifier functionality now there is a header to verify and we can guarantee an initialised AGFL. Signed-off-by: Christoph Hellwig <hch@lst.de> 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_ag.h')
-rw-r--r--fs/xfs/xfs_ag.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index 9f4815e0c96f..272ef097e2be 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -30,6 +30,7 @@ struct xfs_trans;
30 30
31#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */ 31#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
32#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */ 32#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
33#define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */
33#define XFS_AGF_VERSION 1 34#define XFS_AGF_VERSION 1
34#define XFS_AGI_VERSION 1 35#define XFS_AGI_VERSION 1
35 36
@@ -190,11 +191,31 @@ extern const struct xfs_buf_ops xfs_agi_buf_ops;
190 */ 191 */
191#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) 192#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
192#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)) 193#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
193#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
194#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr)) 194#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
195 195
196#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
197 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
198 &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
199 (__be32 *)(bp)->b_addr)
200
201/*
202 * Size of the AGFL. For CRC-enabled filesystes we steal a couple of
203 * slots in the beginning of the block for a proper header with the
204 * location information and CRC.
205 */
206#define XFS_AGFL_SIZE(mp) \
207 (((mp)->m_sb.sb_sectsize - \
208 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
209 sizeof(struct xfs_agfl) : 0)) / \
210 sizeof(xfs_agblock_t))
211
196typedef struct xfs_agfl { 212typedef struct xfs_agfl {
197 __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ 213 __be32 agfl_magicnum;
214 __be32 agfl_seqno;
215 uuid_t agfl_uuid;
216 __be64 agfl_lsn;
217 __be32 agfl_crc;
218 __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
198} xfs_agfl_t; 219} xfs_agfl_t;
199 220
200/* 221/*