aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/libxfs/xfs_attr.c1
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c1
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_da_format.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2_block.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2_data.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2_leaf.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2_node.c1
-rw-r--r--fs/xfs/libxfs/xfs_dir2_sf.c1
-rw-r--r--fs/xfs/libxfs/xfs_dquot_buf.c1
-rw-r--r--fs/xfs/libxfs/xfs_format.h579
-rw-r--r--fs/xfs/libxfs/xfs_ialloc_btree.c1
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c1
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c1
-rw-r--r--fs/xfs/libxfs/xfs_log_rlimit.c1
-rw-r--r--fs/xfs/libxfs/xfs_rtbitmap.c1
-rw-r--r--fs/xfs/libxfs/xfs_sb.h584
-rw-r--r--fs/xfs/libxfs/xfs_symlink_remote.c1
-rw-r--r--fs/xfs/libxfs/xfs_trans_resv.c1
-rw-r--r--fs/xfs/xfs_acl.c1
-rw-r--r--fs/xfs/xfs_aops.c1
-rw-r--r--fs/xfs/xfs_attr_inactive.c1
-rw-r--r--fs/xfs/xfs_attr_list.c1
-rw-r--r--fs/xfs/xfs_bmap_util.c1
-rw-r--r--fs/xfs/xfs_dir2_readdir.c1
-rw-r--r--fs/xfs/xfs_dquot.c1
-rw-r--r--fs/xfs/xfs_dquot_item.c1
-rw-r--r--fs/xfs/xfs_error.c1
-rw-r--r--fs/xfs/xfs_export.c1
-rw-r--r--fs/xfs/xfs_extfree_item.c1
-rw-r--r--fs/xfs/xfs_file.c1
-rw-r--r--fs/xfs/xfs_icreate_item.c1
-rw-r--r--fs/xfs/xfs_inode_item.c1
-rw-r--r--fs/xfs/xfs_ioctl.c1
-rw-r--r--fs/xfs/xfs_ioctl32.c1
-rw-r--r--fs/xfs/xfs_iomap.c1
-rw-r--r--fs/xfs/xfs_iops.c1
-rw-r--r--fs/xfs/xfs_itable.c1
-rw-r--r--fs/xfs/xfs_log.c1
-rw-r--r--fs/xfs/xfs_log_cil.c1
-rw-r--r--fs/xfs/xfs_message.c1
-rw-r--r--fs/xfs/xfs_qm_bhv.c1
-rw-r--r--fs/xfs/xfs_quotaops.c1
-rw-r--r--fs/xfs/xfs_rtalloc.c1
-rw-r--r--fs/xfs/xfs_symlink.c1
-rw-r--r--fs/xfs/xfs_trace.c1
-rw-r--r--fs/xfs/xfs_trans.c1
-rw-r--r--fs/xfs/xfs_trans_ail.c1
-rw-r--r--fs/xfs/xfs_trans_buf.c1
-rw-r--r--fs/xfs/xfs_trans_dquot.c1
-rw-r--r--fs/xfs/xfs_trans_extfree.c1
-rw-r--r--fs/xfs/xfs_trans_inode.c1
-rw-r--r--fs/xfs/xfs_xattr.c1
56 files changed, 579 insertions, 638 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index f782d3617d2f..0a472fbe06d4 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.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"
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 4edd4a84abe9..20de88d1bf86 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -23,7 +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_mount.h" 26#include "xfs_mount.h"
28#include "xfs_da_format.h" 27#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index 91588a54a677..2c44c8e50782 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#include "xfs_trans.h" 27#include "xfs_trans.h"
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 256d53245c42..81cad433df85 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#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 2b880617135c..c41e7513849e 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -23,7 +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_mount.h" 26#include "xfs_mount.h"
28#include "xfs_da_format.h" 27#include "xfs_da_format.h"
29#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 927e9eb6d999..9d624a622946 100644
--- a/fs/xfs/libxfs/xfs_da_format.c
+++ b/fs/xfs/libxfs/xfs_da_format.c
@@ -22,7 +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_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"
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 672a29e626cc..5d892911158b 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -21,7 +21,6 @@
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" 23#include "xfs_inum.h"
24#include "xfs_sb.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dir2_block.c b/fs/xfs/libxfs/xfs_dir2_block.c
index a6b3a6a60e89..c2e34c54b706 100644
--- a/fs/xfs/libxfs/xfs_dir2_block.c
+++ b/fs/xfs/libxfs/xfs_dir2_block.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
index 2c8f463c54ed..5ff31be9b1cd 100644
--- a/fs/xfs/libxfs/xfs_dir2_data.c
+++ b/fs/xfs/libxfs/xfs_dir2_data.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#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 777c48208528..ed41a0e0da63 100644
--- a/fs/xfs/libxfs/xfs_dir2_leaf.c
+++ b/fs/xfs/libxfs/xfs_dir2_leaf.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#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 c0a0e194fbf7..78ceda1bcd34 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#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 ab99dbc00988..2baedc40591f 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_da_format.h" 24#include "xfs_da_format.h"
26#include "xfs_da_btree.h" 25#include "xfs_da_btree.h"
diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
index cd6892667ba1..6fbf2d853a54 100644
--- a/fs/xfs/libxfs/xfs_dquot_buf.c
+++ b/fs/xfs/libxfs/xfs_dquot_buf.c
@@ -22,7 +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_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#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 9b6e4247ca28..70ca740f34ac 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -34,6 +34,585 @@ 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/*
37 * Allocation group header 616 * Allocation group header
38 * 617 *
39 * This is divided into three structures, placed in sequential 512-byte 618 * This is divided into three structures, placed in sequential 512-byte
diff --git a/fs/xfs/libxfs/xfs_ialloc_btree.c b/fs/xfs/libxfs/xfs_ialloc_btree.c
index 4e029cc238e6..964c465ca69c 100644
--- a/fs/xfs/libxfs/xfs_ialloc_btree.c
+++ b/fs/xfs/libxfs/xfs_ialloc_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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#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 f63c455c3f69..002b6b3a1988 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#include "xfs_error.h" 26#include "xfs_error.h"
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index ab0659949a47..8912d28eb43e 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -23,7 +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_inum.h" 25#include "xfs_inum.h"
26#include "xfs_sb.h"
27#include "xfs_mount.h" 26#include "xfs_mount.h"
28#include "xfs_inode.h" 27#include "xfs_inode.h"
29#include "xfs_trans.h" 28#include "xfs_trans.h"
diff --git a/fs/xfs/libxfs/xfs_log_rlimit.c b/fs/xfs/libxfs/xfs_log_rlimit.c
index 1c250ee07dca..c10597973333 100644
--- a/fs/xfs/libxfs/xfs_log_rlimit.c
+++ b/fs/xfs/libxfs/xfs_log_rlimit.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#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 ad3d1dc37d11..9b59ffa1fc19 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.c
+++ b/fs/xfs/libxfs/xfs_rtbitmap.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#include "xfs_bmap.h" 27#include "xfs_bmap.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 87ee2996379c..c80c5236c3da 100644
--- a/fs/xfs/libxfs/xfs_symlink_remote.c
+++ b/fs/xfs/libxfs/xfs_symlink_remote.c
@@ -22,7 +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_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_bmap_btree.h" 26#include "xfs_bmap_btree.h"
28#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 f2a03e5dec96..6c1330f29050 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.c
+++ b/fs/xfs/libxfs/xfs_trans_resv.c
@@ -22,7 +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_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"
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 66cd043d9165..4b641676f258 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -19,7 +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_mount.h" 22#include "xfs_mount.h"
24#include "xfs_inode.h" 23#include "xfs_inode.h"
25#include "xfs_acl.h" 24#include "xfs_acl.h"
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 183b634dc432..18e2f3bbae5e 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_inode.h" 24#include "xfs_inode.h"
26#include "xfs_trans.h" 25#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index b466388358a2..83af4c149635 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -23,7 +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_mount.h" 26#include "xfs_mount.h"
28#include "xfs_da_format.h" 27#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 13dce2b19682..a43d370d2c58 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.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"
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 6df4730ef5c3..a68110eed65e 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -23,7 +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_mount.h" 26#include "xfs_mount.h"
28#include "xfs_da_format.h" 27#include "xfs_da_format.h"
29#include "xfs_inode.h" 28#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_dir2_readdir.c b/fs/xfs/xfs_dir2_readdir.c
index 09b0eb723590..b5a10d2e9aef 100644
--- a/fs/xfs/xfs_dir2_readdir.c
+++ b/fs/xfs/xfs_dir2_readdir.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.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"
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 222168493ac4..02c01bbbc789 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -22,7 +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_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#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 1f87bc8166f3..814cff94e78f 100644
--- a/fs/xfs/xfs_dquot_item.c
+++ b/fs/xfs/xfs_dquot_item.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_inode.h" 24#include "xfs_inode.h"
26#include "xfs_quota.h" 25#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index f5d90eda78fb..3ee186ac1093 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_error.h" 24#include "xfs_error.h"
26 25
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
index 73172e1bd399..0a0a6fa11ce1 100644
--- a/fs/xfs/xfs_export.c
+++ b/fs/xfs/xfs_export.c
@@ -19,7 +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_mount.h" 22#include "xfs_mount.h"
24#include "xfs_da_format.h" 23#include "xfs_da_format.h"
25#include "xfs_dir2.h" 24#include "xfs_dir2.h"
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index e751c6074000..cb7fe64cdbfa 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -20,7 +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_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 69b7dd316542..e2b1a8116f1c 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#include "xfs_da_btree.h" 26#include "xfs_da_btree.h"
diff --git a/fs/xfs/xfs_icreate_item.c b/fs/xfs/xfs_icreate_item.c
index 131b0432f77e..d45ca72af6fb 100644
--- a/fs/xfs/xfs_icreate_item.c
+++ b/fs/xfs/xfs_icreate_item.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.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_item.c b/fs/xfs/xfs_inode_item.c
index 0bd3af61e09c..bf13a5a7e2f4 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_inode.h" 24#include "xfs_inode.h"
26#include "xfs_trans.h" 25#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index d2175b60f232..a1831980a68e 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#include "xfs_ioctl.h" 26#include "xfs_ioctl.h"
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 9a36ee0113d1..ec6772866f3d 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -25,7 +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_mount.h" 28#include "xfs_mount.h"
30#include "xfs_inode.h" 29#include "xfs_inode.h"
31#include "xfs_itable.h" 30#include "xfs_itable.h"
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 7ab365a96017..2262ce32926a 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#include "xfs_btree.h" 26#include "xfs_btree.h"
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 55aa9e8d79b9..f14a3e5e4a0a 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 2b92694926df..584feee3edb7 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.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_inum.h" 24#include "xfs_inum.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#include "xfs_btree.h" 27#include "xfs_btree.h"
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 765f32ebed4c..bfeb442ef827 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_error.h" 25#include "xfs_error.h"
27#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 951c08fac0e7..45cc0ce18adf 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -21,7 +21,6 @@
21#include "xfs_log_format.h" 21#include "xfs_log_format.h"
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_sb.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_message.c b/fs/xfs/xfs_message.c
index 8abc2d5643e1..d8b67547ab34 100644
--- a/fs/xfs/xfs_message.c
+++ b/fs/xfs/xfs_message.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25 24
26/* 25/*
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index b781dc57e7a6..3e52d5de7ae1 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -20,7 +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_quota.h" 23#include "xfs_quota.h"
25#include "xfs_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 763843994026..7542bbeca6a1 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -19,7 +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_mount.h" 22#include "xfs_mount.h"
24#include "xfs_inode.h" 23#include "xfs_inode.h"
25#include "xfs_quota.h" 24#include "xfs_quota.h"
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index cb93a7231baf..f2079b6911cc 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.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_bit.h" 24#include "xfs_bit.h"
25#include "xfs_sb.h"
26#include "xfs_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#include "xfs_bmap.h" 27#include "xfs_bmap.h"
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 99bc12927999..25791df6f638 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -23,7 +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_mount.h" 26#include "xfs_mount.h"
28#include "xfs_da_format.h" 27#include "xfs_da_format.h"
29#include "xfs_da_btree.h" 28#include "xfs_da_btree.h"
diff --git a/fs/xfs/xfs_trace.c b/fs/xfs/xfs_trace.c
index 017051a10d1c..13a029806805 100644
--- a/fs/xfs/xfs_trace.c
+++ b/fs/xfs/xfs_trace.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_da_format.h" 25#include "xfs_da_format.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 02df25d607d8..fa3135b9bf04 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -22,7 +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_mount.h" 25#include "xfs_mount.h"
27#include "xfs_inode.h" 26#include "xfs_inode.h"
28#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 dd828d6fa15a..573aefb5a573 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -21,7 +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_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 f9192b03d570..d3d80bef59e1 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#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 6320e287e527..76a16df55ef7 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#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 a0aaa3e3d2b0..284397dd7990 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -21,7 +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_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 592904b0262b..17280cd71934 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -21,7 +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_mount.h" 24#include "xfs_mount.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"
27#include "xfs_trans.h" 26#include "xfs_trans.h"
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 30c6158a037c..69f6e475de97 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -20,7 +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_mount.h" 23#include "xfs_mount.h"
25#include "xfs_da_format.h" 24#include "xfs_da_format.h"
26#include "xfs_inode.h" 25#include "xfs_inode.h"