aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ag.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_ag.h')
-rw-r--r--fs/xfs/xfs_ag.h56
1 files changed, 52 insertions, 4 deletions
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index f2aeedb6a579..317aa86d96ea 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
@@ -63,12 +64,29 @@ typedef struct xfs_agf {
63 __be32 agf_spare0; /* spare field */ 64 __be32 agf_spare0; /* spare field */
64 __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */ 65 __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */
65 __be32 agf_spare1; /* spare field */ 66 __be32 agf_spare1; /* spare field */
67
66 __be32 agf_flfirst; /* first freelist block's index */ 68 __be32 agf_flfirst; /* first freelist block's index */
67 __be32 agf_fllast; /* last freelist block's index */ 69 __be32 agf_fllast; /* last freelist block's index */
68 __be32 agf_flcount; /* count of blocks in freelist */ 70 __be32 agf_flcount; /* count of blocks in freelist */
69 __be32 agf_freeblks; /* total free blocks */ 71 __be32 agf_freeblks; /* total free blocks */
72
70 __be32 agf_longest; /* longest free space */ 73 __be32 agf_longest; /* longest free space */
71 __be32 agf_btreeblks; /* # of blocks held in AGF btrees */ 74 __be32 agf_btreeblks; /* # of blocks held in AGF btrees */
75 uuid_t agf_uuid; /* uuid of filesystem */
76
77 /*
78 * reserve some contiguous space for future logged fields before we add
79 * the unlogged fields. This makes the range logging via flags and
80 * structure offsets much simpler.
81 */
82 __be64 agf_spare64[16];
83
84 /* unlogged fields, written during buffer writeback. */
85 __be64 agf_lsn; /* last write sequence */
86 __be32 agf_crc; /* crc of agf sector */
87 __be32 agf_spare2;
88
89 /* structure must be padded to 64 bit alignment */
72} xfs_agf_t; 90} xfs_agf_t;
73 91
74#define XFS_AGF_MAGICNUM 0x00000001 92#define XFS_AGF_MAGICNUM 0x00000001
@@ -83,7 +101,8 @@ typedef struct xfs_agf {
83#define XFS_AGF_FREEBLKS 0x00000200 101#define XFS_AGF_FREEBLKS 0x00000200
84#define XFS_AGF_LONGEST 0x00000400 102#define XFS_AGF_LONGEST 0x00000400
85#define XFS_AGF_BTREEBLKS 0x00000800 103#define XFS_AGF_BTREEBLKS 0x00000800
86#define XFS_AGF_NUM_BITS 12 104#define XFS_AGF_UUID 0x00001000
105#define XFS_AGF_NUM_BITS 13
87#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1) 106#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
88 107
89#define XFS_AGF_FLAGS \ 108#define XFS_AGF_FLAGS \
@@ -98,7 +117,8 @@ typedef struct xfs_agf {
98 { XFS_AGF_FLCOUNT, "FLCOUNT" }, \ 117 { XFS_AGF_FLCOUNT, "FLCOUNT" }, \
99 { XFS_AGF_FREEBLKS, "FREEBLKS" }, \ 118 { XFS_AGF_FREEBLKS, "FREEBLKS" }, \
100 { XFS_AGF_LONGEST, "LONGEST" }, \ 119 { XFS_AGF_LONGEST, "LONGEST" }, \
101 { XFS_AGF_BTREEBLKS, "BTREEBLKS" } 120 { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \
121 { XFS_AGF_UUID, "UUID" }
102 122
103/* disk block (xfs_daddr_t) in the AG */ 123/* disk block (xfs_daddr_t) in the AG */
104#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log)) 124#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
@@ -132,6 +152,7 @@ typedef struct xfs_agi {
132 __be32 agi_root; /* root of inode btree */ 152 __be32 agi_root; /* root of inode btree */
133 __be32 agi_level; /* levels in inode btree */ 153 __be32 agi_level; /* levels in inode btree */
134 __be32 agi_freecount; /* number of free inodes */ 154 __be32 agi_freecount; /* number of free inodes */
155
135 __be32 agi_newino; /* new inode just allocated */ 156 __be32 agi_newino; /* new inode just allocated */
136 __be32 agi_dirino; /* last directory inode chunk */ 157 __be32 agi_dirino; /* last directory inode chunk */
137 /* 158 /*
@@ -139,6 +160,13 @@ typedef struct xfs_agi {
139 * still being referenced. 160 * still being referenced.
140 */ 161 */
141 __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS]; 162 __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
163
164 uuid_t agi_uuid; /* uuid of filesystem */
165 __be32 agi_crc; /* crc of agi sector */
166 __be32 agi_pad32;
167 __be64 agi_lsn; /* last write sequence */
168
169 /* structure must be padded to 64 bit alignment */
142} xfs_agi_t; 170} xfs_agi_t;
143 171
144#define XFS_AGI_MAGICNUM 0x00000001 172#define XFS_AGI_MAGICNUM 0x00000001
@@ -171,11 +199,31 @@ extern const struct xfs_buf_ops xfs_agi_buf_ops;
171 */ 199 */
172#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) 200#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
173#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp)) 201#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
174#define XFS_AGFL_SIZE(mp) ((mp)->m_sb.sb_sectsize / sizeof(xfs_agblock_t))
175#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr)) 202#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
176 203
204#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
205 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
206 &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
207 (__be32 *)(bp)->b_addr)
208
209/*
210 * Size of the AGFL. For CRC-enabled filesystes we steal a couple of
211 * slots in the beginning of the block for a proper header with the
212 * location information and CRC.
213 */
214#define XFS_AGFL_SIZE(mp) \
215 (((mp)->m_sb.sb_sectsize - \
216 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
217 sizeof(struct xfs_agfl) : 0)) / \
218 sizeof(xfs_agblock_t))
219
177typedef struct xfs_agfl { 220typedef struct xfs_agfl {
178 __be32 agfl_bno[1]; /* actually XFS_AGFL_SIZE(mp) */ 221 __be32 agfl_magicnum;
222 __be32 agfl_seqno;
223 uuid_t agfl_uuid;
224 __be64 agfl_lsn;
225 __be32 agfl_crc;
226 __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
179} xfs_agfl_t; 227} xfs_agfl_t;
180 228
181/* 229/*