aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/libxfs/xfs_ag.h281
-rw-r--r--fs/xfs/libxfs/xfs_alloc.c1
-rw-r--r--fs/xfs/libxfs/xfs_alloc.h3
-rw-r--r--fs/xfs/libxfs/xfs_alloc_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_attr.c3
-rw-r--r--fs/xfs/libxfs/xfs_attr_leaf.c2
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c2
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c3
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c3
-rw-r--r--fs/xfs/libxfs/xfs_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_da_format.c2
-rw-r--r--fs/xfs/libxfs/xfs_dinode.h243
-rw-r--r--fs/xfs/libxfs/xfs_dir2.c4
-rw-r--r--fs/xfs/libxfs/xfs_dir2_block.c3
-rw-r--r--fs/xfs/libxfs/xfs_dir2_data.c2
-rw-r--r--fs/xfs/libxfs/xfs_dir2_leaf.c2
-rw-r--r--fs/xfs/libxfs/xfs_dir2_node.c2
-rw-r--r--fs/xfs/libxfs/xfs_dir2_sf.c3
-rw-r--r--fs/xfs/libxfs/xfs_dquot_buf.c2
-rw-r--r--fs/xfs/libxfs/xfs_format.h1107
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.c3
-rw-r--r--fs/xfs/libxfs/xfs_ialloc.h4
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c3
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c4
-rw-r--r--fs/xfs/libxfs/xfs_inum.h60
-rw-r--r--fs/xfs/libxfs/xfs_log_format.h2
-rw-r--r--fs/xfs/libxfs/xfs_log_rlimit.c2
-rw-r--r--fs/xfs/libxfs/xfs_rtbitmap.c3
-rw-r--r--fs/xfs/libxfs/xfs_sb.c2
-rw-r--r--fs/xfs/libxfs/xfs_sb.h584
-rw-r--r--fs/xfs/libxfs/xfs_symlink_remote.c2
-rw-r--r--fs/xfs/libxfs/xfs_trans_resv.c2
-rw-r--r--fs/xfs/xfs_acl.c2
-rw-r--r--fs/xfs/xfs_acl.h36
-rw-r--r--fs/xfs/xfs_aops.c3
-rw-r--r--fs/xfs/xfs_attr_inactive.c3
-rw-r--r--fs/xfs/xfs_attr_list.c3
-rw-r--r--fs/xfs/xfs_bmap_util.c3
-rw-r--r--fs/xfs/xfs_buf.c2
-rw-r--r--fs/xfs/xfs_buf_item.c2
-rw-r--r--fs/xfs/xfs_dir2_readdir.c3
-rw-r--r--fs/xfs/xfs_discard.c1
-rw-r--r--fs/xfs/xfs_dquot.c2
-rw-r--r--fs/xfs/xfs_dquot_item.c2
-rw-r--r--fs/xfs/xfs_error.c2
-rw-r--r--fs/xfs/xfs_export.c2
-rw-r--r--fs/xfs/xfs_extent_busy.c1
-rw-r--r--fs/xfs/xfs_extfree_item.c3
-rw-r--r--fs/xfs/xfs_file.c3
-rw-r--r--fs/xfs/xfs_filestream.c3
-rw-r--r--fs/xfs/xfs_fsops.c2
-rw-r--r--fs/xfs/xfs_icache.c2
-rw-r--r--fs/xfs/xfs_icache.h8
-rw-r--r--fs/xfs/xfs_icreate_item.c3
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode.h2
-rw-r--r--fs/xfs/xfs_inode_item.c3
-rw-r--r--fs/xfs/xfs_ioctl.c3
-rw-r--r--fs/xfs/xfs_ioctl32.c2
-rw-r--r--fs/xfs/xfs_iomap.c3
-rw-r--r--fs/xfs/xfs_iops.c3
-rw-r--r--fs/xfs/xfs_itable.c4
-rw-r--r--fs/xfs/xfs_linux.h6
-rw-r--r--fs/xfs/xfs_log.c2
-rw-r--r--fs/xfs/xfs_log_cil.c3
-rw-r--r--fs/xfs/xfs_log_recover.c3
-rw-r--r--fs/xfs/xfs_message.c3
-rw-r--r--fs/xfs/xfs_mount.c3
-rw-r--r--fs/xfs/xfs_mount.h5
-rw-r--r--fs/xfs/xfs_qm.c2
-rw-r--r--fs/xfs/xfs_qm_bhv.c2
-rw-r--r--fs/xfs/xfs_qm_syscalls.c1
-rw-r--r--fs/xfs/xfs_quotaops.c2
-rw-r--r--fs/xfs/xfs_rtalloc.c3
-rw-r--r--fs/xfs/xfs_super.c3
-rw-r--r--fs/xfs/xfs_symlink.c3
-rw-r--r--fs/xfs/xfs_trace.c2
-rw-r--r--fs/xfs/xfs_trans.c2
-rw-r--r--fs/xfs/xfs_trans_ail.c3
-rw-r--r--fs/xfs/xfs_trans_buf.c2
-rw-r--r--fs/xfs/xfs_trans_dquot.c2
-rw-r--r--fs/xfs/xfs_trans_extfree.c3
-rw-r--r--fs/xfs/xfs_trans_inode.c2
-rw-r--r--fs/xfs/xfs_xattr.c2
86 files changed, 1138 insertions, 1380 deletions
diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h
deleted file mode 100644
index 6e247a99f5db..000000000000
--- a/fs/xfs/libxfs/xfs_ag.h
+++ /dev/null
@@ -1,281 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_AG_H__
19#define __XFS_AG_H__
20
21/*
22 * Allocation group header
23 * This is divided into three structures, placed in sequential 512-byte
24 * buffers after a copy of the superblock (also in a 512-byte buffer).
25 */
26
27struct xfs_buf;
28struct xfs_mount;
29struct xfs_trans;
30
31#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
32#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
33#define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */
34#define XFS_AGF_VERSION 1
35#define XFS_AGI_VERSION 1
36
37#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
38#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
39
40/*
41 * Btree number 0 is bno, 1 is cnt. This value gives the size of the
42 * arrays below.
43 */
44#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1)
45
46/*
47 * The second word of agf_levels in the first a.g. overlaps the EFS
48 * superblock's magic number. Since the magic numbers valid for EFS
49 * are > 64k, our value cannot be confused for an EFS superblock's.
50 */
51
52typedef struct xfs_agf {
53 /*
54 * Common allocation group header information
55 */
56 __be32 agf_magicnum; /* magic number == XFS_AGF_MAGIC */
57 __be32 agf_versionnum; /* header version == XFS_AGF_VERSION */
58 __be32 agf_seqno; /* sequence # starting from 0 */
59 __be32 agf_length; /* size in blocks of a.g. */
60 /*
61 * Freespace information
62 */
63 __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */
64 __be32 agf_spare0; /* spare field */
65 __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */
66 __be32 agf_spare1; /* spare field */
67
68 __be32 agf_flfirst; /* first freelist block's index */
69 __be32 agf_fllast; /* last freelist block's index */
70 __be32 agf_flcount; /* count of blocks in freelist */
71 __be32 agf_freeblks; /* total free blocks */
72
73 __be32 agf_longest; /* longest free space */
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 */
90} xfs_agf_t;
91
92#define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)
93
94#define XFS_AGF_MAGICNUM 0x00000001
95#define XFS_AGF_VERSIONNUM 0x00000002
96#define XFS_AGF_SEQNO 0x00000004
97#define XFS_AGF_LENGTH 0x00000008
98#define XFS_AGF_ROOTS 0x00000010
99#define XFS_AGF_LEVELS 0x00000020
100#define XFS_AGF_FLFIRST 0x00000040
101#define XFS_AGF_FLLAST 0x00000080
102#define XFS_AGF_FLCOUNT 0x00000100
103#define XFS_AGF_FREEBLKS 0x00000200
104#define XFS_AGF_LONGEST 0x00000400
105#define XFS_AGF_BTREEBLKS 0x00000800
106#define XFS_AGF_UUID 0x00001000
107#define XFS_AGF_NUM_BITS 13
108#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
109
110#define XFS_AGF_FLAGS \
111 { XFS_AGF_MAGICNUM, "MAGICNUM" }, \
112 { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \
113 { XFS_AGF_SEQNO, "SEQNO" }, \
114 { XFS_AGF_LENGTH, "LENGTH" }, \
115 { XFS_AGF_ROOTS, "ROOTS" }, \
116 { XFS_AGF_LEVELS, "LEVELS" }, \
117 { XFS_AGF_FLFIRST, "FLFIRST" }, \
118 { XFS_AGF_FLLAST, "FLLAST" }, \
119 { XFS_AGF_FLCOUNT, "FLCOUNT" }, \
120 { XFS_AGF_FREEBLKS, "FREEBLKS" }, \
121 { XFS_AGF_LONGEST, "LONGEST" }, \
122 { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \
123 { XFS_AGF_UUID, "UUID" }
124
125/* disk block (xfs_daddr_t) in the AG */
126#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
127#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
128#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr))
129
130extern int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
131 xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
132
133/*
134 * Size of the unlinked inode hash table in the agi.
135 */
136#define XFS_AGI_UNLINKED_BUCKETS 64
137
138typedef struct xfs_agi {
139 /*
140 * Common allocation group header information
141 */
142 __be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */
143 __be32 agi_versionnum; /* header version == XFS_AGI_VERSION */
144 __be32 agi_seqno; /* sequence # starting from 0 */
145 __be32 agi_length; /* size in blocks of a.g. */
146 /*
147 * Inode information
148 * Inodes are mapped by interpreting the inode number, so no
149 * mapping data is needed here.
150 */
151 __be32 agi_count; /* count of allocated inodes */
152 __be32 agi_root; /* root of inode btree */
153 __be32 agi_level; /* levels in inode btree */
154 __be32 agi_freecount; /* number of free inodes */
155
156 __be32 agi_newino; /* new inode just allocated */
157 __be32 agi_dirino; /* last directory inode chunk */
158 /*
159 * Hash table of inodes which have been unlinked but are
160 * still being referenced.
161 */
162 __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
163 /*
164 * This marks the end of logging region 1 and start of logging region 2.
165 */
166 uuid_t agi_uuid; /* uuid of filesystem */
167 __be32 agi_crc; /* crc of agi sector */
168 __be32 agi_pad32;
169 __be64 agi_lsn; /* last write sequence */
170
171 __be32 agi_free_root; /* root of the free inode btree */
172 __be32 agi_free_level;/* levels in free inode btree */
173
174 /* structure must be padded to 64 bit alignment */
175} xfs_agi_t;
176
177#define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)
178
179#define XFS_AGI_MAGICNUM (1 << 0)
180#define XFS_AGI_VERSIONNUM (1 << 1)
181#define XFS_AGI_SEQNO (1 << 2)
182#define XFS_AGI_LENGTH (1 << 3)
183#define XFS_AGI_COUNT (1 << 4)
184#define XFS_AGI_ROOT (1 << 5)
185#define XFS_AGI_LEVEL (1 << 6)
186#define XFS_AGI_FREECOUNT (1 << 7)
187#define XFS_AGI_NEWINO (1 << 8)
188#define XFS_AGI_DIRINO (1 << 9)
189#define XFS_AGI_UNLINKED (1 << 10)
190#define XFS_AGI_NUM_BITS_R1 11 /* end of the 1st agi logging region */
191#define XFS_AGI_ALL_BITS_R1 ((1 << XFS_AGI_NUM_BITS_R1) - 1)
192#define XFS_AGI_FREE_ROOT (1 << 11)
193#define XFS_AGI_FREE_LEVEL (1 << 12)
194#define XFS_AGI_NUM_BITS_R2 13
195
196/* disk block (xfs_daddr_t) in the AG */
197#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
198#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
199#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr))
200
201extern int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
202 xfs_agnumber_t agno, struct xfs_buf **bpp);
203
204/*
205 * The third a.g. block contains the a.g. freelist, an array
206 * of block pointers to blocks owned by the allocation btree code.
207 */
208#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
209#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
210#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
211
212#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
213 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
214 &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
215 (__be32 *)(bp)->b_addr)
216
217/*
218 * Size of the AGFL. For CRC-enabled filesystes we steal a couple of
219 * slots in the beginning of the block for a proper header with the
220 * location information and CRC.
221 */
222#define XFS_AGFL_SIZE(mp) \
223 (((mp)->m_sb.sb_sectsize - \
224 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
225 sizeof(struct xfs_agfl) : 0)) / \
226 sizeof(xfs_agblock_t))
227
228typedef struct xfs_agfl {
229 __be32 agfl_magicnum;
230 __be32 agfl_seqno;
231 uuid_t agfl_uuid;
232 __be64 agfl_lsn;
233 __be32 agfl_crc;
234 __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
235} xfs_agfl_t;
236
237#define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc)
238
239/*
240 * tags for inode radix tree
241 */
242#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged lookup
243 in xfs_inode_ag_iterator */
244#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */
245#define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */
246
247#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
248#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
249 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
250#define XFS_MIN_FREELIST(a,mp) \
251 (XFS_MIN_FREELIST_RAW( \
252 be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
253 be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
254#define XFS_MIN_FREELIST_PAG(pag,mp) \
255 (XFS_MIN_FREELIST_RAW( \
256 (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
257 (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
258
259#define XFS_AGB_TO_FSB(mp,agno,agbno) \
260 (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
261#define XFS_FSB_TO_AGNO(mp,fsbno) \
262 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
263#define XFS_FSB_TO_AGBNO(mp,fsbno) \
264 ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
265#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
266 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
267 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
268#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
269
270/*
271 * For checking for bad ranges of xfs_daddr_t's, covering multiple
272 * allocation groups or a single xfs_daddr_t that's a superblock copy.
273 */
274#define XFS_AG_CHECK_DADDR(mp,d,len) \
275 ((len) == 1 ? \
276 ASSERT((d) == XFS_SB_DADDR || \
277 xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
278 ASSERT(xfs_daddr_to_agno(mp, d) == \
279 xfs_daddr_to_agno(mp, (d) + (len) - 1)))
280
281#endif /* __XFS_AG_H__ */
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index eff34218f405..a6fbf4472017 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -23,7 +23,6 @@
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 26#include "xfs_mount.h"
28#include "xfs_inode.h" 27#include "xfs_inode.h"
29#include "xfs_btree.h" 28#include "xfs_btree.h"
diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
index feacb061bab7..d1b4b6a5c894 100644
--- a/fs/xfs/libxfs/xfs_alloc.h
+++ b/fs/xfs/libxfs/xfs_alloc.h
@@ -231,4 +231,7 @@ xfs_alloc_get_rec(
231 xfs_extlen_t *len, /* output: length of extent */ 231 xfs_extlen_t *len, /* output: length of extent */
232 int *stat); /* output: success/failure */ 232 int *stat); /* output: success/failure */
233 233
234int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
235 xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
236
234#endif /* __XFS_ALLOC_H__ */ 237#endif /* __XFS_ALLOC_H__ */
diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c
index e0e83e24d3ef..59d521c09a17 100644
--- a/fs/xfs/libxfs/xfs_alloc_btree.c
+++ b/fs/xfs/libxfs/xfs_alloc_btree.c
@@ -22,7 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_btree.h" 26#include "xfs_btree.h"
28#include "xfs_alloc_btree.h" 27#include "xfs_alloc_btree.h"
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 353fb425faef..0a472fbe06d4 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
@@ -42,7 +40,6 @@
42#include "xfs_quota.h" 40#include "xfs_quota.h"
43#include "xfs_trans_space.h" 41#include "xfs_trans_space.h"
44#include "xfs_trace.h" 42#include "xfs_trace.h"
45#include "xfs_dinode.h"
46 43
47/* 44/*
48 * xfs_attr.c 45 * xfs_attr.c
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index b1f73dbbf3d8..5d38e8b8a913 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -24,7 +24,6 @@
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h" 26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 27#include "xfs_mount.h"
29#include "xfs_da_format.h" 28#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 29#include "xfs_da_btree.h"
@@ -41,7 +40,6 @@
41#include "xfs_trace.h" 40#include "xfs_trace.h"
42#include "xfs_buf_item.h" 41#include "xfs_buf_item.h"
43#include "xfs_cksum.h" 42#include "xfs_cksum.h"
44#include "xfs_dinode.h"
45#include "xfs_dir2.h" 43#include "xfs_dir2.h"
46 44
47 45
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 7510ab8058a4..20de88d1bf86 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -23,8 +23,6 @@
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 79c981984dca..c2a36c331b9c 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -22,9 +22,7 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_inum.h"
26#include "xfs_sb.h" 25#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
@@ -46,7 +44,6 @@
46#include "xfs_trace.h" 44#include "xfs_trace.h"
47#include "xfs_symlink.h" 45#include "xfs_symlink.h"
48#include "xfs_attr_leaf.h" 46#include "xfs_attr_leaf.h"
49#include "xfs_dinode.h"
50#include "xfs_filestream.h" 47#include "xfs_filestream.h"
51 48
52 49
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index fba753308f31..2c44c8e50782 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_trans.h" 27#include "xfs_trans.h"
@@ -36,7 +34,6 @@
36#include "xfs_quota.h" 34#include "xfs_quota.h"
37#include "xfs_trace.h" 35#include "xfs_trace.h"
38#include "xfs_cksum.h" 36#include "xfs_cksum.h"
39#include "xfs_dinode.h"
40 37
41/* 38/*
42 * Determine the extent state. 39 * Determine the extent state.
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 8fe6a93ff473..81cad433df85 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_trans.h" 27#include "xfs_trans.h"
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index fd827530afec..c41e7513849e 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -23,8 +23,6 @@
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_da_format.c b/fs/xfs/libxfs/xfs_da_format.c
index 7e42fdfd2f1d..9d624a622946 100644
--- a/fs/xfs/libxfs/xfs_da_format.c
+++ b/fs/xfs/libxfs/xfs_da_format.c
@@ -22,8 +22,6 @@
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dinode.h b/fs/xfs/libxfs/xfs_dinode.h
deleted file mode 100644
index 623bbe8fd921..000000000000
--- a/fs/xfs/libxfs/xfs_dinode.h
+++ /dev/null
@@ -1,243 +0,0 @@
1/*
2 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_DINODE_H__
19#define __XFS_DINODE_H__
20
21#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
22#define XFS_DINODE_GOOD_VERSION(v) ((v) >= 1 && (v) <= 3)
23
24typedef struct xfs_timestamp {
25 __be32 t_sec; /* timestamp seconds */
26 __be32 t_nsec; /* timestamp nanoseconds */
27} xfs_timestamp_t;
28
29/*
30 * On-disk inode structure.
31 *
32 * This is just the header or "dinode core", the inode is expanded to fill a
33 * variable size the leftover area split into a data and an attribute fork.
34 * The format of the data and attribute fork depends on the format of the
35 * inode as indicated by di_format and di_aformat. To access the data and
36 * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros
37 * below.
38 *
39 * There is a very similar struct icdinode in xfs_inode which matches the
40 * layout of the first 96 bytes of this structure, but is kept in native
41 * format instead of big endian.
42 *
43 * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed
44 * padding field for v3 inodes.
45 */
46typedef struct xfs_dinode {
47 __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
48 __be16 di_mode; /* mode and type of file */
49 __u8 di_version; /* inode version */
50 __u8 di_format; /* format of di_c data */
51 __be16 di_onlink; /* old number of links to file */
52 __be32 di_uid; /* owner's user id */
53 __be32 di_gid; /* owner's group id */
54 __be32 di_nlink; /* number of links to file */
55 __be16 di_projid_lo; /* lower part of owner's project id */
56 __be16 di_projid_hi; /* higher part owner's project id */
57 __u8 di_pad[6]; /* unused, zeroed space */
58 __be16 di_flushiter; /* incremented on flush */
59 xfs_timestamp_t di_atime; /* time last accessed */
60 xfs_timestamp_t di_mtime; /* time last modified */
61 xfs_timestamp_t di_ctime; /* time created/inode modified */
62 __be64 di_size; /* number of bytes in file */
63 __be64 di_nblocks; /* # of direct & btree blocks used */
64 __be32 di_extsize; /* basic/minimum extent size for file */
65 __be32 di_nextents; /* number of extents in data fork */
66 __be16 di_anextents; /* number of extents in attribute fork*/
67 __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
68 __s8 di_aformat; /* format of attr fork's data */
69 __be32 di_dmevmask; /* DMIG event mask */
70 __be16 di_dmstate; /* DMIG state info */
71 __be16 di_flags; /* random flags, XFS_DIFLAG_... */
72 __be32 di_gen; /* generation number */
73
74 /* di_next_unlinked is the only non-core field in the old dinode */
75 __be32 di_next_unlinked;/* agi unlinked list ptr */
76
77 /* start of the extended dinode, writable fields */
78 __le32 di_crc; /* CRC of the inode */
79 __be64 di_changecount; /* number of attribute changes */
80 __be64 di_lsn; /* flush sequence */
81 __be64 di_flags2; /* more random flags */
82 __u8 di_pad2[16]; /* more padding for future expansion */
83
84 /* fields only written to during inode creation */
85 xfs_timestamp_t di_crtime; /* time created */
86 __be64 di_ino; /* inode number */
87 uuid_t di_uuid; /* UUID of the filesystem */
88
89 /* structure must be padded to 64 bit alignment */
90} xfs_dinode_t;
91
92#define XFS_DINODE_CRC_OFF offsetof(struct xfs_dinode, di_crc)
93
94#define DI_MAX_FLUSH 0xffff
95
96/*
97 * Size of the core inode on disk. Version 1 and 2 inodes have
98 * the same size, but version 3 has grown a few additional fields.
99 */
100static inline uint xfs_dinode_size(int version)
101{
102 if (version == 3)
103 return sizeof(struct xfs_dinode);
104 return offsetof(struct xfs_dinode, di_crc);
105}
106
107/*
108 * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
109 * Since the pathconf interface is signed, we use 2^31 - 1 instead.
110 * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
111 */
112#define XFS_MAXLINK ((1U << 31) - 1U)
113#define XFS_MAXLINK_1 65535U
114
115/*
116 * Values for di_format
117 */
118typedef enum xfs_dinode_fmt {
119 XFS_DINODE_FMT_DEV, /* xfs_dev_t */
120 XFS_DINODE_FMT_LOCAL, /* bulk data */
121 XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */
122 XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */
123 XFS_DINODE_FMT_UUID /* uuid_t */
124} xfs_dinode_fmt_t;
125
126/*
127 * Inode minimum and maximum sizes.
128 */
129#define XFS_DINODE_MIN_LOG 8
130#define XFS_DINODE_MAX_LOG 11
131#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)
132#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)
133
134/*
135 * Inode size for given fs.
136 */
137#define XFS_LITINO(mp, version) \
138 ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))
139
140/*
141 * Inode data & attribute fork sizes, per inode.
142 */
143#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0)
144#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3))
145
146#define XFS_DFORK_DSIZE(dip,mp) \
147 (XFS_DFORK_Q(dip) ? \
148 XFS_DFORK_BOFF(dip) : \
149 XFS_LITINO(mp, (dip)->di_version))
150#define XFS_DFORK_ASIZE(dip,mp) \
151 (XFS_DFORK_Q(dip) ? \
152 XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
153 0)
154#define XFS_DFORK_SIZE(dip,mp,w) \
155 ((w) == XFS_DATA_FORK ? \
156 XFS_DFORK_DSIZE(dip, mp) : \
157 XFS_DFORK_ASIZE(dip, mp))
158
159/*
160 * Return pointers to the data or attribute forks.
161 */
162#define XFS_DFORK_DPTR(dip) \
163 ((char *)dip + xfs_dinode_size(dip->di_version))
164#define XFS_DFORK_APTR(dip) \
165 (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))
166#define XFS_DFORK_PTR(dip,w) \
167 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
168
169#define XFS_DFORK_FORMAT(dip,w) \
170 ((w) == XFS_DATA_FORK ? \
171 (dip)->di_format : \
172 (dip)->di_aformat)
173#define XFS_DFORK_NEXTENTS(dip,w) \
174 ((w) == XFS_DATA_FORK ? \
175 be32_to_cpu((dip)->di_nextents) : \
176 be16_to_cpu((dip)->di_anextents))
177
178#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)((bp)->b_addr))
179
180/*
181 * For block and character special files the 32bit dev_t is stored at the
182 * beginning of the data fork.
183 */
184static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
185{
186 return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
187}
188
189static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
190{
191 *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);
192}
193
194/*
195 * Values for di_flags
196 * There should be a one-to-one correspondence between these flags and the
197 * XFS_XFLAG_s.
198 */
199#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */
200#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */
201#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */
202#define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */
203#define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */
204#define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */
205#define XFS_DIFLAG_NOATIME_BIT 6 /* do not update atime */
206#define XFS_DIFLAG_NODUMP_BIT 7 /* do not dump */
207#define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */
208#define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */
209#define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */
210#define XFS_DIFLAG_EXTSIZE_BIT 11 /* inode extent size allocator hint */
211#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
212#define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
213#define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
214#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
215#define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
216#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
217#define XFS_DIFLAG_IMMUTABLE (1 << XFS_DIFLAG_IMMUTABLE_BIT)
218#define XFS_DIFLAG_APPEND (1 << XFS_DIFLAG_APPEND_BIT)
219#define XFS_DIFLAG_SYNC (1 << XFS_DIFLAG_SYNC_BIT)
220#define XFS_DIFLAG_NOATIME (1 << XFS_DIFLAG_NOATIME_BIT)
221#define XFS_DIFLAG_NODUMP (1 << XFS_DIFLAG_NODUMP_BIT)
222#define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT)
223#define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT)
224#define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
225#define XFS_DIFLAG_EXTSIZE (1 << XFS_DIFLAG_EXTSIZE_BIT)
226#define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
227#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
228#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
229
230#ifdef CONFIG_XFS_RT
231#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
232#else
233#define XFS_IS_REALTIME_INODE(ip) (0)
234#endif
235
236#define XFS_DIFLAG_ANY \
237 (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
238 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
239 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
240 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
241 XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
242
243#endif /* __XFS_DINODE_H__ */
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 7075aaf131f4..d399f174a809 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -20,9 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_inum.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 23#include "xfs_mount.h"
27#include "xfs_da_format.h" 24#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 25#include "xfs_da_btree.h"
@@ -34,7 +31,6 @@
34#include "xfs_dir2_priv.h" 31#include "xfs_dir2_priv.h"
35#include "xfs_error.h" 32#include "xfs_error.h"
36#include "xfs_trace.h" 33#include "xfs_trace.h"
37#include "xfs_dinode.h"
38 34
39struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; 35struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR };
40 36
diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
index 9628ceccfa02..c2e34c54b706 100644
--- a/fs/xfs/libxfs/xfs_dir2_block.c
+++ b/fs/xfs/libxfs/xfs_dir2_block.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
@@ -36,7 +34,6 @@
36#include "xfs_error.h" 34#include "xfs_error.h"
37#include "xfs_trace.h" 35#include "xfs_trace.h"
38#include "xfs_cksum.h" 36#include "xfs_cksum.h"
39#include "xfs_dinode.h"
40 37
41/* 38/*
42 * Local function prototypes. 39 * Local function prototypes.
diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
index fdd803fecb8e..5ff31be9b1cd 100644
--- a/fs/xfs/libxfs/xfs_dir2_data.c
+++ b/fs/xfs/libxfs/xfs_dir2_data.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dir2_leaf.c b/fs/xfs/libxfs/xfs_dir2_leaf.c
index a19174eb3cb2..ed41a0e0da63 100644
--- a/fs/xfs/libxfs/xfs_dir2_leaf.c
+++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index 2ae6ac2c11ae..78ceda1bcd34 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index 5079e051ef08..2baedc40591f 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_da_format.h" 24#include "xfs_da_format.h"
27#include "xfs_da_btree.h" 25#include "xfs_da_btree.h"
@@ -32,7 +30,6 @@
32#include "xfs_dir2.h" 30#include "xfs_dir2.h"
33#include "xfs_dir2_priv.h" 31#include "xfs_dir2_priv.h"
34#include "xfs_trace.h" 32#include "xfs_trace.h"
35#include "xfs_dinode.h"
36 33
37/* 34/*
38 * Prototypes for internal functions. 35 * Prototypes for internal functions.
diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
index bb969337efc8..6fbf2d853a54 100644
--- a/fs/xfs/libxfs/xfs_dquot_buf.c
+++ b/fs/xfs/libxfs/xfs_dquot_buf.c
@@ -22,8 +22,6 @@
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_quota.h" 27#include "xfs_quota.h"
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 7e42bba9a420..fbd6da263571 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -34,6 +34,1077 @@ struct xfs_buf;
34struct xfs_ifork; 34struct xfs_ifork;
35 35
36/* 36/*
37 * Super block
38 * Fits into a sector-sized buffer at address 0 of each allocation group.
39 * Only the first of these is ever updated except during growfs.
40 */
41#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */
42#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */
43#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */
44#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */
45#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */
46#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */
47#define XFS_SB_VERSION_NUMBITS 0x000f
48#define XFS_SB_VERSION_ALLFBITS 0xfff0
49#define XFS_SB_VERSION_ATTRBIT 0x0010
50#define XFS_SB_VERSION_NLINKBIT 0x0020
51#define XFS_SB_VERSION_QUOTABIT 0x0040
52#define XFS_SB_VERSION_ALIGNBIT 0x0080
53#define XFS_SB_VERSION_DALIGNBIT 0x0100
54#define XFS_SB_VERSION_SHAREDBIT 0x0200
55#define XFS_SB_VERSION_LOGV2BIT 0x0400
56#define XFS_SB_VERSION_SECTORBIT 0x0800
57#define XFS_SB_VERSION_EXTFLGBIT 0x1000
58#define XFS_SB_VERSION_DIRV2BIT 0x2000
59#define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */
60#define XFS_SB_VERSION_MOREBITSBIT 0x8000
61
62/*
63 * Supported feature bit list is just all bits in the versionnum field because
64 * we've used them all up and understand them all. Except, of course, for the
65 * shared superblock bit, which nobody knows what it does and so is unsupported.
66 */
67#define XFS_SB_VERSION_OKBITS \
68 ((XFS_SB_VERSION_NUMBITS | XFS_SB_VERSION_ALLFBITS) & \
69 ~XFS_SB_VERSION_SHAREDBIT)
70
71/*
72 * There are two words to hold XFS "feature" bits: the original
73 * word, sb_versionnum, and sb_features2. Whenever a bit is set in
74 * sb_features2, the feature bit XFS_SB_VERSION_MOREBITSBIT must be set.
75 *
76 * These defines represent bits in sb_features2.
77 */
78#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001
79#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */
80#define XFS_SB_VERSION2_RESERVED4BIT 0x00000004
81#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */
82#define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers */
83#define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id */
84#define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */
85#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */
86
87#define XFS_SB_VERSION2_OKBITS \
88 (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
89 XFS_SB_VERSION2_ATTR2BIT | \
90 XFS_SB_VERSION2_PROJID32BIT | \
91 XFS_SB_VERSION2_FTYPE)
92
93/*
94 * Superblock - in core version. Must match the ondisk version below.
95 * Must be padded to 64 bit alignment.
96 */
97typedef struct xfs_sb {
98 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
99 __uint32_t sb_blocksize; /* logical block size, bytes */
100 xfs_rfsblock_t sb_dblocks; /* number of data blocks */
101 xfs_rfsblock_t sb_rblocks; /* number of realtime blocks */
102 xfs_rtblock_t sb_rextents; /* number of realtime extents */
103 uuid_t sb_uuid; /* file system unique id */
104 xfs_fsblock_t sb_logstart; /* starting block of log if internal */
105 xfs_ino_t sb_rootino; /* root inode number */
106 xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */
107 xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */
108 xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */
109 xfs_agblock_t sb_agblocks; /* size of an allocation group */
110 xfs_agnumber_t sb_agcount; /* number of allocation groups */
111 xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */
112 xfs_extlen_t sb_logblocks; /* number of log blocks */
113 __uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */
114 __uint16_t sb_sectsize; /* volume sector size, bytes */
115 __uint16_t sb_inodesize; /* inode size, bytes */
116 __uint16_t sb_inopblock; /* inodes per block */
117 char sb_fname[12]; /* file system name */
118 __uint8_t sb_blocklog; /* log2 of sb_blocksize */
119 __uint8_t sb_sectlog; /* log2 of sb_sectsize */
120 __uint8_t sb_inodelog; /* log2 of sb_inodesize */
121 __uint8_t sb_inopblog; /* log2 of sb_inopblock */
122 __uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */
123 __uint8_t sb_rextslog; /* log2 of sb_rextents */
124 __uint8_t sb_inprogress; /* mkfs is in progress, don't mount */
125 __uint8_t sb_imax_pct; /* max % of fs for inode space */
126 /* statistics */
127 /*
128 * These fields must remain contiguous. If you really
129 * want to change their layout, make sure you fix the
130 * code in xfs_trans_apply_sb_deltas().
131 */
132 __uint64_t sb_icount; /* allocated inodes */
133 __uint64_t sb_ifree; /* free inodes */
134 __uint64_t sb_fdblocks; /* free data blocks */
135 __uint64_t sb_frextents; /* free realtime extents */
136 /*
137 * End contiguous fields.
138 */
139 xfs_ino_t sb_uquotino; /* user quota inode */
140 xfs_ino_t sb_gquotino; /* group quota inode */
141 __uint16_t sb_qflags; /* quota flags */
142 __uint8_t sb_flags; /* misc. flags */
143 __uint8_t sb_shared_vn; /* shared version number */
144 xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
145 __uint32_t sb_unit; /* stripe or raid unit */
146 __uint32_t sb_width; /* stripe or raid width */
147 __uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
148 __uint8_t sb_logsectlog; /* log2 of the log sector size */
149 __uint16_t sb_logsectsize; /* sector size for the log, bytes */
150 __uint32_t sb_logsunit; /* stripe unit size for the log */
151 __uint32_t sb_features2; /* additional feature bits */
152
153 /*
154 * bad features2 field as a result of failing to pad the sb
155 * structure to 64 bits. Some machines will be using this field
156 * for features2 bits. Easiest just to mark it bad and not use
157 * it for anything else.
158 */
159 __uint32_t sb_bad_features2;
160
161 /* version 5 superblock fields start here */
162
163 /* feature masks */
164 __uint32_t sb_features_compat;
165 __uint32_t sb_features_ro_compat;
166 __uint32_t sb_features_incompat;
167 __uint32_t sb_features_log_incompat;
168
169 __uint32_t sb_crc; /* superblock crc */
170 __uint32_t sb_pad;
171
172 xfs_ino_t sb_pquotino; /* project quota inode */
173 xfs_lsn_t sb_lsn; /* last write sequence */
174
175 /* must be padded to 64 bit alignment */
176} xfs_sb_t;
177
178#define XFS_SB_CRC_OFF offsetof(struct xfs_sb, sb_crc)
179
180/*
181 * Superblock - on disk version. Must match the in core version above.
182 * Must be padded to 64 bit alignment.
183 */
184typedef struct xfs_dsb {
185 __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
186 __be32 sb_blocksize; /* logical block size, bytes */
187 __be64 sb_dblocks; /* number of data blocks */
188 __be64 sb_rblocks; /* number of realtime blocks */
189 __be64 sb_rextents; /* number of realtime extents */
190 uuid_t sb_uuid; /* file system unique id */
191 __be64 sb_logstart; /* starting block of log if internal */
192 __be64 sb_rootino; /* root inode number */
193 __be64 sb_rbmino; /* bitmap inode for realtime extents */
194 __be64 sb_rsumino; /* summary inode for rt bitmap */
195 __be32 sb_rextsize; /* realtime extent size, blocks */
196 __be32 sb_agblocks; /* size of an allocation group */
197 __be32 sb_agcount; /* number of allocation groups */
198 __be32 sb_rbmblocks; /* number of rt bitmap blocks */
199 __be32 sb_logblocks; /* number of log blocks */
200 __be16 sb_versionnum; /* header version == XFS_SB_VERSION */
201 __be16 sb_sectsize; /* volume sector size, bytes */
202 __be16 sb_inodesize; /* inode size, bytes */
203 __be16 sb_inopblock; /* inodes per block */
204 char sb_fname[12]; /* file system name */
205 __u8 sb_blocklog; /* log2 of sb_blocksize */
206 __u8 sb_sectlog; /* log2 of sb_sectsize */
207 __u8 sb_inodelog; /* log2 of sb_inodesize */
208 __u8 sb_inopblog; /* log2 of sb_inopblock */
209 __u8 sb_agblklog; /* log2 of sb_agblocks (rounded up) */
210 __u8 sb_rextslog; /* log2 of sb_rextents */
211 __u8 sb_inprogress; /* mkfs is in progress, don't mount */
212 __u8 sb_imax_pct; /* max % of fs for inode space */
213 /* statistics */
214 /*
215 * These fields must remain contiguous. If you really
216 * want to change their layout, make sure you fix the
217 * code in xfs_trans_apply_sb_deltas().
218 */
219 __be64 sb_icount; /* allocated inodes */
220 __be64 sb_ifree; /* free inodes */
221 __be64 sb_fdblocks; /* free data blocks */
222 __be64 sb_frextents; /* free realtime extents */
223 /*
224 * End contiguous fields.
225 */
226 __be64 sb_uquotino; /* user quota inode */
227 __be64 sb_gquotino; /* group quota inode */
228 __be16 sb_qflags; /* quota flags */
229 __u8 sb_flags; /* misc. flags */
230 __u8 sb_shared_vn; /* shared version number */
231 __be32 sb_inoalignmt; /* inode chunk alignment, fsblocks */
232 __be32 sb_unit; /* stripe or raid unit */
233 __be32 sb_width; /* stripe or raid width */
234 __u8 sb_dirblklog; /* log2 of dir block size (fsbs) */
235 __u8 sb_logsectlog; /* log2 of the log sector size */
236 __be16 sb_logsectsize; /* sector size for the log, bytes */
237 __be32 sb_logsunit; /* stripe unit size for the log */
238 __be32 sb_features2; /* additional feature bits */
239 /*
240 * bad features2 field as a result of failing to pad the sb
241 * structure to 64 bits. Some machines will be using this field
242 * for features2 bits. Easiest just to mark it bad and not use
243 * it for anything else.
244 */
245 __be32 sb_bad_features2;
246
247 /* version 5 superblock fields start here */
248
249 /* feature masks */
250 __be32 sb_features_compat;
251 __be32 sb_features_ro_compat;
252 __be32 sb_features_incompat;
253 __be32 sb_features_log_incompat;
254
255 __le32 sb_crc; /* superblock crc */
256 __be32 sb_pad;
257
258 __be64 sb_pquotino; /* project quota inode */
259 __be64 sb_lsn; /* last write sequence */
260
261 /* must be padded to 64 bit alignment */
262} xfs_dsb_t;
263
264/*
265 * Sequence number values for the fields.
266 */
267typedef enum {
268 XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
269 XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
270 XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
271 XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
272 XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
273 XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
274 XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
275 XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
276 XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
277 XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
278 XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
279 XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
280 XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
281 XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
282 XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
283 XFS_SBS_PQUOTINO, XFS_SBS_LSN,
284 XFS_SBS_FIELDCOUNT
285} xfs_sb_field_t;
286
287/*
288 * Mask values, defined based on the xfs_sb_field_t values.
289 * Only define the ones we're using.
290 */
291#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x)
292#define XFS_SB_UUID XFS_SB_MVAL(UUID)
293#define XFS_SB_FNAME XFS_SB_MVAL(FNAME)
294#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO)
295#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO)
296#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO)
297#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM)
298#define XFS_SB_UQUOTINO XFS_SB_MVAL(UQUOTINO)
299#define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO)
300#define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS)
301#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
302#define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
303#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
304#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT)
305#define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
306#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
307#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
308#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2)
309#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
310#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
311#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
312#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
313#define XFS_SB_CRC XFS_SB_MVAL(CRC)
314#define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO)
315#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
316#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
317#define XFS_SB_MOD_BITS \
318 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
319 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
320 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
321 XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
322 XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \
323 XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \
324 XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO)
325
326
327/*
328 * Misc. Flags - warning - these will be cleared by xfs_repair unless
329 * a feature bit is set when the flag is used.
330 */
331#define XFS_SBF_NOFLAGS 0x00 /* no flags set */
332#define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */
333
334/*
335 * define max. shared version we can interoperate with
336 */
337#define XFS_SB_MAX_SHARED_VN 0
338
339#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
340
341/*
342 * The first XFS version we support is a v4 superblock with V2 directories.
343 */
344static inline bool xfs_sb_good_v4_features(struct xfs_sb *sbp)
345{
346 if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
347 return false;
348
349 /* check for unknown features in the fs */
350 if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
351 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
352 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
353 return false;
354
355 return true;
356}
357
358static inline bool xfs_sb_good_version(struct xfs_sb *sbp)
359{
360 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
361 return true;
362 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
363 return xfs_sb_good_v4_features(sbp);
364 return false;
365}
366
367/*
368 * Detect a mismatched features2 field. Older kernels read/wrote
369 * this into the wrong slot, so to be safe we keep them in sync.
370 */
371static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)
372{
373 return sbp->sb_bad_features2 != sbp->sb_features2;
374}
375
376static inline bool xfs_sb_version_hasattr(struct xfs_sb *sbp)
377{
378 return (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT);
379}
380
381static inline void xfs_sb_version_addattr(struct xfs_sb *sbp)
382{
383 sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT;
384}
385
386static inline bool xfs_sb_version_hasquota(struct xfs_sb *sbp)
387{
388 return (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
389}
390
391static inline void xfs_sb_version_addquota(struct xfs_sb *sbp)
392{
393 sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
394}
395
396static inline bool xfs_sb_version_hasalign(struct xfs_sb *sbp)
397{
398 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
399 (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT));
400}
401
402static inline bool xfs_sb_version_hasdalign(struct xfs_sb *sbp)
403{
404 return (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
405}
406
407static inline bool xfs_sb_version_haslogv2(struct xfs_sb *sbp)
408{
409 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
410 (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
411}
412
413static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp)
414{
415 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
416 (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
417}
418
419static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp)
420{
421 return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
422}
423
424static inline bool xfs_sb_version_hasasciici(struct xfs_sb *sbp)
425{
426 return (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
427}
428
429static inline bool xfs_sb_version_hasmorebits(struct xfs_sb *sbp)
430{
431 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
432 (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
433}
434
435/*
436 * sb_features2 bit version macros.
437 */
438static inline bool xfs_sb_version_haslazysbcount(struct xfs_sb *sbp)
439{
440 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
441 (xfs_sb_version_hasmorebits(sbp) &&
442 (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
443}
444
445static inline bool xfs_sb_version_hasattr2(struct xfs_sb *sbp)
446{
447 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
448 (xfs_sb_version_hasmorebits(sbp) &&
449 (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT));
450}
451
452static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
453{
454 sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
455 sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
456 sbp->sb_bad_features2 |= XFS_SB_VERSION2_ATTR2BIT;
457}
458
459static inline void xfs_sb_version_removeattr2(struct xfs_sb *sbp)
460{
461 sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
462 sbp->sb_bad_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
463 if (!sbp->sb_features2)
464 sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
465}
466
467static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp)
468{
469 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
470 (xfs_sb_version_hasmorebits(sbp) &&
471 (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
472}
473
474static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
475{
476 sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
477 sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
478 sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
479}
480
481/*
482 * Extended v5 superblock feature masks. These are to be used for new v5
483 * superblock features only.
484 *
485 * Compat features are new features that old kernels will not notice or affect
486 * and so can mount read-write without issues.
487 *
488 * RO-Compat (read only) are features that old kernels can read but will break
489 * if they write. Hence only read-only mounts of such filesystems are allowed on
490 * kernels that don't support the feature bit.
491 *
492 * InCompat features are features which old kernels will not understand and so
493 * must not mount.
494 *
495 * Log-InCompat features are for changes to log formats or new transactions that
496 * can't be replayed on older kernels. The fields are set when the filesystem is
497 * mounted, and a clean unmount clears the fields.
498 */
499#define XFS_SB_FEAT_COMPAT_ALL 0
500#define XFS_SB_FEAT_COMPAT_UNKNOWN ~XFS_SB_FEAT_COMPAT_ALL
501static inline bool
502xfs_sb_has_compat_feature(
503 struct xfs_sb *sbp,
504 __uint32_t feature)
505{
506 return (sbp->sb_features_compat & feature) != 0;
507}
508
509#define XFS_SB_FEAT_RO_COMPAT_FINOBT (1 << 0) /* free inode btree */
510#define XFS_SB_FEAT_RO_COMPAT_ALL \
511 (XFS_SB_FEAT_RO_COMPAT_FINOBT)
512#define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL
513static inline bool
514xfs_sb_has_ro_compat_feature(
515 struct xfs_sb *sbp,
516 __uint32_t feature)
517{
518 return (sbp->sb_features_ro_compat & feature) != 0;
519}
520
521#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
522#define XFS_SB_FEAT_INCOMPAT_ALL \
523 (XFS_SB_FEAT_INCOMPAT_FTYPE)
524
525#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL
526static inline bool
527xfs_sb_has_incompat_feature(
528 struct xfs_sb *sbp,
529 __uint32_t feature)
530{
531 return (sbp->sb_features_incompat & feature) != 0;
532}
533
534#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0
535#define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_LOG_ALL
536static inline bool
537xfs_sb_has_incompat_log_feature(
538 struct xfs_sb *sbp,
539 __uint32_t feature)
540{
541 return (sbp->sb_features_log_incompat & feature) != 0;
542}
543
544/*
545 * V5 superblock specific feature checks
546 */
547static inline int xfs_sb_version_hascrc(struct xfs_sb *sbp)
548{
549 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
550}
551
552static inline int xfs_sb_version_has_pquotino(struct xfs_sb *sbp)
553{
554 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
555}
556
557static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
558{
559 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
560 xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) ||
561 (xfs_sb_version_hasmorebits(sbp) &&
562 (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
563}
564
565static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp)
566{
567 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) &&
568 (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT);
569}
570
571/*
572 * end of superblock version macros
573 */
574
575static inline bool
576xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
577{
578 return (ino == sbp->sb_uquotino ||
579 ino == sbp->sb_gquotino ||
580 ino == sbp->sb_pquotino);
581}
582
583#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
584#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
585#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr))
586
587#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
588#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
589 xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
590#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
591 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
592
593/*
594 * File system sector to basic block conversions.
595 */
596#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
597
598/*
599 * File system block to basic block conversions.
600 */
601#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
602#define XFS_BB_TO_FSB(mp,bb) \
603 (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
604#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log)
605
606/*
607 * File system block to byte conversions.
608 */
609#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
610#define XFS_B_TO_FSB(mp,b) \
611 ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
612#define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
613#define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
614
615/*
616 * Allocation group header
617 *
618 * This is divided into three structures, placed in sequential 512-byte
619 * buffers after a copy of the superblock (also in a 512-byte buffer).
620 */
621#define XFS_AGF_MAGIC 0x58414746 /* 'XAGF' */
622#define XFS_AGI_MAGIC 0x58414749 /* 'XAGI' */
623#define XFS_AGFL_MAGIC 0x5841464c /* 'XAFL' */
624#define XFS_AGF_VERSION 1
625#define XFS_AGI_VERSION 1
626
627#define XFS_AGF_GOOD_VERSION(v) ((v) == XFS_AGF_VERSION)
628#define XFS_AGI_GOOD_VERSION(v) ((v) == XFS_AGI_VERSION)
629
630/*
631 * Btree number 0 is bno, 1 is cnt. This value gives the size of the
632 * arrays below.
633 */
634#define XFS_BTNUM_AGF ((int)XFS_BTNUM_CNTi + 1)
635
636/*
637 * The second word of agf_levels in the first a.g. overlaps the EFS
638 * superblock's magic number. Since the magic numbers valid for EFS
639 * are > 64k, our value cannot be confused for an EFS superblock's.
640 */
641
642typedef struct xfs_agf {
643 /*
644 * Common allocation group header information
645 */
646 __be32 agf_magicnum; /* magic number == XFS_AGF_MAGIC */
647 __be32 agf_versionnum; /* header version == XFS_AGF_VERSION */
648 __be32 agf_seqno; /* sequence # starting from 0 */
649 __be32 agf_length; /* size in blocks of a.g. */
650 /*
651 * Freespace information
652 */
653 __be32 agf_roots[XFS_BTNUM_AGF]; /* root blocks */
654 __be32 agf_spare0; /* spare field */
655 __be32 agf_levels[XFS_BTNUM_AGF]; /* btree levels */
656 __be32 agf_spare1; /* spare field */
657
658 __be32 agf_flfirst; /* first freelist block's index */
659 __be32 agf_fllast; /* last freelist block's index */
660 __be32 agf_flcount; /* count of blocks in freelist */
661 __be32 agf_freeblks; /* total free blocks */
662
663 __be32 agf_longest; /* longest free space */
664 __be32 agf_btreeblks; /* # of blocks held in AGF btrees */
665 uuid_t agf_uuid; /* uuid of filesystem */
666
667 /*
668 * reserve some contiguous space for future logged fields before we add
669 * the unlogged fields. This makes the range logging via flags and
670 * structure offsets much simpler.
671 */
672 __be64 agf_spare64[16];
673
674 /* unlogged fields, written during buffer writeback. */
675 __be64 agf_lsn; /* last write sequence */
676 __be32 agf_crc; /* crc of agf sector */
677 __be32 agf_spare2;
678
679 /* structure must be padded to 64 bit alignment */
680} xfs_agf_t;
681
682#define XFS_AGF_CRC_OFF offsetof(struct xfs_agf, agf_crc)
683
684#define XFS_AGF_MAGICNUM 0x00000001
685#define XFS_AGF_VERSIONNUM 0x00000002
686#define XFS_AGF_SEQNO 0x00000004
687#define XFS_AGF_LENGTH 0x00000008
688#define XFS_AGF_ROOTS 0x00000010
689#define XFS_AGF_LEVELS 0x00000020
690#define XFS_AGF_FLFIRST 0x00000040
691#define XFS_AGF_FLLAST 0x00000080
692#define XFS_AGF_FLCOUNT 0x00000100
693#define XFS_AGF_FREEBLKS 0x00000200
694#define XFS_AGF_LONGEST 0x00000400
695#define XFS_AGF_BTREEBLKS 0x00000800
696#define XFS_AGF_UUID 0x00001000
697#define XFS_AGF_NUM_BITS 13
698#define XFS_AGF_ALL_BITS ((1 << XFS_AGF_NUM_BITS) - 1)
699
700#define XFS_AGF_FLAGS \
701 { XFS_AGF_MAGICNUM, "MAGICNUM" }, \
702 { XFS_AGF_VERSIONNUM, "VERSIONNUM" }, \
703 { XFS_AGF_SEQNO, "SEQNO" }, \
704 { XFS_AGF_LENGTH, "LENGTH" }, \
705 { XFS_AGF_ROOTS, "ROOTS" }, \
706 { XFS_AGF_LEVELS, "LEVELS" }, \
707 { XFS_AGF_FLFIRST, "FLFIRST" }, \
708 { XFS_AGF_FLLAST, "FLLAST" }, \
709 { XFS_AGF_FLCOUNT, "FLCOUNT" }, \
710 { XFS_AGF_FREEBLKS, "FREEBLKS" }, \
711 { XFS_AGF_LONGEST, "LONGEST" }, \
712 { XFS_AGF_BTREEBLKS, "BTREEBLKS" }, \
713 { XFS_AGF_UUID, "UUID" }
714
715/* disk block (xfs_daddr_t) in the AG */
716#define XFS_AGF_DADDR(mp) ((xfs_daddr_t)(1 << (mp)->m_sectbb_log))
717#define XFS_AGF_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGF_DADDR(mp))
718#define XFS_BUF_TO_AGF(bp) ((xfs_agf_t *)((bp)->b_addr))
719
720/*
721 * Size of the unlinked inode hash table in the agi.
722 */
723#define XFS_AGI_UNLINKED_BUCKETS 64
724
725typedef struct xfs_agi {
726 /*
727 * Common allocation group header information
728 */
729 __be32 agi_magicnum; /* magic number == XFS_AGI_MAGIC */
730 __be32 agi_versionnum; /* header version == XFS_AGI_VERSION */
731 __be32 agi_seqno; /* sequence # starting from 0 */
732 __be32 agi_length; /* size in blocks of a.g. */
733 /*
734 * Inode information
735 * Inodes are mapped by interpreting the inode number, so no
736 * mapping data is needed here.
737 */
738 __be32 agi_count; /* count of allocated inodes */
739 __be32 agi_root; /* root of inode btree */
740 __be32 agi_level; /* levels in inode btree */
741 __be32 agi_freecount; /* number of free inodes */
742
743 __be32 agi_newino; /* new inode just allocated */
744 __be32 agi_dirino; /* last directory inode chunk */
745 /*
746 * Hash table of inodes which have been unlinked but are
747 * still being referenced.
748 */
749 __be32 agi_unlinked[XFS_AGI_UNLINKED_BUCKETS];
750 /*
751 * This marks the end of logging region 1 and start of logging region 2.
752 */
753 uuid_t agi_uuid; /* uuid of filesystem */
754 __be32 agi_crc; /* crc of agi sector */
755 __be32 agi_pad32;
756 __be64 agi_lsn; /* last write sequence */
757
758 __be32 agi_free_root; /* root of the free inode btree */
759 __be32 agi_free_level;/* levels in free inode btree */
760
761 /* structure must be padded to 64 bit alignment */
762} xfs_agi_t;
763
764#define XFS_AGI_CRC_OFF offsetof(struct xfs_agi, agi_crc)
765
766#define XFS_AGI_MAGICNUM (1 << 0)
767#define XFS_AGI_VERSIONNUM (1 << 1)
768#define XFS_AGI_SEQNO (1 << 2)
769#define XFS_AGI_LENGTH (1 << 3)
770#define XFS_AGI_COUNT (1 << 4)
771#define XFS_AGI_ROOT (1 << 5)
772#define XFS_AGI_LEVEL (1 << 6)
773#define XFS_AGI_FREECOUNT (1 << 7)
774#define XFS_AGI_NEWINO (1 << 8)
775#define XFS_AGI_DIRINO (1 << 9)
776#define XFS_AGI_UNLINKED (1 << 10)
777#define XFS_AGI_NUM_BITS_R1 11 /* end of the 1st agi logging region */
778#define XFS_AGI_ALL_BITS_R1 ((1 << XFS_AGI_NUM_BITS_R1) - 1)
779#define XFS_AGI_FREE_ROOT (1 << 11)
780#define XFS_AGI_FREE_LEVEL (1 << 12)
781#define XFS_AGI_NUM_BITS_R2 13
782
783/* disk block (xfs_daddr_t) in the AG */
784#define XFS_AGI_DADDR(mp) ((xfs_daddr_t)(2 << (mp)->m_sectbb_log))
785#define XFS_AGI_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGI_DADDR(mp))
786#define XFS_BUF_TO_AGI(bp) ((xfs_agi_t *)((bp)->b_addr))
787
788/*
789 * The third a.g. block contains the a.g. freelist, an array
790 * of block pointers to blocks owned by the allocation btree code.
791 */
792#define XFS_AGFL_DADDR(mp) ((xfs_daddr_t)(3 << (mp)->m_sectbb_log))
793#define XFS_AGFL_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_AGFL_DADDR(mp))
794#define XFS_BUF_TO_AGFL(bp) ((xfs_agfl_t *)((bp)->b_addr))
795
796#define XFS_BUF_TO_AGFL_BNO(mp, bp) \
797 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
798 &(XFS_BUF_TO_AGFL(bp)->agfl_bno[0]) : \
799 (__be32 *)(bp)->b_addr)
800
801/*
802 * Size of the AGFL. For CRC-enabled filesystes we steal a couple of
803 * slots in the beginning of the block for a proper header with the
804 * location information and CRC.
805 */
806#define XFS_AGFL_SIZE(mp) \
807 (((mp)->m_sb.sb_sectsize - \
808 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
809 sizeof(struct xfs_agfl) : 0)) / \
810 sizeof(xfs_agblock_t))
811
812typedef struct xfs_agfl {
813 __be32 agfl_magicnum;
814 __be32 agfl_seqno;
815 uuid_t agfl_uuid;
816 __be64 agfl_lsn;
817 __be32 agfl_crc;
818 __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
819} xfs_agfl_t;
820
821#define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc)
822
823
824#define XFS_AG_MAXLEVELS(mp) ((mp)->m_ag_maxlevels)
825#define XFS_MIN_FREELIST_RAW(bl,cl,mp) \
826 (MIN(bl + 1, XFS_AG_MAXLEVELS(mp)) + MIN(cl + 1, XFS_AG_MAXLEVELS(mp)))
827#define XFS_MIN_FREELIST(a,mp) \
828 (XFS_MIN_FREELIST_RAW( \
829 be32_to_cpu((a)->agf_levels[XFS_BTNUM_BNOi]), \
830 be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
831#define XFS_MIN_FREELIST_PAG(pag,mp) \
832 (XFS_MIN_FREELIST_RAW( \
833 (unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
834 (unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
835
836#define XFS_AGB_TO_FSB(mp,agno,agbno) \
837 (((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
838#define XFS_FSB_TO_AGNO(mp,fsbno) \
839 ((xfs_agnumber_t)((fsbno) >> (mp)->m_sb.sb_agblklog))
840#define XFS_FSB_TO_AGBNO(mp,fsbno) \
841 ((xfs_agblock_t)((fsbno) & xfs_mask32lo((mp)->m_sb.sb_agblklog)))
842#define XFS_AGB_TO_DADDR(mp,agno,agbno) \
843 ((xfs_daddr_t)XFS_FSB_TO_BB(mp, \
844 (xfs_fsblock_t)(agno) * (mp)->m_sb.sb_agblocks + (agbno)))
845#define XFS_AG_DADDR(mp,agno,d) (XFS_AGB_TO_DADDR(mp, agno, 0) + (d))
846
847/*
848 * For checking for bad ranges of xfs_daddr_t's, covering multiple
849 * allocation groups or a single xfs_daddr_t that's a superblock copy.
850 */
851#define XFS_AG_CHECK_DADDR(mp,d,len) \
852 ((len) == 1 ? \
853 ASSERT((d) == XFS_SB_DADDR || \
854 xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
855 ASSERT(xfs_daddr_to_agno(mp, d) == \
856 xfs_daddr_to_agno(mp, (d) + (len) - 1)))
857
858typedef struct xfs_timestamp {
859 __be32 t_sec; /* timestamp seconds */
860 __be32 t_nsec; /* timestamp nanoseconds */
861} xfs_timestamp_t;
862
863/*
864 * On-disk inode structure.
865 *
866 * This is just the header or "dinode core", the inode is expanded to fill a
867 * variable size the leftover area split into a data and an attribute fork.
868 * The format of the data and attribute fork depends on the format of the
869 * inode as indicated by di_format and di_aformat. To access the data and
870 * attribute use the XFS_DFORK_DPTR, XFS_DFORK_APTR, and XFS_DFORK_PTR macros
871 * below.
872 *
873 * There is a very similar struct icdinode in xfs_inode which matches the
874 * layout of the first 96 bytes of this structure, but is kept in native
875 * format instead of big endian.
876 *
877 * Note: di_flushiter is only used by v1/2 inodes - it's effectively a zeroed
878 * padding field for v3 inodes.
879 */
880#define XFS_DINODE_MAGIC 0x494e /* 'IN' */
881#define XFS_DINODE_GOOD_VERSION(v) ((v) >= 1 && (v) <= 3)
882typedef struct xfs_dinode {
883 __be16 di_magic; /* inode magic # = XFS_DINODE_MAGIC */
884 __be16 di_mode; /* mode and type of file */
885 __u8 di_version; /* inode version */
886 __u8 di_format; /* format of di_c data */
887 __be16 di_onlink; /* old number of links to file */
888 __be32 di_uid; /* owner's user id */
889 __be32 di_gid; /* owner's group id */
890 __be32 di_nlink; /* number of links to file */
891 __be16 di_projid_lo; /* lower part of owner's project id */
892 __be16 di_projid_hi; /* higher part owner's project id */
893 __u8 di_pad[6]; /* unused, zeroed space */
894 __be16 di_flushiter; /* incremented on flush */
895 xfs_timestamp_t di_atime; /* time last accessed */
896 xfs_timestamp_t di_mtime; /* time last modified */
897 xfs_timestamp_t di_ctime; /* time created/inode modified */
898 __be64 di_size; /* number of bytes in file */
899 __be64 di_nblocks; /* # of direct & btree blocks used */
900 __be32 di_extsize; /* basic/minimum extent size for file */
901 __be32 di_nextents; /* number of extents in data fork */
902 __be16 di_anextents; /* number of extents in attribute fork*/
903 __u8 di_forkoff; /* attr fork offs, <<3 for 64b align */
904 __s8 di_aformat; /* format of attr fork's data */
905 __be32 di_dmevmask; /* DMIG event mask */
906 __be16 di_dmstate; /* DMIG state info */
907 __be16 di_flags; /* random flags, XFS_DIFLAG_... */
908 __be32 di_gen; /* generation number */
909
910 /* di_next_unlinked is the only non-core field in the old dinode */
911 __be32 di_next_unlinked;/* agi unlinked list ptr */
912
913 /* start of the extended dinode, writable fields */
914 __le32 di_crc; /* CRC of the inode */
915 __be64 di_changecount; /* number of attribute changes */
916 __be64 di_lsn; /* flush sequence */
917 __be64 di_flags2; /* more random flags */
918 __u8 di_pad2[16]; /* more padding for future expansion */
919
920 /* fields only written to during inode creation */
921 xfs_timestamp_t di_crtime; /* time created */
922 __be64 di_ino; /* inode number */
923 uuid_t di_uuid; /* UUID of the filesystem */
924
925 /* structure must be padded to 64 bit alignment */
926} xfs_dinode_t;
927
928#define XFS_DINODE_CRC_OFF offsetof(struct xfs_dinode, di_crc)
929
930#define DI_MAX_FLUSH 0xffff
931
932/*
933 * Size of the core inode on disk. Version 1 and 2 inodes have
934 * the same size, but version 3 has grown a few additional fields.
935 */
936static inline uint xfs_dinode_size(int version)
937{
938 if (version == 3)
939 return sizeof(struct xfs_dinode);
940 return offsetof(struct xfs_dinode, di_crc);
941}
942
943/*
944 * The 32 bit link count in the inode theoretically maxes out at UINT_MAX.
945 * Since the pathconf interface is signed, we use 2^31 - 1 instead.
946 * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX.
947 */
948#define XFS_MAXLINK ((1U << 31) - 1U)
949#define XFS_MAXLINK_1 65535U
950
951/*
952 * Values for di_format
953 */
954typedef enum xfs_dinode_fmt {
955 XFS_DINODE_FMT_DEV, /* xfs_dev_t */
956 XFS_DINODE_FMT_LOCAL, /* bulk data */
957 XFS_DINODE_FMT_EXTENTS, /* struct xfs_bmbt_rec */
958 XFS_DINODE_FMT_BTREE, /* struct xfs_bmdr_block */
959 XFS_DINODE_FMT_UUID /* uuid_t */
960} xfs_dinode_fmt_t;
961
962/*
963 * Inode minimum and maximum sizes.
964 */
965#define XFS_DINODE_MIN_LOG 8
966#define XFS_DINODE_MAX_LOG 11
967#define XFS_DINODE_MIN_SIZE (1 << XFS_DINODE_MIN_LOG)
968#define XFS_DINODE_MAX_SIZE (1 << XFS_DINODE_MAX_LOG)
969
970/*
971 * Inode size for given fs.
972 */
973#define XFS_LITINO(mp, version) \
974 ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version)))
975
976/*
977 * Inode data & attribute fork sizes, per inode.
978 */
979#define XFS_DFORK_Q(dip) ((dip)->di_forkoff != 0)
980#define XFS_DFORK_BOFF(dip) ((int)((dip)->di_forkoff << 3))
981
982#define XFS_DFORK_DSIZE(dip,mp) \
983 (XFS_DFORK_Q(dip) ? \
984 XFS_DFORK_BOFF(dip) : \
985 XFS_LITINO(mp, (dip)->di_version))
986#define XFS_DFORK_ASIZE(dip,mp) \
987 (XFS_DFORK_Q(dip) ? \
988 XFS_LITINO(mp, (dip)->di_version) - XFS_DFORK_BOFF(dip) : \
989 0)
990#define XFS_DFORK_SIZE(dip,mp,w) \
991 ((w) == XFS_DATA_FORK ? \
992 XFS_DFORK_DSIZE(dip, mp) : \
993 XFS_DFORK_ASIZE(dip, mp))
994
995/*
996 * Return pointers to the data or attribute forks.
997 */
998#define XFS_DFORK_DPTR(dip) \
999 ((char *)dip + xfs_dinode_size(dip->di_version))
1000#define XFS_DFORK_APTR(dip) \
1001 (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip))
1002#define XFS_DFORK_PTR(dip,w) \
1003 ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip))
1004
1005#define XFS_DFORK_FORMAT(dip,w) \
1006 ((w) == XFS_DATA_FORK ? \
1007 (dip)->di_format : \
1008 (dip)->di_aformat)
1009#define XFS_DFORK_NEXTENTS(dip,w) \
1010 ((w) == XFS_DATA_FORK ? \
1011 be32_to_cpu((dip)->di_nextents) : \
1012 be16_to_cpu((dip)->di_anextents))
1013
1014/*
1015 * For block and character special files the 32bit dev_t is stored at the
1016 * beginning of the data fork.
1017 */
1018static inline xfs_dev_t xfs_dinode_get_rdev(struct xfs_dinode *dip)
1019{
1020 return be32_to_cpu(*(__be32 *)XFS_DFORK_DPTR(dip));
1021}
1022
1023static inline void xfs_dinode_put_rdev(struct xfs_dinode *dip, xfs_dev_t rdev)
1024{
1025 *(__be32 *)XFS_DFORK_DPTR(dip) = cpu_to_be32(rdev);
1026}
1027
1028/*
1029 * Values for di_flags
1030 * There should be a one-to-one correspondence between these flags and the
1031 * XFS_XFLAG_s.
1032 */
1033#define XFS_DIFLAG_REALTIME_BIT 0 /* file's blocks come from rt area */
1034#define XFS_DIFLAG_PREALLOC_BIT 1 /* file space has been preallocated */
1035#define XFS_DIFLAG_NEWRTBM_BIT 2 /* for rtbitmap inode, new format */
1036#define XFS_DIFLAG_IMMUTABLE_BIT 3 /* inode is immutable */
1037#define XFS_DIFLAG_APPEND_BIT 4 /* inode is append-only */
1038#define XFS_DIFLAG_SYNC_BIT 5 /* inode is written synchronously */
1039#define XFS_DIFLAG_NOATIME_BIT 6 /* do not update atime */
1040#define XFS_DIFLAG_NODUMP_BIT 7 /* do not dump */
1041#define XFS_DIFLAG_RTINHERIT_BIT 8 /* create with realtime bit set */
1042#define XFS_DIFLAG_PROJINHERIT_BIT 9 /* create with parents projid */
1043#define XFS_DIFLAG_NOSYMLINKS_BIT 10 /* disallow symlink creation */
1044#define XFS_DIFLAG_EXTSIZE_BIT 11 /* inode extent size allocator hint */
1045#define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
1046#define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
1047#define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
1048#define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
1049#define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
1050#define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
1051#define XFS_DIFLAG_IMMUTABLE (1 << XFS_DIFLAG_IMMUTABLE_BIT)
1052#define XFS_DIFLAG_APPEND (1 << XFS_DIFLAG_APPEND_BIT)
1053#define XFS_DIFLAG_SYNC (1 << XFS_DIFLAG_SYNC_BIT)
1054#define XFS_DIFLAG_NOATIME (1 << XFS_DIFLAG_NOATIME_BIT)
1055#define XFS_DIFLAG_NODUMP (1 << XFS_DIFLAG_NODUMP_BIT)
1056#define XFS_DIFLAG_RTINHERIT (1 << XFS_DIFLAG_RTINHERIT_BIT)
1057#define XFS_DIFLAG_PROJINHERIT (1 << XFS_DIFLAG_PROJINHERIT_BIT)
1058#define XFS_DIFLAG_NOSYMLINKS (1 << XFS_DIFLAG_NOSYMLINKS_BIT)
1059#define XFS_DIFLAG_EXTSIZE (1 << XFS_DIFLAG_EXTSIZE_BIT)
1060#define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
1061#define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
1062#define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
1063
1064#define XFS_DIFLAG_ANY \
1065 (XFS_DIFLAG_REALTIME | XFS_DIFLAG_PREALLOC | XFS_DIFLAG_NEWRTBM | \
1066 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
1067 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
1068 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
1069 XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
1070
1071/*
1072 * Inode number format:
1073 * low inopblog bits - offset in block
1074 * next agblklog bits - block number in ag
1075 * next agno_log bits - ag number
1076 * high agno_log-agblklog-inopblog bits - 0
1077 */
1078#define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)
1079#define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog
1080#define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog
1081#define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log
1082#define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log
1083#define XFS_INO_BITS(mp) \
1084 XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
1085#define XFS_INO_TO_AGNO(mp,i) \
1086 ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
1087#define XFS_INO_TO_AGINO(mp,i) \
1088 ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
1089#define XFS_INO_TO_AGBNO(mp,i) \
1090 (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
1091 XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
1092#define XFS_INO_TO_OFFSET(mp,i) \
1093 ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
1094#define XFS_INO_TO_FSB(mp,i) \
1095 XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
1096#define XFS_AGINO_TO_INO(mp,a,i) \
1097 (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
1098#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
1099#define XFS_AGINO_TO_OFFSET(mp,i) \
1100 ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
1101#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
1102 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
1103
1104#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
1105#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
1106
1107/*
37 * RealTime Device format definitions 1108 * RealTime Device format definitions
38 */ 1109 */
39 1110
@@ -413,4 +1484,40 @@ struct xfs_btree_block {
413#define XFS_BTREE_LBLOCK_CRC_OFF \ 1484#define XFS_BTREE_LBLOCK_CRC_OFF \
414 offsetof(struct xfs_btree_block, bb_u.l.bb_crc) 1485 offsetof(struct xfs_btree_block, bb_u.l.bb_crc)
415 1486
1487/*
1488 * On-disk XFS access control list structure.
1489 */
1490struct xfs_acl_entry {
1491 __be32 ae_tag;
1492 __be32 ae_id;
1493 __be16 ae_perm;
1494 __be16 ae_pad; /* fill the implicit hole in the structure */
1495};
1496
1497struct xfs_acl {
1498 __be32 acl_cnt;
1499 struct xfs_acl_entry acl_entry[0];
1500};
1501
1502/*
1503 * The number of ACL entries allowed is defined by the on-disk format.
1504 * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is
1505 * limited only by the maximum size of the xattr that stores the information.
1506 */
1507#define XFS_ACL_MAX_ENTRIES(mp) \
1508 (xfs_sb_version_hascrc(&mp->m_sb) \
1509 ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
1510 sizeof(struct xfs_acl_entry) \
1511 : 25)
1512
1513#define XFS_ACL_MAX_SIZE(mp) \
1514 (sizeof(struct xfs_acl) + \
1515 sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
1516
1517/* On-disk XFS extended attribute names */
1518#define SGI_ACL_FILE (unsigned char *)"SGI_ACL_FILE"
1519#define SGI_ACL_DEFAULT (unsigned char *)"SGI_ACL_DEFAULT"
1520#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
1521#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
1522
416#endif /* __XFS_FORMAT_H__ */ 1523#endif /* __XFS_FORMAT_H__ */
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 23dcb72fc5e6..92d2617e61fa 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -22,9 +22,7 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_inum.h"
26#include "xfs_sb.h" 25#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_inode.h" 27#include "xfs_inode.h"
30#include "xfs_btree.h" 28#include "xfs_btree.h"
@@ -39,7 +37,6 @@
39#include "xfs_buf_item.h" 37#include "xfs_buf_item.h"
40#include "xfs_icreate_item.h" 38#include "xfs_icreate_item.h"
41#include "xfs_icache.h" 39#include "xfs_icache.h"
42#include "xfs_dinode.h"
43#include "xfs_trace.h" 40#include "xfs_trace.h"
44 41
45 42
diff --git a/fs/xfs/libxfs/xfs_ialloc.h b/fs/xfs/libxfs/xfs_ialloc.h
index 95ad1c002d60..100007d56449 100644
--- a/fs/xfs/libxfs/xfs_ialloc.h
+++ b/fs/xfs/libxfs/xfs_ialloc.h
@@ -160,4 +160,8 @@ int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
160 xfs_agnumber_t agno, xfs_agblock_t agbno, 160 xfs_agnumber_t agno, xfs_agblock_t agbno,
161 xfs_agblock_t length, unsigned int gen); 161 xfs_agblock_t length, unsigned int gen);
162 162
163int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
164 xfs_agnumber_t agno, struct xfs_buf **bpp);
165
166
163#endif /* __XFS_IALLOC_H__ */ 167#endif /* __XFS_IALLOC_H__ */
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index c9b06f30fe86..964c465ca69c 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_btree.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_btree.h" 27#include "xfs_btree.h"
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index f18fd2da49f7..002b6b3a1988 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_error.h" 26#include "xfs_error.h"
@@ -30,7 +28,6 @@
30#include "xfs_icache.h" 28#include "xfs_icache.h"
31#include "xfs_trans.h" 29#include "xfs_trans.h"
32#include "xfs_ialloc.h" 30#include "xfs_ialloc.h"
33#include "xfs_dinode.h"
34 31
35/* 32/*
36 * Check that none of the inode's in the buffer have a next 33 * Check that none of the inode's in the buffer have a next
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 6a00f7fed69d..0defbd02f62d 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -22,9 +22,6 @@
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_inum.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 25#include "xfs_mount.h"
29#include "xfs_inode.h" 26#include "xfs_inode.h"
30#include "xfs_trans.h" 27#include "xfs_trans.h"
@@ -34,7 +31,6 @@
34#include "xfs_error.h" 31#include "xfs_error.h"
35#include "xfs_trace.h" 32#include "xfs_trace.h"
36#include "xfs_attr_sf.h" 33#include "xfs_attr_sf.h"
37#include "xfs_dinode.h"
38 34
39kmem_zone_t *xfs_ifork_zone; 35kmem_zone_t *xfs_ifork_zone;
40 36
diff --git a/fs/xfs/libxfs/xfs_inum.h b/fs/xfs/libxfs/xfs_inum.h
deleted file mode 100644
index 4ff2278e147a..000000000000
--- a/fs/xfs/libxfs/xfs_inum.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_INUM_H__
19#define __XFS_INUM_H__
20
21/*
22 * Inode number format:
23 * low inopblog bits - offset in block
24 * next agblklog bits - block number in ag
25 * next agno_log bits - ag number
26 * high agno_log-agblklog-inopblog bits - 0
27 */
28
29struct xfs_mount;
30
31#define XFS_INO_MASK(k) (__uint32_t)((1ULL << (k)) - 1)
32#define XFS_INO_OFFSET_BITS(mp) (mp)->m_sb.sb_inopblog
33#define XFS_INO_AGBNO_BITS(mp) (mp)->m_sb.sb_agblklog
34#define XFS_INO_AGINO_BITS(mp) (mp)->m_agino_log
35#define XFS_INO_AGNO_BITS(mp) (mp)->m_agno_log
36#define XFS_INO_BITS(mp) \
37 XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp)
38#define XFS_INO_TO_AGNO(mp,i) \
39 ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
40#define XFS_INO_TO_AGINO(mp,i) \
41 ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
42#define XFS_INO_TO_AGBNO(mp,i) \
43 (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
44 XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
45#define XFS_INO_TO_OFFSET(mp,i) \
46 ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
47#define XFS_INO_TO_FSB(mp,i) \
48 XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
49#define XFS_AGINO_TO_INO(mp,a,i) \
50 (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
51#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
52#define XFS_AGINO_TO_OFFSET(mp,i) \
53 ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
54#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
55 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
56
57#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
58#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
59
60#endif /* __XFS_INUM_H__ */
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index aff12f2d4428..265314690415 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -361,7 +361,7 @@ typedef struct xfs_ictimestamp {
361 361
362/* 362/*
363 * NOTE: This structure must be kept identical to struct xfs_dinode 363 * NOTE: This structure must be kept identical to struct xfs_dinode
364 * in xfs_dinode.h except for the endianness annotations. 364 * except for the endianness annotations.
365 */ 365 */
366typedef struct xfs_icdinode { 366typedef struct xfs_icdinode {
367 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ 367 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
diff --git a/fs/xfs/libxfs/xfs_log_rlimit.c b/fs/xfs/libxfs/xfs_log_rlimit.c
index ee7e0e80246b..c10597973333 100644
--- a/fs/xfs/libxfs/xfs_log_rlimit.c
+++ b/fs/xfs/libxfs/xfs_log_rlimit.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_ag.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_trans_space.h" 26#include "xfs_trans_space.h"
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c
index 7c818f1e4484..9b59ffa1fc19 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.c
+++ b/fs/xfs/libxfs/xfs_rtbitmap.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_bmap.h" 27#include "xfs_bmap.h"
@@ -36,7 +34,6 @@
36#include "xfs_trace.h" 34#include "xfs_trace.h"
37#include "xfs_buf.h" 35#include "xfs_buf.h"
38#include "xfs_icache.h" 36#include "xfs_icache.h"
39#include "xfs_dinode.h"
40#include "xfs_rtalloc.h" 37#include "xfs_rtalloc.h"
41 38
42 39
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 5f902fa7913f..752915fa775a 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -23,7 +23,6 @@
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 26#include "xfs_mount.h"
28#include "xfs_inode.h" 27#include "xfs_inode.h"
29#include "xfs_ialloc.h" 28#include "xfs_ialloc.h"
@@ -33,7 +32,6 @@
33#include "xfs_cksum.h" 32#include "xfs_cksum.h"
34#include "xfs_trans.h" 33#include "xfs_trans.h"
35#include "xfs_buf_item.h" 34#include "xfs_buf_item.h"
36#include "xfs_dinode.h"
37#include "xfs_bmap_btree.h" 35#include "xfs_bmap_btree.h"
38#include "xfs_alloc_btree.h" 36#include "xfs_alloc_btree.h"
39#include "xfs_ialloc_btree.h" 37#include "xfs_ialloc_btree.h"
diff --git a/fs/xfs/libxfs/xfs_sb.h b/fs/xfs/libxfs/xfs_sb.h
index 2e739708afd3..8eb1c54bafbf 100644
--- a/fs/xfs/libxfs/xfs_sb.h
+++ b/fs/xfs/libxfs/xfs_sb.h
@@ -19,590 +19,6 @@
19#define __XFS_SB_H__ 19#define __XFS_SB_H__
20 20
21/* 21/*
22 * Super block
23 * Fits into a sector-sized buffer at address 0 of each allocation group.
24 * Only the first of these is ever updated except during growfs.
25 */
26
27struct xfs_buf;
28struct xfs_mount;
29struct xfs_trans;
30
31#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */
32#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */
33#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */
34#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */
35#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */
36#define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */
37#define XFS_SB_VERSION_NUMBITS 0x000f
38#define XFS_SB_VERSION_ALLFBITS 0xfff0
39#define XFS_SB_VERSION_ATTRBIT 0x0010
40#define XFS_SB_VERSION_NLINKBIT 0x0020
41#define XFS_SB_VERSION_QUOTABIT 0x0040
42#define XFS_SB_VERSION_ALIGNBIT 0x0080
43#define XFS_SB_VERSION_DALIGNBIT 0x0100
44#define XFS_SB_VERSION_SHAREDBIT 0x0200
45#define XFS_SB_VERSION_LOGV2BIT 0x0400
46#define XFS_SB_VERSION_SECTORBIT 0x0800
47#define XFS_SB_VERSION_EXTFLGBIT 0x1000
48#define XFS_SB_VERSION_DIRV2BIT 0x2000
49#define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */
50#define XFS_SB_VERSION_MOREBITSBIT 0x8000
51
52/*
53 * Supported feature bit list is just all bits in the versionnum field because
54 * we've used them all up and understand them all. Except, of course, for the
55 * shared superblock bit, which nobody knows what it does and so is unsupported.
56 */
57#define XFS_SB_VERSION_OKBITS \
58 ((XFS_SB_VERSION_NUMBITS | XFS_SB_VERSION_ALLFBITS) & \
59 ~XFS_SB_VERSION_SHAREDBIT)
60
61/*
62 * There are two words to hold XFS "feature" bits: the original
63 * word, sb_versionnum, and sb_features2. Whenever a bit is set in
64 * sb_features2, the feature bit XFS_SB_VERSION_MOREBITSBIT must be set.
65 *
66 * These defines represent bits in sb_features2.
67 */
68#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001
69#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */
70#define XFS_SB_VERSION2_RESERVED4BIT 0x00000004
71#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */
72#define XFS_SB_VERSION2_PARENTBIT 0x00000010 /* parent pointers */
73#define XFS_SB_VERSION2_PROJID32BIT 0x00000080 /* 32 bit project id */
74#define XFS_SB_VERSION2_CRCBIT 0x00000100 /* metadata CRCs */
75#define XFS_SB_VERSION2_FTYPE 0x00000200 /* inode type in dir */
76
77#define XFS_SB_VERSION2_OKBITS \
78 (XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
79 XFS_SB_VERSION2_ATTR2BIT | \
80 XFS_SB_VERSION2_PROJID32BIT | \
81 XFS_SB_VERSION2_FTYPE)
82
83/*
84 * Superblock - in core version. Must match the ondisk version below.
85 * Must be padded to 64 bit alignment.
86 */
87typedef struct xfs_sb {
88 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
89 __uint32_t sb_blocksize; /* logical block size, bytes */
90 xfs_rfsblock_t sb_dblocks; /* number of data blocks */
91 xfs_rfsblock_t sb_rblocks; /* number of realtime blocks */
92 xfs_rtblock_t sb_rextents; /* number of realtime extents */
93 uuid_t sb_uuid; /* file system unique id */
94 xfs_fsblock_t sb_logstart; /* starting block of log if internal */
95 xfs_ino_t sb_rootino; /* root inode number */
96 xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */
97 xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */
98 xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */
99 xfs_agblock_t sb_agblocks; /* size of an allocation group */
100 xfs_agnumber_t sb_agcount; /* number of allocation groups */
101 xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */
102 xfs_extlen_t sb_logblocks; /* number of log blocks */
103 __uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */
104 __uint16_t sb_sectsize; /* volume sector size, bytes */
105 __uint16_t sb_inodesize; /* inode size, bytes */
106 __uint16_t sb_inopblock; /* inodes per block */
107 char sb_fname[12]; /* file system name */
108 __uint8_t sb_blocklog; /* log2 of sb_blocksize */
109 __uint8_t sb_sectlog; /* log2 of sb_sectsize */
110 __uint8_t sb_inodelog; /* log2 of sb_inodesize */
111 __uint8_t sb_inopblog; /* log2 of sb_inopblock */
112 __uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */
113 __uint8_t sb_rextslog; /* log2 of sb_rextents */
114 __uint8_t sb_inprogress; /* mkfs is in progress, don't mount */
115 __uint8_t sb_imax_pct; /* max % of fs for inode space */
116 /* statistics */
117 /*
118 * These fields must remain contiguous. If you really
119 * want to change their layout, make sure you fix the
120 * code in xfs_trans_apply_sb_deltas().
121 */
122 __uint64_t sb_icount; /* allocated inodes */
123 __uint64_t sb_ifree; /* free inodes */
124 __uint64_t sb_fdblocks; /* free data blocks */
125 __uint64_t sb_frextents; /* free realtime extents */
126 /*
127 * End contiguous fields.
128 */
129 xfs_ino_t sb_uquotino; /* user quota inode */
130 xfs_ino_t sb_gquotino; /* group quota inode */
131 __uint16_t sb_qflags; /* quota flags */
132 __uint8_t sb_flags; /* misc. flags */
133 __uint8_t sb_shared_vn; /* shared version number */
134 xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
135 __uint32_t sb_unit; /* stripe or raid unit */
136 __uint32_t sb_width; /* stripe or raid width */
137 __uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
138 __uint8_t sb_logsectlog; /* log2 of the log sector size */
139 __uint16_t sb_logsectsize; /* sector size for the log, bytes */
140 __uint32_t sb_logsunit; /* stripe unit size for the log */
141 __uint32_t sb_features2; /* additional feature bits */
142
143 /*
144 * bad features2 field as a result of failing to pad the sb
145 * structure to 64 bits. Some machines will be using this field
146 * for features2 bits. Easiest just to mark it bad and not use
147 * it for anything else.
148 */
149 __uint32_t sb_bad_features2;
150
151 /* version 5 superblock fields start here */
152
153 /* feature masks */
154 __uint32_t sb_features_compat;
155 __uint32_t sb_features_ro_compat;
156 __uint32_t sb_features_incompat;
157 __uint32_t sb_features_log_incompat;
158
159 __uint32_t sb_crc; /* superblock crc */
160 __uint32_t sb_pad;
161
162 xfs_ino_t sb_pquotino; /* project quota inode */
163 xfs_lsn_t sb_lsn; /* last write sequence */
164
165 /* must be padded to 64 bit alignment */
166} xfs_sb_t;
167
168#define XFS_SB_CRC_OFF offsetof(struct xfs_sb, sb_crc)
169
170/*
171 * Superblock - on disk version. Must match the in core version above.
172 * Must be padded to 64 bit alignment.
173 */
174typedef struct xfs_dsb {
175 __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
176 __be32 sb_blocksize; /* logical block size, bytes */
177 __be64 sb_dblocks; /* number of data blocks */
178 __be64 sb_rblocks; /* number of realtime blocks */
179 __be64 sb_rextents; /* number of realtime extents */
180 uuid_t sb_uuid; /* file system unique id */
181 __be64 sb_logstart; /* starting block of log if internal */
182 __be64 sb_rootino; /* root inode number */
183 __be64 sb_rbmino; /* bitmap inode for realtime extents */
184 __be64 sb_rsumino; /* summary inode for rt bitmap */
185 __be32 sb_rextsize; /* realtime extent size, blocks */
186 __be32 sb_agblocks; /* size of an allocation group */
187 __be32 sb_agcount; /* number of allocation groups */
188 __be32 sb_rbmblocks; /* number of rt bitmap blocks */
189 __be32 sb_logblocks; /* number of log blocks */
190 __be16 sb_versionnum; /* header version == XFS_SB_VERSION */
191 __be16 sb_sectsize; /* volume sector size, bytes */
192 __be16 sb_inodesize; /* inode size, bytes */
193 __be16 sb_inopblock; /* inodes per block */
194 char sb_fname[12]; /* file system name */
195 __u8 sb_blocklog; /* log2 of sb_blocksize */
196 __u8 sb_sectlog; /* log2 of sb_sectsize */
197 __u8 sb_inodelog; /* log2 of sb_inodesize */
198 __u8 sb_inopblog; /* log2 of sb_inopblock */
199 __u8 sb_agblklog; /* log2 of sb_agblocks (rounded up) */
200 __u8 sb_rextslog; /* log2 of sb_rextents */
201 __u8 sb_inprogress; /* mkfs is in progress, don't mount */
202 __u8 sb_imax_pct; /* max % of fs for inode space */
203 /* statistics */
204 /*
205 * These fields must remain contiguous. If you really
206 * want to change their layout, make sure you fix the
207 * code in xfs_trans_apply_sb_deltas().
208 */
209 __be64 sb_icount; /* allocated inodes */
210 __be64 sb_ifree; /* free inodes */
211 __be64 sb_fdblocks; /* free data blocks */
212 __be64 sb_frextents; /* free realtime extents */
213 /*
214 * End contiguous fields.
215 */
216 __be64 sb_uquotino; /* user quota inode */
217 __be64 sb_gquotino; /* group quota inode */
218 __be16 sb_qflags; /* quota flags */
219 __u8 sb_flags; /* misc. flags */
220 __u8 sb_shared_vn; /* shared version number */
221 __be32 sb_inoalignmt; /* inode chunk alignment, fsblocks */
222 __be32 sb_unit; /* stripe or raid unit */
223 __be32 sb_width; /* stripe or raid width */
224 __u8 sb_dirblklog; /* log2 of dir block size (fsbs) */
225 __u8 sb_logsectlog; /* log2 of the log sector size */
226 __be16 sb_logsectsize; /* sector size for the log, bytes */
227 __be32 sb_logsunit; /* stripe unit size for the log */
228 __be32 sb_features2; /* additional feature bits */
229 /*
230 * bad features2 field as a result of failing to pad the sb
231 * structure to 64 bits. Some machines will be using this field
232 * for features2 bits. Easiest just to mark it bad and not use
233 * it for anything else.
234 */
235 __be32 sb_bad_features2;
236
237 /* version 5 superblock fields start here */
238
239 /* feature masks */
240 __be32 sb_features_compat;
241 __be32 sb_features_ro_compat;
242 __be32 sb_features_incompat;
243 __be32 sb_features_log_incompat;
244
245 __le32 sb_crc; /* superblock crc */
246 __be32 sb_pad;
247
248 __be64 sb_pquotino; /* project quota inode */
249 __be64 sb_lsn; /* last write sequence */
250
251 /* must be padded to 64 bit alignment */
252} xfs_dsb_t;
253
254/*
255 * Sequence number values for the fields.
256 */
257typedef enum {
258 XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
259 XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
260 XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
261 XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
262 XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
263 XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
264 XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
265 XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
266 XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
267 XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
268 XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
269 XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
270 XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2, XFS_SBS_FEATURES_COMPAT,
271 XFS_SBS_FEATURES_RO_COMPAT, XFS_SBS_FEATURES_INCOMPAT,
272 XFS_SBS_FEATURES_LOG_INCOMPAT, XFS_SBS_CRC, XFS_SBS_PAD,
273 XFS_SBS_PQUOTINO, XFS_SBS_LSN,
274 XFS_SBS_FIELDCOUNT
275} xfs_sb_field_t;
276
277/*
278 * Mask values, defined based on the xfs_sb_field_t values.
279 * Only define the ones we're using.
280 */
281#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x)
282#define XFS_SB_UUID XFS_SB_MVAL(UUID)
283#define XFS_SB_FNAME XFS_SB_MVAL(FNAME)
284#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO)
285#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO)
286#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO)
287#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM)
288#define XFS_SB_UQUOTINO XFS_SB_MVAL(UQUOTINO)
289#define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO)
290#define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS)
291#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
292#define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
293#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
294#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT)
295#define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
296#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
297#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
298#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2)
299#define XFS_SB_FEATURES_COMPAT XFS_SB_MVAL(FEATURES_COMPAT)
300#define XFS_SB_FEATURES_RO_COMPAT XFS_SB_MVAL(FEATURES_RO_COMPAT)
301#define XFS_SB_FEATURES_INCOMPAT XFS_SB_MVAL(FEATURES_INCOMPAT)
302#define XFS_SB_FEATURES_LOG_INCOMPAT XFS_SB_MVAL(FEATURES_LOG_INCOMPAT)
303#define XFS_SB_CRC XFS_SB_MVAL(CRC)
304#define XFS_SB_PQUOTINO XFS_SB_MVAL(PQUOTINO)
305#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
306#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
307#define XFS_SB_MOD_BITS \
308 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
309 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
310 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
311 XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
312 XFS_SB_BAD_FEATURES2 | XFS_SB_FEATURES_COMPAT | \
313 XFS_SB_FEATURES_RO_COMPAT | XFS_SB_FEATURES_INCOMPAT | \
314 XFS_SB_FEATURES_LOG_INCOMPAT | XFS_SB_PQUOTINO)
315
316
317/*
318 * Misc. Flags - warning - these will be cleared by xfs_repair unless
319 * a feature bit is set when the flag is used.
320 */
321#define XFS_SBF_NOFLAGS 0x00 /* no flags set */
322#define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */
323
324/*
325 * define max. shared version we can interoperate with
326 */
327#define XFS_SB_MAX_SHARED_VN 0
328
329#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
330
331/*
332 * The first XFS version we support is a v4 superblock with V2 directories.
333 */
334static inline bool xfs_sb_good_v4_features(struct xfs_sb *sbp)
335{
336 if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT))
337 return false;
338
339 /* check for unknown features in the fs */
340 if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS) ||
341 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) &&
342 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS)))
343 return false;
344
345 return true;
346}
347
348static inline bool xfs_sb_good_version(struct xfs_sb *sbp)
349{
350 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5)
351 return true;
352 if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4)
353 return xfs_sb_good_v4_features(sbp);
354 return false;
355}
356
357/*
358 * Detect a mismatched features2 field. Older kernels read/wrote
359 * this into the wrong slot, so to be safe we keep them in sync.
360 */
361static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)
362{
363 return sbp->sb_bad_features2 != sbp->sb_features2;
364}
365
366static inline bool xfs_sb_version_hasattr(struct xfs_sb *sbp)
367{
368 return (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT);
369}
370
371static inline void xfs_sb_version_addattr(struct xfs_sb *sbp)
372{
373 sbp->sb_versionnum |= XFS_SB_VERSION_ATTRBIT;
374}
375
376static inline bool xfs_sb_version_hasquota(struct xfs_sb *sbp)
377{
378 return (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
379}
380
381static inline void xfs_sb_version_addquota(struct xfs_sb *sbp)
382{
383 sbp->sb_versionnum |= XFS_SB_VERSION_QUOTABIT;
384}
385
386static inline bool xfs_sb_version_hasalign(struct xfs_sb *sbp)
387{
388 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
389 (sbp->sb_versionnum & XFS_SB_VERSION_ALIGNBIT));
390}
391
392static inline bool xfs_sb_version_hasdalign(struct xfs_sb *sbp)
393{
394 return (sbp->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
395}
396
397static inline bool xfs_sb_version_haslogv2(struct xfs_sb *sbp)
398{
399 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
400 (sbp->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
401}
402
403static inline bool xfs_sb_version_hasextflgbit(struct xfs_sb *sbp)
404{
405 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
406 (sbp->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
407}
408
409static inline bool xfs_sb_version_hassector(struct xfs_sb *sbp)
410{
411 return (sbp->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
412}
413
414static inline bool xfs_sb_version_hasasciici(struct xfs_sb *sbp)
415{
416 return (sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
417}
418
419static inline bool xfs_sb_version_hasmorebits(struct xfs_sb *sbp)
420{
421 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 ||
422 (sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
423}
424
425/*
426 * sb_features2 bit version macros.
427 */
428static inline bool xfs_sb_version_haslazysbcount(struct xfs_sb *sbp)
429{
430 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
431 (xfs_sb_version_hasmorebits(sbp) &&
432 (sbp->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
433}
434
435static inline bool xfs_sb_version_hasattr2(struct xfs_sb *sbp)
436{
437 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
438 (xfs_sb_version_hasmorebits(sbp) &&
439 (sbp->sb_features2 & XFS_SB_VERSION2_ATTR2BIT));
440}
441
442static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
443{
444 sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
445 sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
446 sbp->sb_bad_features2 |= XFS_SB_VERSION2_ATTR2BIT;
447}
448
449static inline void xfs_sb_version_removeattr2(struct xfs_sb *sbp)
450{
451 sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
452 sbp->sb_bad_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
453 if (!sbp->sb_features2)
454 sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
455}
456
457static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp)
458{
459 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
460 (xfs_sb_version_hasmorebits(sbp) &&
461 (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT));
462}
463
464static inline void xfs_sb_version_addprojid32bit(struct xfs_sb *sbp)
465{
466 sbp->sb_versionnum |= XFS_SB_VERSION_MOREBITSBIT;
467 sbp->sb_features2 |= XFS_SB_VERSION2_PROJID32BIT;
468 sbp->sb_bad_features2 |= XFS_SB_VERSION2_PROJID32BIT;
469}
470
471/*
472 * Extended v5 superblock feature masks. These are to be used for new v5
473 * superblock features only.
474 *
475 * Compat features are new features that old kernels will not notice or affect
476 * and so can mount read-write without issues.
477 *
478 * RO-Compat (read only) are features that old kernels can read but will break
479 * if they write. Hence only read-only mounts of such filesystems are allowed on
480 * kernels that don't support the feature bit.
481 *
482 * InCompat features are features which old kernels will not understand and so
483 * must not mount.
484 *
485 * Log-InCompat features are for changes to log formats or new transactions that
486 * can't be replayed on older kernels. The fields are set when the filesystem is
487 * mounted, and a clean unmount clears the fields.
488 */
489#define XFS_SB_FEAT_COMPAT_ALL 0
490#define XFS_SB_FEAT_COMPAT_UNKNOWN ~XFS_SB_FEAT_COMPAT_ALL
491static inline bool
492xfs_sb_has_compat_feature(
493 struct xfs_sb *sbp,
494 __uint32_t feature)
495{
496 return (sbp->sb_features_compat & feature) != 0;
497}
498
499#define XFS_SB_FEAT_RO_COMPAT_FINOBT (1 << 0) /* free inode btree */
500#define XFS_SB_FEAT_RO_COMPAT_ALL \
501 (XFS_SB_FEAT_RO_COMPAT_FINOBT)
502#define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL
503static inline bool
504xfs_sb_has_ro_compat_feature(
505 struct xfs_sb *sbp,
506 __uint32_t feature)
507{
508 return (sbp->sb_features_ro_compat & feature) != 0;
509}
510
511#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
512#define XFS_SB_FEAT_INCOMPAT_ALL \
513 (XFS_SB_FEAT_INCOMPAT_FTYPE)
514
515#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL
516static inline bool
517xfs_sb_has_incompat_feature(
518 struct xfs_sb *sbp,
519 __uint32_t feature)
520{
521 return (sbp->sb_features_incompat & feature) != 0;
522}
523
524#define XFS_SB_FEAT_INCOMPAT_LOG_ALL 0
525#define XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_LOG_ALL
526static inline bool
527xfs_sb_has_incompat_log_feature(
528 struct xfs_sb *sbp,
529 __uint32_t feature)
530{
531 return (sbp->sb_features_log_incompat & feature) != 0;
532}
533
534/*
535 * V5 superblock specific feature checks
536 */
537static inline int xfs_sb_version_hascrc(struct xfs_sb *sbp)
538{
539 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
540}
541
542static inline int xfs_sb_version_has_pquotino(struct xfs_sb *sbp)
543{
544 return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
545}
546
547static inline int xfs_sb_version_hasftype(struct xfs_sb *sbp)
548{
549 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
550 xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) ||
551 (xfs_sb_version_hasmorebits(sbp) &&
552 (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE));
553}
554
555static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp)
556{
557 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) &&
558 (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT);
559}
560
561/*
562 * end of superblock version macros
563 */
564
565static inline bool
566xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
567{
568 return (ino == sbp->sb_uquotino ||
569 ino == sbp->sb_gquotino ||
570 ino == sbp->sb_pquotino);
571}
572
573#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
574#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
575#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)((bp)->b_addr))
576
577#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
578#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
579 xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
580#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
581 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
582
583/*
584 * File system sector to basic block conversions.
585 */
586#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
587
588/*
589 * File system block to basic block conversions.
590 */
591#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
592#define XFS_BB_TO_FSB(mp,bb) \
593 (((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
594#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log)
595
596/*
597 * File system block to byte conversions.
598 */
599#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
600#define XFS_B_TO_FSB(mp,b) \
601 ((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
602#define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
603#define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
604
605/*
606 * perag get/put wrappers for ref counting 22 * perag get/put wrappers for ref counting
607 */ 23 */
608extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t); 24extern struct xfs_perag *xfs_perag_get(struct xfs_mount *, xfs_agnumber_t);
diff --git a/fs/xfs/libxfs/xfs_symlink_remote.c b/fs/xfs/libxfs/xfs_symlink_remote.c
index 5782f037eab4..c80c5236c3da 100644
--- a/fs/xfs/libxfs/xfs_symlink_remote.c
+++ b/fs/xfs/libxfs/xfs_symlink_remote.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_shared.h" 23#include "xfs_shared.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_ag.h"
26#include "xfs_sb.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_bmap_btree.h" 26#include "xfs_bmap_btree.h"
29#include "xfs_inode.h" 27#include "xfs_inode.h"
diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c
index f2bda7c76b8a..6c1330f29050 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.c
+++ b/fs/xfs/libxfs/xfs_trans_resv.c
@@ -22,8 +22,6 @@
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index a65fa5dde6e9..4b641676f258 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -19,8 +19,6 @@
19#include "xfs_format.h" 19#include "xfs_format.h"
20#include "xfs_log_format.h" 20#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 21#include "xfs_trans_resv.h"
22#include "xfs_ag.h"
23#include "xfs_sb.h"
24#include "xfs_mount.h" 22#include "xfs_mount.h"
25#include "xfs_inode.h" 23#include "xfs_inode.h"
26#include "xfs_acl.h" 24#include "xfs_acl.h"
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index 5dc163744511..3841b07f27bf 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -22,42 +22,6 @@ struct inode;
22struct posix_acl; 22struct posix_acl;
23struct xfs_inode; 23struct xfs_inode;
24 24
25#define XFS_ACL_NOT_PRESENT (-1)
26
27/* On-disk XFS access control list structure */
28struct xfs_acl_entry {
29 __be32 ae_tag;
30 __be32 ae_id;
31 __be16 ae_perm;
32 __be16 ae_pad; /* fill the implicit hole in the structure */
33};
34
35struct xfs_acl {
36 __be32 acl_cnt;
37 struct xfs_acl_entry acl_entry[0];
38};
39
40/*
41 * The number of ACL entries allowed is defined by the on-disk format.
42 * For v4 superblocks, that is limited to 25 entries. For v5 superblocks, it is
43 * limited only by the maximum size of the xattr that stores the information.
44 */
45#define XFS_ACL_MAX_ENTRIES(mp) \
46 (xfs_sb_version_hascrc(&mp->m_sb) \
47 ? (XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
48 sizeof(struct xfs_acl_entry) \
49 : 25)
50
51#define XFS_ACL_MAX_SIZE(mp) \
52 (sizeof(struct xfs_acl) + \
53 sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
54
55/* On-disk XFS extended attribute names */
56#define SGI_ACL_FILE (unsigned char *)"SGI_ACL_FILE"
57#define SGI_ACL_DEFAULT (unsigned char *)"SGI_ACL_DEFAULT"
58#define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
59#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
60
61#ifdef CONFIG_XFS_POSIX_ACL 25#ifdef CONFIG_XFS_POSIX_ACL
62extern struct posix_acl *xfs_get_acl(struct inode *inode, int type); 26extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);
63extern int xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); 27extern int xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index f5b2453a43b2..18e2f3bbae5e 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_inode.h" 24#include "xfs_inode.h"
27#include "xfs_trans.h" 25#include "xfs_trans.h"
@@ -33,7 +31,6 @@
33#include "xfs_bmap.h" 31#include "xfs_bmap.h"
34#include "xfs_bmap_util.h" 32#include "xfs_bmap_util.h"
35#include "xfs_bmap_btree.h" 33#include "xfs_bmap_btree.h"
36#include "xfs_dinode.h"
37#include <linux/aio.h> 34#include <linux/aio.h>
38#include <linux/gfp.h> 35#include <linux/gfp.h>
39#include <linux/mpage.h> 36#include <linux/mpage.h>
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index aa2a8b1838a2..83af4c149635 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -23,8 +23,6 @@
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
@@ -39,7 +37,6 @@
39#include "xfs_error.h" 37#include "xfs_error.h"
40#include "xfs_quota.h" 38#include "xfs_quota.h"
41#include "xfs_trace.h" 39#include "xfs_trace.h"
42#include "xfs_dinode.h"
43#include "xfs_dir2.h" 40#include "xfs_dir2.h"
44 41
45/* 42/*
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 62db83ab6cbc..a43d370d2c58 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
@@ -39,7 +37,6 @@
39#include "xfs_trace.h" 37#include "xfs_trace.h"
40#include "xfs_buf_item.h" 38#include "xfs_buf_item.h"
41#include "xfs_cksum.h" 39#include "xfs_cksum.h"
42#include "xfs_dinode.h"
43#include "xfs_dir2.h" 40#include "xfs_dir2.h"
44 41
45STATIC int 42STATIC int
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 281002689d64..22a5dcb70b32 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -23,8 +23,6 @@
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_inode.h" 28#include "xfs_inode.h"
@@ -42,7 +40,6 @@
42#include "xfs_trace.h" 40#include "xfs_trace.h"
43#include "xfs_icache.h" 41#include "xfs_icache.h"
44#include "xfs_log.h" 42#include "xfs_log.h"
45#include "xfs_dinode.h"
46 43
47/* Kernel only BMAP related definitions and functions */ 44/* Kernel only BMAP related definitions and functions */
48 45
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index d083889535a2..a4ce39025dcc 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -34,10 +34,10 @@
34#include <linux/backing-dev.h> 34#include <linux/backing-dev.h>
35#include <linux/freezer.h> 35#include <linux/freezer.h>
36 36
37#include "xfs_format.h"
37#include "xfs_log_format.h" 38#include "xfs_log_format.h"
38#include "xfs_trans_resv.h" 39#include "xfs_trans_resv.h"
39#include "xfs_sb.h" 40#include "xfs_sb.h"
40#include "xfs_ag.h"
41#include "xfs_mount.h" 41#include "xfs_mount.h"
42#include "xfs_trace.h" 42#include "xfs_trace.h"
43#include "xfs_log.h" 43#include "xfs_log.h"
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index f15969543326..3f9bd58edec7 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -17,11 +17,11 @@
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_format.h"
20#include "xfs_log_format.h" 21#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
22#include "xfs_bit.h" 23#include "xfs_bit.h"
23#include "xfs_sb.h" 24#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 25#include "xfs_mount.h"
26#include "xfs_trans.h" 26#include "xfs_trans.h"
27#include "xfs_buf_item.h" 27#include "xfs_buf_item.h"
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index f1b69edcdf31..b5a10d2e9aef 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
@@ -34,7 +32,6 @@
34#include "xfs_trace.h" 32#include "xfs_trace.h"
35#include "xfs_bmap.h" 33#include "xfs_bmap.h"
36#include "xfs_trans.h" 34#include "xfs_trans.h"
37#include "xfs_dinode.h"
38 35
39/* 36/*
40 * Directory file type support functions 37 * Directory file type support functions
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 13d08a1b390e..799e5a2d334d 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -20,7 +20,6 @@
20#include "xfs_log_format.h" 20#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 21#include "xfs_trans_resv.h"
22#include "xfs_sb.h" 22#include "xfs_sb.h"
23#include "xfs_ag.h"
24#include "xfs_mount.h" 23#include "xfs_mount.h"
25#include "xfs_quota.h" 24#include "xfs_quota.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 63c2de49f61d..02c01bbbc789 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -22,8 +22,6 @@
22#include "xfs_shared.h" 22#include "xfs_shared.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_bmap.h" 27#include "xfs_bmap.h"
diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c
index f33fbaaa4d8a..814cff94e78f 100644
--- a/fs/xfs/xfs_dquot_item.c
+++ b/fs/xfs/xfs_dquot_item.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_inode.h" 24#include "xfs_inode.h"
27#include "xfs_quota.h" 25#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index b92fd7bc49e3..3ee186ac1093 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -20,8 +20,6 @@
20#include "xfs_fs.h" 20#include "xfs_fs.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_error.h" 24#include "xfs_error.h"
27 25
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
index 5a6bd5d8779a..0a0a6fa11ce1 100644
--- a/fs/xfs/xfs_export.c
+++ b/fs/xfs/xfs_export.c
@@ -19,8 +19,6 @@
19#include "xfs_format.h" 19#include "xfs_format.h"
20#include "xfs_log_format.h" 20#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 21#include "xfs_trans_resv.h"
22#include "xfs_sb.h"
23#include "xfs_ag.h"
24#include "xfs_mount.h" 22#include "xfs_mount.h"
25#include "xfs_da_format.h" 23#include "xfs_da_format.h"
26#include "xfs_dir2.h" 24#include "xfs_dir2.h"
diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c
index fd22f69049d4..c263e079273e 100644
--- a/fs/xfs/xfs_extent_busy.c
+++ b/fs/xfs/xfs_extent_busy.c
@@ -24,7 +24,6 @@
24#include "xfs_shared.h" 24#include "xfs_shared.h"
25#include "xfs_trans_resv.h" 25#include "xfs_trans_resv.h"
26#include "xfs_sb.h" 26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 27#include "xfs_mount.h"
29#include "xfs_alloc.h" 28#include "xfs_alloc.h"
30#include "xfs_extent_busy.h" 29#include "xfs_extent_busy.h"
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index c4327419dc5c..cb7fe64cdbfa 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -17,10 +17,9 @@
17 */ 17 */
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_format.h"
20#include "xfs_log_format.h" 21#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
22#include "xfs_sb.h"
23#include "xfs_ag.h"
24#include "xfs_mount.h" 23#include "xfs_mount.h"
25#include "xfs_trans.h" 24#include "xfs_trans.h"
26#include "xfs_trans_priv.h" 25#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index eb596b419942..e2b1a8116f1c 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
@@ -37,7 +35,6 @@
37#include "xfs_ioctl.h" 35#include "xfs_ioctl.h"
38#include "xfs_trace.h" 36#include "xfs_trace.h"
39#include "xfs_log.h" 37#include "xfs_log.h"
40#include "xfs_dinode.h"
41#include "xfs_icache.h" 38#include "xfs_icache.h"
42 39
43#include <linux/aio.h> 40#include <linux/aio.h>
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c
index e92730c1d3ca..a2e86e8a0fea 100644
--- a/fs/xfs/xfs_filestream.c
+++ b/fs/xfs/xfs_filestream.c
@@ -20,16 +20,13 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_ag.h"
24#include "xfs_sb.h" 23#include "xfs_sb.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inum.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_bmap.h" 26#include "xfs_bmap.h"
29#include "xfs_bmap_util.h" 27#include "xfs_bmap_util.h"
30#include "xfs_alloc.h" 28#include "xfs_alloc.h"
31#include "xfs_mru_cache.h" 29#include "xfs_mru_cache.h"
32#include "xfs_dinode.h"
33#include "xfs_filestream.h" 30#include "xfs_filestream.h"
34#include "xfs_trace.h" 31#include "xfs_trace.h"
35 32
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index c05ac8b70fa9..fdc64220fcb0 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -22,7 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h" 24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_da_format.h" 26#include "xfs_da_format.h"
28#include "xfs_da_btree.h" 27#include "xfs_da_btree.h"
@@ -40,7 +39,6 @@
40#include "xfs_rtalloc.h" 39#include "xfs_rtalloc.h"
41#include "xfs_trace.h" 40#include "xfs_trace.h"
42#include "xfs_log.h" 41#include "xfs_log.h"
43#include "xfs_dinode.h"
44#include "xfs_filestream.h" 42#include "xfs_filestream.h"
45 43
46/* 44/*
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index b45f7b27b5df..92ca910d0ec6 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -20,9 +20,7 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_inum.h"
24#include "xfs_sb.h" 23#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_error.h" 26#include "xfs_error.h"
diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
index 46748b86b12f..62f1f91c32cb 100644
--- a/fs/xfs/xfs_icache.h
+++ b/fs/xfs/xfs_icache.h
@@ -34,6 +34,14 @@ struct xfs_eofblocks {
34#define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */ 34#define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */
35 35
36/* 36/*
37 * tags for inode radix tree
38 */
39#define XFS_ICI_NO_TAG (-1) /* special flag for an untagged lookup
40 in xfs_inode_ag_iterator */
41#define XFS_ICI_RECLAIM_TAG 0 /* inode is to be reclaimed */
42#define XFS_ICI_EOFBLOCKS_TAG 1 /* inode has blocks beyond EOF */
43
44/*
37 * Flags for xfs_iget() 45 * Flags for xfs_iget()
38 */ 46 */
39#define XFS_IGET_CREATE 0x1 47#define XFS_IGET_CREATE 0x1
diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
index 7e4549233251..d45ca72af6fb 100644
--- a/fs/xfs/xfs_icreate_item.c
+++ b/fs/xfs/xfs_icreate_item.c
@@ -18,11 +18,10 @@
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_shared.h" 20#include "xfs_shared.h"
21#include "xfs_format.h"
21#include "xfs_log_format.h" 22#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
23#include "xfs_bit.h" 24#include "xfs_bit.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_trans.h" 26#include "xfs_trans.h"
28#include "xfs_trans_priv.h" 27#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 2ffb80267e37..fb2f9008b354 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -23,9 +23,7 @@
23#include "xfs_format.h" 23#include "xfs_format.h"
24#include "xfs_log_format.h" 24#include "xfs_log_format.h"
25#include "xfs_trans_resv.h" 25#include "xfs_trans_resv.h"
26#include "xfs_inum.h"
27#include "xfs_sb.h" 26#include "xfs_sb.h"
28#include "xfs_ag.h"
29#include "xfs_mount.h" 27#include "xfs_mount.h"
30#include "xfs_inode.h" 28#include "xfs_inode.h"
31#include "xfs_da_format.h" 29#include "xfs_da_format.h"
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 9af2882e1f4c..4ed2ba9342dc 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -20,7 +20,6 @@
20 20
21#include "xfs_inode_buf.h" 21#include "xfs_inode_buf.h"
22#include "xfs_inode_fork.h" 22#include "xfs_inode_fork.h"
23#include "xfs_dinode.h"
24 23
25/* 24/*
26 * Kernel only inode definitions 25 * Kernel only inode definitions
@@ -324,7 +323,6 @@ static inline int xfs_isiflocked(struct xfs_inode *ip)
324 (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ 323 (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
325 ((pip)->i_d.di_mode & S_ISGID)) 324 ((pip)->i_d.di_mode & S_ISGID))
326 325
327
328int xfs_release(struct xfs_inode *ip); 326int xfs_release(struct xfs_inode *ip);
329void xfs_inactive(struct xfs_inode *ip); 327void xfs_inactive(struct xfs_inode *ip);
330int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, 328int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 63de0b0acc32..bf13a5a7e2f4 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_inode.h" 24#include "xfs_inode.h"
27#include "xfs_trans.h" 25#include "xfs_trans.h"
@@ -29,7 +27,6 @@
29#include "xfs_error.h" 27#include "xfs_error.h"
30#include "xfs_trace.h" 28#include "xfs_trace.h"
31#include "xfs_trans_priv.h" 29#include "xfs_trans_priv.h"
32#include "xfs_dinode.h"
33#include "xfs_log.h" 30#include "xfs_log.h"
34 31
35 32
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 24c926b6fe85..a1831980a68e 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_ioctl.h" 26#include "xfs_ioctl.h"
@@ -40,7 +38,6 @@
40#include "xfs_trace.h" 38#include "xfs_trace.h"
41#include "xfs_icache.h" 39#include "xfs_icache.h"
42#include "xfs_symlink.h" 40#include "xfs_symlink.h"
43#include "xfs_dinode.h"
44#include "xfs_trans.h" 41#include "xfs_trans.h"
45 42
46#include <linux/capability.h> 43#include <linux/capability.h>
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 94ce027e28e3..ec6772866f3d 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -25,8 +25,6 @@
25#include "xfs_format.h" 25#include "xfs_format.h"
26#include "xfs_log_format.h" 26#include "xfs_log_format.h"
27#include "xfs_trans_resv.h" 27#include "xfs_trans_resv.h"
28#include "xfs_sb.h"
29#include "xfs_ag.h"
30#include "xfs_mount.h" 28#include "xfs_mount.h"
31#include "xfs_inode.h" 29#include "xfs_inode.h"
32#include "xfs_itable.h" 30#include "xfs_itable.h"
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index afcf3c926565..2262ce32926a 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_btree.h" 26#include "xfs_btree.h"
@@ -38,7 +36,6 @@
38#include "xfs_quota.h" 36#include "xfs_quota.h"
39#include "xfs_dquot_item.h" 37#include "xfs_dquot_item.h"
40#include "xfs_dquot.h" 38#include "xfs_dquot.h"
41#include "xfs_dinode.h"
42 39
43 40
44#define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \ 41#define XFS_WRITEIO_ALIGN(mp,off) (((off) >> mp->m_writeio_log) \
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index ec6dcdc181ee..f14a3e5e4a0a 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
@@ -38,7 +36,6 @@
38#include "xfs_symlink.h" 36#include "xfs_symlink.h"
39#include "xfs_da_btree.h" 37#include "xfs_da_btree.h"
40#include "xfs_dir2_priv.h" 38#include "xfs_dir2_priv.h"
41#include "xfs_dinode.h"
42#include "xfs_trans_space.h" 39#include "xfs_trans_space.h"
43 40
44#include <linux/capability.h> 41#include <linux/capability.h>
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 894924a5129b..5930d668b989 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -21,9 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_inum.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 24#include "xfs_mount.h"
28#include "xfs_inode.h" 25#include "xfs_inode.h"
29#include "xfs_btree.h" 26#include "xfs_btree.h"
@@ -33,7 +30,6 @@
33#include "xfs_error.h" 30#include "xfs_error.h"
34#include "xfs_trace.h" 31#include "xfs_trace.h"
35#include "xfs_icache.h" 32#include "xfs_icache.h"
36#include "xfs_dinode.h"
37 33
38STATIC int 34STATIC int
39xfs_internal_inum( 35xfs_internal_inum(
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 6a51619d8690..c31d2c2eadc4 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -384,4 +384,10 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
384#endif /* XFS_WARN */ 384#endif /* XFS_WARN */
385#endif /* DEBUG */ 385#endif /* DEBUG */
386 386
387#ifdef CONFIG_XFS_RT
388#define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
389#else
390#define XFS_IS_REALTIME_INODE(ip) (0)
391#endif
392
387#endif /* __XFS_LINUX__ */ 393#endif /* __XFS_LINUX__ */
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index e810e9df91b7..f6d6b8b66165 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_error.h" 25#include "xfs_error.h"
28#include "xfs_trans.h" 26#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index f506c457011e..45cc0ce18adf 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -17,11 +17,10 @@
17 17
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_format.h"
20#include "xfs_log_format.h" 21#include "xfs_log_format.h"
21#include "xfs_shared.h" 22#include "xfs_shared.h"
22#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_error.h" 25#include "xfs_error.h"
27#include "xfs_alloc.h" 26#include "xfs_alloc.h"
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 00cd7f3a8f59..75705dd047b5 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -22,9 +22,7 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_inum.h"
26#include "xfs_sb.h" 25#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_inode.h" 28#include "xfs_inode.h"
@@ -42,7 +40,6 @@
42#include "xfs_trace.h" 40#include "xfs_trace.h"
43#include "xfs_icache.h" 41#include "xfs_icache.h"
44#include "xfs_bmap_btree.h" 42#include "xfs_bmap_btree.h"
45#include "xfs_dinode.h"
46#include "xfs_error.h" 43#include "xfs_error.h"
47#include "xfs_dir2.h" 44#include "xfs_dir2.h"
48 45
diff --git a/fs/xfs/xfs_message.c b/fs/xfs/xfs_message.c
index 63ca2f0420b1..d8b67547ab34 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -17,10 +17,9 @@
17 17
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_format.h"
20#include "xfs_log_format.h" 21#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
22#include "xfs_sb.h"
23#include "xfs_ag.h"
24#include "xfs_mount.h" 23#include "xfs_mount.h"
25 24
26/* 25/*
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 13d117089101..f51e4629006f 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -22,9 +22,7 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_inum.h"
26#include "xfs_sb.h" 25#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_inode.h" 28#include "xfs_inode.h"
@@ -41,7 +39,6 @@
41#include "xfs_fsops.h" 39#include "xfs_fsops.h"
42#include "xfs_trace.h" 40#include "xfs_trace.h"
43#include "xfs_icache.h" 41#include "xfs_icache.h"
44#include "xfs_dinode.h"
45#include "xfs_sysfs.h" 42#include "xfs_sysfs.h"
46 43
47 44
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 01fb28f5ae1c..22ccf69d4d3c 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -321,10 +321,7 @@ typedef struct xfs_mod_sb {
321 321
322/* 322/*
323 * Per-ag incore structure, copies of information in agf and agi, to improve the 323 * Per-ag incore structure, copies of information in agf and agi, to improve the
324 * performance of allocation group selection. This is defined for the kernel 324 * performance of allocation group selection.
325 * only, and hence is defined here instead of in xfs_ag.h. You need the struct
326 * xfs_mount to be defined to look up a xfs_perag anyway (via mp->m_perag_tree),
327 * so this doesn't introduce any strange header file dependencies.
328 */ 325 */
329typedef struct xfs_perag { 326typedef struct xfs_perag {
330 struct xfs_mount *pag_mount; /* owner filesystem */ 327 struct xfs_mount *pag_mount; /* owner filesystem */
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index d68f23021af3..26d4a8d89dfa 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -23,7 +23,6 @@
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h" 25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 26#include "xfs_mount.h"
28#include "xfs_inode.h" 27#include "xfs_inode.h"
29#include "xfs_ialloc.h" 28#include "xfs_ialloc.h"
@@ -38,7 +37,6 @@
38#include "xfs_trace.h" 37#include "xfs_trace.h"
39#include "xfs_icache.h" 38#include "xfs_icache.h"
40#include "xfs_cksum.h" 39#include "xfs_cksum.h"
41#include "xfs_dinode.h"
42 40
43/* 41/*
44 * The global quota manager. There is only one of these for the entire 42 * The global quota manager. There is only one of these for the entire
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index 2c61e61b0205..3e52d5de7ae1 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_quota.h" 23#include "xfs_quota.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index d1e0ab7a5d12..74fca68e43b6 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -26,7 +26,6 @@
26#include "xfs_trans_resv.h" 26#include "xfs_trans_resv.h"
27#include "xfs_bit.h" 27#include "xfs_bit.h"
28#include "xfs_sb.h" 28#include "xfs_sb.h"
29#include "xfs_ag.h"
30#include "xfs_mount.h" 29#include "xfs_mount.h"
31#include "xfs_inode.h" 30#include "xfs_inode.h"
32#include "xfs_trans.h" 31#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index b238027df987..7542bbeca6a1 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -19,8 +19,6 @@
19#include "xfs_format.h" 19#include "xfs_format.h"
20#include "xfs_log_format.h" 20#include "xfs_log_format.h"
21#include "xfs_trans_resv.h" 21#include "xfs_trans_resv.h"
22#include "xfs_sb.h"
23#include "xfs_ag.h"
24#include "xfs_mount.h" 22#include "xfs_mount.h"
25#include "xfs_inode.h" 23#include "xfs_inode.h"
26#include "xfs_quota.h" 24#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index e1175ea9b551..f2079b6911cc 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -22,8 +22,6 @@
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_bmap.h" 27#include "xfs_bmap.h"
@@ -36,7 +34,6 @@
36#include "xfs_trace.h" 34#include "xfs_trace.h"
37#include "xfs_buf.h" 35#include "xfs_buf.h"
38#include "xfs_icache.h" 36#include "xfs_icache.h"
39#include "xfs_dinode.h"
40#include "xfs_rtalloc.h" 37#include "xfs_rtalloc.h"
41 38
42 39
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 03e3cc242902..ebd99ea4543a 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -21,9 +21,7 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_inum.h"
25#include "xfs_sb.h" 24#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_da_format.h" 26#include "xfs_da_format.h"
29#include "xfs_inode.h" 27#include "xfs_inode.h"
@@ -44,7 +42,6 @@
44#include "xfs_icache.h" 42#include "xfs_icache.h"
45#include "xfs_trace.h" 43#include "xfs_trace.h"
46#include "xfs_icreate_item.h" 44#include "xfs_icreate_item.h"
47#include "xfs_dinode.h"
48#include "xfs_filestream.h" 45#include "xfs_filestream.h"
49#include "xfs_quota.h" 46#include "xfs_quota.h"
50#include "xfs_sysfs.h" 47#include "xfs_sysfs.h"
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 02ae62a998e0..25791df6f638 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -23,8 +23,6 @@
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_bit.h" 25#include "xfs_bit.h"
26#include "xfs_sb.h"
27#include "xfs_ag.h"
28#include "xfs_mount.h" 26#include "xfs_mount.h"
29#include "xfs_da_format.h" 27#include "xfs_da_format.h"
30#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
@@ -42,7 +40,6 @@
42#include "xfs_symlink.h" 40#include "xfs_symlink.h"
43#include "xfs_trans.h" 41#include "xfs_trans.h"
44#include "xfs_log.h" 42#include "xfs_log.h"
45#include "xfs_dinode.h"
46 43
47/* ----- Kernel only functions below ----- */ 44/* ----- Kernel only functions below ----- */
48STATIC int 45STATIC int
diff --git a/fs/xfs/xfs_trace.c b/fs/xfs/xfs_trace.c
index 1e85bcd0e418..13a029806805 100644
--- a/fs/xfs/xfs_trace.c
+++ b/fs/xfs/xfs_trace.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_da_format.h" 25#include "xfs_da_format.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 30e8e3410955..fa3135b9bf04 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -22,8 +22,6 @@
22#include "xfs_format.h" 22#include "xfs_format.h"
23#include "xfs_log_format.h" 23#include "xfs_log_format.h"
24#include "xfs_trans_resv.h" 24#include "xfs_trans_resv.h"
25#include "xfs_sb.h"
26#include "xfs_ag.h"
27#include "xfs_mount.h" 25#include "xfs_mount.h"
28#include "xfs_inode.h" 26#include "xfs_inode.h"
29#include "xfs_extent_busy.h" 27#include "xfs_extent_busy.h"
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 859482f53b5a..573aefb5a573 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -18,10 +18,9 @@
18 */ 18 */
19#include "xfs.h" 19#include "xfs.h"
20#include "xfs_fs.h" 20#include "xfs_fs.h"
21#include "xfs_format.h"
21#include "xfs_log_format.h" 22#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_trans.h" 25#include "xfs_trans.h"
27#include "xfs_trans_priv.h" 26#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index e2b2216b1635..d3d80bef59e1 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_trans.h" 26#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index 846e061c2e98..76a16df55ef7 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_error.h" 26#include "xfs_error.h"
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index 47978ba89dae..284397dd7990 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -18,10 +18,9 @@
18#include "xfs.h" 18#include "xfs.h"
19#include "xfs_fs.h" 19#include "xfs_fs.h"
20#include "xfs_shared.h" 20#include "xfs_shared.h"
21#include "xfs_format.h"
21#include "xfs_log_format.h" 22#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_trans.h" 25#include "xfs_trans.h"
27#include "xfs_trans_priv.h" 26#include "xfs_trans_priv.h"
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index cdb4d86520e1..17280cd71934 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -21,8 +21,6 @@
21#include "xfs_format.h" 21#include "xfs_format.h"
22#include "xfs_log_format.h" 22#include "xfs_log_format.h"
23#include "xfs_trans_resv.h" 23#include "xfs_trans_resv.h"
24#include "xfs_sb.h"
25#include "xfs_ag.h"
26#include "xfs_mount.h" 24#include "xfs_mount.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"
28#include "xfs_trans.h" 26#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 93455b998041..69f6e475de97 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -20,8 +20,6 @@
20#include "xfs_format.h" 20#include "xfs_format.h"
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
22#include "xfs_trans_resv.h" 22#include "xfs_trans_resv.h"
23#include "xfs_sb.h"
24#include "xfs_ag.h"
25#include "xfs_mount.h" 23#include "xfs_mount.h"
26#include "xfs_da_format.h" 24#include "xfs_da_format.h"
27#include "xfs_inode.h" 25#include "xfs_inode.h"