aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_sb.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_sb.h')
-rw-r--r--fs/xfs/xfs_sb.h448
1 files changed, 187 insertions, 261 deletions
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index ad090a834ced..4a17d335f897 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -1,33 +1,19 @@
1/* 1/*
2 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32#ifndef __XFS_SB_H__ 18#ifndef __XFS_SB_H__
33#define __XFS_SB_H__ 19#define __XFS_SB_H__
@@ -72,7 +58,8 @@ struct xfs_mount;
72 XFS_SB_VERSION_DALIGNBIT | \ 58 XFS_SB_VERSION_DALIGNBIT | \
73 XFS_SB_VERSION_SHAREDBIT | \ 59 XFS_SB_VERSION_SHAREDBIT | \
74 XFS_SB_VERSION_LOGV2BIT | \ 60 XFS_SB_VERSION_LOGV2BIT | \
75 XFS_SB_VERSION_SECTORBIT) 61 XFS_SB_VERSION_SECTORBIT | \
62 XFS_SB_VERSION_MOREBITSBIT)
76#define XFS_SB_VERSION_OKSASHBITS \ 63#define XFS_SB_VERSION_OKSASHBITS \
77 (XFS_SB_VERSION_NUMBITS | \ 64 (XFS_SB_VERSION_NUMBITS | \
78 XFS_SB_VERSION_REALFBITS | \ 65 XFS_SB_VERSION_REALFBITS | \
@@ -103,12 +90,15 @@ struct xfs_mount;
103 */ 90 */
104#define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */ 91#define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */
105#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001 92#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001
93#define XFS_SB_VERSION2_RESERVED2BIT 0x00000002
94#define XFS_SB_VERSION2_RESERVED4BIT 0x00000004
95#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */
106#define XFS_SB_VERSION2_SASHFBITS 0xff000000 /* Mask: features that 96#define XFS_SB_VERSION2_SASHFBITS 0xff000000 /* Mask: features that
107 require changing 97 require changing
108 PROM and SASH */ 98 PROM and SASH */
109 99
110#define XFS_SB_VERSION2_OKREALFBITS \ 100#define XFS_SB_VERSION2_OKREALFBITS \
111 (0) 101 (XFS_SB_VERSION2_ATTR2BIT)
112#define XFS_SB_VERSION2_OKSASHFBITS \ 102#define XFS_SB_VERSION2_OKSASHFBITS \
113 (0) 103 (0)
114#define XFS_SB_VERSION2_OKREALBITS \ 104#define XFS_SB_VERSION2_OKREALBITS \
@@ -118,8 +108,7 @@ struct xfs_mount;
118/* 108/*
119 * mkfs macro to set up sb_features2 word 109 * mkfs macro to set up sb_features2 word
120 */ 110 */
121#define XFS_SB_VERSION2_MKFS(xyz) \ 111#define XFS_SB_VERSION2_MKFS(resvd1, sbcntr) 0
122 ((xyz) ? 0 : 0)
123 112
124typedef struct xfs_sb 113typedef struct xfs_sb
125{ 114{
@@ -176,7 +165,7 @@ typedef struct xfs_sb
176 __uint8_t sb_logsectlog; /* log2 of the log sector size */ 165 __uint8_t sb_logsectlog; /* log2 of the log sector size */
177 __uint16_t sb_logsectsize; /* sector size for the log, bytes */ 166 __uint16_t sb_logsectsize; /* sector size for the log, bytes */
178 __uint32_t sb_logsunit; /* stripe unit size for the log */ 167 __uint32_t sb_logsunit; /* stripe unit size for the log */
179 __uint32_t sb_features2; /* additonal feature bits */ 168 __uint32_t sb_features2; /* additional feature bits */
180} xfs_sb_t; 169} xfs_sb_t;
181 170
182/* 171/*
@@ -216,12 +205,15 @@ typedef enum {
216#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN) 205#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
217#define XFS_SB_UNIT XFS_SB_MVAL(UNIT) 206#define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
218#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH) 207#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
208#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
219#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) 209#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
220#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) 210#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
221#define XFS_SB_MOD_BITS \ 211#define XFS_SB_MOD_BITS \
222 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ 212 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
223 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ 213 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
224 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH) 214 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
215 XFS_SB_FEATURES2)
216
225 217
226/* 218/*
227 * Misc. Flags - warning - these will be cleared by xfs_repair unless 219 * Misc. Flags - warning - these will be cleared by xfs_repair unless
@@ -235,42 +227,33 @@ typedef enum {
235 */ 227 */
236#define XFS_SB_MAX_SHARED_VN 0 228#define XFS_SB_MAX_SHARED_VN 0
237 229
238#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM)
239int xfs_sb_version_num(xfs_sb_t *sbp);
240#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
241#else
242#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) 230#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
243#endif
244 231
245#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION)
246int xfs_sb_good_version(xfs_sb_t *sbp);
247#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) 232#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
248#else
249#define XFS_SB_GOOD_VERSION_INT(sbp) \
250 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
251 ((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
252 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
253 !(((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
254 (((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
255 ((sbp)->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
256
257#ifdef __KERNEL__ 233#ifdef __KERNEL__
258#define XFS_SB_GOOD_VERSION(sbp) \ 234static inline int xfs_sb_good_version(xfs_sb_t *sbp)
259 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 235{
260 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) )) 236 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
237 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
238 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
239 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
240 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
241 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
242 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)));
243}
261#else 244#else
262/* 245static inline int xfs_sb_good_version(xfs_sb_t *sbp)
263 * extra 2 paren's here (( to unconfuse paren-matching editors 246{
264 * like vi because XFS_SB_GOOD_VERSION_INT is a partial expression 247 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
265 * and the two XFS_SB_GOOD_VERSION's each 2 more close paren's to 248 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
266 * complete the expression. 249 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
267 */ 250 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
268#define XFS_SB_GOOD_VERSION(sbp) \ 251 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
269 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 252 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
270 (!((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \ 253 (!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
271 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)) )) 254 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
255}
272#endif /* __KERNEL__ */ 256#endif /* __KERNEL__ */
273#endif
274 257
275#define XFS_SB_GOOD_SASH_VERSION(sbp) \ 258#define XFS_SB_GOOD_SASH_VERSION(sbp) \
276 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ 259 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
@@ -278,275 +261,218 @@ int xfs_sb_good_version(xfs_sb_t *sbp);
278 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 261 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
279 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS))) 262 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS)))
280 263
281#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW)
282unsigned xfs_sb_version_tonew(unsigned v);
283#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) 264#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
284#else 265static inline unsigned xfs_sb_version_tonew(unsigned v)
285#define XFS_SB_VERSION_TONEW(v) \ 266{
286 ((((v) == XFS_SB_VERSION_1) ? \ 267 return ((((v) == XFS_SB_VERSION_1) ? \
287 0 : \ 268 0 : \
288 (((v) == XFS_SB_VERSION_2) ? \ 269 (((v) == XFS_SB_VERSION_2) ? \
289 XFS_SB_VERSION_ATTRBIT : \ 270 XFS_SB_VERSION_ATTRBIT : \
290 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \ 271 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \
291 XFS_SB_VERSION_4) 272 XFS_SB_VERSION_4);
292#endif 273}
293 274
294#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD)
295unsigned xfs_sb_version_toold(unsigned v);
296#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) 275#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
297#else 276static inline unsigned xfs_sb_version_toold(unsigned v)
298#define XFS_SB_VERSION_TOOLD(v) \ 277{
299 (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ 278 return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
300 0 : \ 279 0 : \
301 (((v) & XFS_SB_VERSION_NLINKBIT) ? \ 280 (((v) & XFS_SB_VERSION_NLINKBIT) ? \
302 XFS_SB_VERSION_3 : \ 281 XFS_SB_VERSION_3 : \
303 (((v) & XFS_SB_VERSION_ATTRBIT) ? \ 282 (((v) & XFS_SB_VERSION_ATTRBIT) ? \
304 XFS_SB_VERSION_2 : \ 283 XFS_SB_VERSION_2 : \
305 XFS_SB_VERSION_1))) 284 XFS_SB_VERSION_1)));
306#endif 285}
307 286
308#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR)
309int xfs_sb_version_hasattr(xfs_sb_t *sbp);
310#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) 287#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
311#else 288static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
312#define XFS_SB_VERSION_HASATTR(sbp) \ 289{
313 (((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ 290 return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
314 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 291 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
315 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 292 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
316 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT))) 293 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
317#endif 294}
318 295
319#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR)
320void xfs_sb_version_addattr(xfs_sb_t *sbp);
321#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) 296#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
322#else 297static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
323#define XFS_SB_VERSION_ADDATTR(sbp) \ 298{
324 ((sbp)->sb_versionnum = \ 299 (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
325 (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
326 XFS_SB_VERSION_2 : \ 300 XFS_SB_VERSION_2 : \
327 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \ 301 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \
328 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \ 302 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \
329 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)))) 303 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
330#endif 304}
331 305
332#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK)
333int xfs_sb_version_hasnlink(xfs_sb_t *sbp);
334#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) 306#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
335#else 307static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
336#define XFS_SB_VERSION_HASNLINK(sbp) \ 308{
337 (((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 309 return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
338 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 310 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
339 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT))) 311 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
340#endif 312}
341 313
342#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK)
343void xfs_sb_version_addnlink(xfs_sb_t *sbp);
344#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) 314#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
345#else 315static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
346#define XFS_SB_VERSION_ADDNLINK(sbp) \ 316{
347 ((sbp)->sb_versionnum = \ 317 (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
348 ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
349 XFS_SB_VERSION_3 : \ 318 XFS_SB_VERSION_3 : \
350 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT))) 319 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
351#endif 320}
352 321
353#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA)
354int xfs_sb_version_hasquota(xfs_sb_t *sbp);
355#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) 322#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
356#else 323static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
357#define XFS_SB_VERSION_HASQUOTA(sbp) \ 324{
358 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 325 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
359 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT)) 326 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
360#endif 327}
361 328
362#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA)
363void xfs_sb_version_addquota(xfs_sb_t *sbp);
364#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) 329#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
365#else 330static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
366#define XFS_SB_VERSION_ADDQUOTA(sbp) \ 331{
367 ((sbp)->sb_versionnum = \ 332 (sbp)->sb_versionnum = \
368 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ 333 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
369 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ 334 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
370 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \ 335 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \
371 XFS_SB_VERSION_QUOTABIT))) 336 XFS_SB_VERSION_QUOTABIT));
372#endif 337}
373 338
374#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN)
375int xfs_sb_version_hasalign(xfs_sb_t *sbp);
376#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) 339#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
377#else 340static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
378#define XFS_SB_VERSION_HASALIGN(sbp) \ 341{
379 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 342 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
380 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)) 343 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
381#endif 344}
382 345
383#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN)
384void xfs_sb_version_subalign(xfs_sb_t *sbp);
385#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) 346#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
386#else 347static inline void xfs_sb_version_subalign(xfs_sb_t *sbp)
387#define XFS_SB_VERSION_SUBALIGN(sbp) \ 348{
388 ((sbp)->sb_versionnum = \ 349 (sbp)->sb_versionnum = \
389 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT)) 350 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT);
390#endif 351}
391 352
392#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDALIGN)
393int xfs_sb_version_hasdalign(xfs_sb_t *sbp);
394#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp) 353#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp)
395#else 354static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
396#define XFS_SB_VERSION_HASDALIGN(sbp) \ 355{
397 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 356 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
398 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT)) 357 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
399#endif 358}
400 359
401#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDDALIGN)
402int xfs_sb_version_adddalign(xfs_sb_t *sbp);
403#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp) 360#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
404#else 361static inline int xfs_sb_version_adddalign(xfs_sb_t *sbp)
405#define XFS_SB_VERSION_ADDDALIGN(sbp) \ 362{
406 ((sbp)->sb_versionnum = \ 363 return (sbp)->sb_versionnum = \
407 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT)) 364 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT);
408#endif 365}
409 366
410#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSHARED)
411int xfs_sb_version_hasshared(xfs_sb_t *sbp);
412#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp) 367#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
413#else 368static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
414#define XFS_SB_VERSION_HASSHARED(sbp) \ 369{
415 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 370 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
416 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)) 371 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
417#endif 372}
418 373
419#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDSHARED)
420int xfs_sb_version_addshared(xfs_sb_t *sbp);
421#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp) 374#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
422#else 375static inline int xfs_sb_version_addshared(xfs_sb_t *sbp)
423#define XFS_SB_VERSION_ADDSHARED(sbp) \ 376{
424 ((sbp)->sb_versionnum = \ 377 return (sbp)->sb_versionnum = \
425 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT)) 378 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT);
426#endif 379}
427 380
428#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBSHARED)
429int xfs_sb_version_subshared(xfs_sb_t *sbp);
430#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp) 381#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
431#else 382static inline int xfs_sb_version_subshared(xfs_sb_t *sbp)
432#define XFS_SB_VERSION_SUBSHARED(sbp) \ 383{
433 ((sbp)->sb_versionnum = \ 384 return (sbp)->sb_versionnum = \
434 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT)) 385 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT);
435#endif 386}
436 387
437#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDIRV2)
438int xfs_sb_version_hasdirv2(xfs_sb_t *sbp);
439#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp) 388#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
440#else 389static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
441#define XFS_SB_VERSION_HASDIRV2(sbp) \ 390{
442 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 391 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
443 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) 392 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
444#endif 393}
445 394
446#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASLOGV2)
447int xfs_sb_version_haslogv2(xfs_sb_t *sbp);
448#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp) 395#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp)
449#else 396static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
450#define XFS_SB_VERSION_HASLOGV2(sbp) \ 397{
451 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 398 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
452 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)) 399 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
453#endif 400}
454 401
455#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASEXTFLGBIT)
456int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp);
457#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp) 402#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
458#else 403static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
459#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) \ 404{
460 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 405 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
461 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)) 406 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
462#endif 407}
463 408
464#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDEXTFLGBIT)
465int xfs_sb_version_addextflgbit(xfs_sb_t *sbp);
466#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp) 409#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
467#else 410static inline int xfs_sb_version_addextflgbit(xfs_sb_t *sbp)
468#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) \ 411{
469 ((sbp)->sb_versionnum = \ 412 return (sbp)->sb_versionnum = \
470 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT)) 413 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT);
471#endif 414}
472 415
473#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBEXTFLGBIT)
474int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
475#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp) 416#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
476#else 417static inline int xfs_sb_version_subextflgbit(xfs_sb_t *sbp)
477#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) \ 418{
478 ((sbp)->sb_versionnum = \ 419 return (sbp)->sb_versionnum = \
479 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT)) 420 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT);
480#endif 421}
481 422
482#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSECTOR)
483int xfs_sb_version_hassector(xfs_sb_t *sbp);
484#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp) 423#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
485#else 424static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
486#define XFS_SB_VERSION_HASSECTOR(sbp) \ 425{
487 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 426 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
488 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT)) 427 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
489#endif 428}
490 429
491#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASMOREBITSBIT)
492int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
493#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp) 430#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp)
494#else 431static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
495#define XFS_SB_VERSION_HASMOREBITS(sbp) \ 432{
496 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 433 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
497 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)) 434 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
498#endif 435}
499 436
500/* 437/*
501 * sb_features2 bit version macros. 438 * sb_features2 bit version macros.
502 * 439 *
503 * For example, for a bit defined as XFS_SB_VERSION2_YBIT, has a macro: 440 * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro:
504 * 441 *
505 * SB_VERSION_HASYBIT(xfs_sb_t *sbp) 442 * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp)
506 * ((XFS_SB_VERSION_HASMOREBITS(sbp) && 443 * ((XFS_SB_VERSION_HASMOREBITS(sbp) &&
507 * ((sbp)->sb_versionnum & XFS_SB_VERSION2_YBIT) 444 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
508 */ 445 */
509 446
447#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
448static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
449{
450 return (XFS_SB_VERSION_HASMOREBITS(sbp)) && \
451 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
452}
453
454#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp)
455static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
456{
457 ((sbp)->sb_versionnum = \
458 ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \
459 ((sbp)->sb_features2 = \
460 ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
461}
462
510/* 463/*
511 * end of superblock version macros 464 * end of superblock version macros
512 */ 465 */
513 466
514#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 467#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
515#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
516xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
517#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
518#else
519#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 468#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
520#endif
521
522#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK)
523xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d);
524#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
525#else
526#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
527#endif
528#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB)
529xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d);
530#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
531#else
532#define XFS_DADDR_TO_FSB(mp,d) \
533 XFS_AGB_TO_FSB(mp, XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
534#endif
535#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR)
536xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
537#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
538#else
539#define XFS_FSB_TO_DADDR(mp,fsbno) \
540 XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \
541 XFS_FSB_TO_AGBNO(mp,fsbno))
542#endif
543
544#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
545xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
546#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
547#else
548#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) 469#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
549#endif 470
471#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
472#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
473 XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
474#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
475 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
550 476
551/* 477/*
552 * File system sector to basic block conversions. 478 * File system sector to basic block conversions.