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.h398
1 files changed, 157 insertions, 241 deletions
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index 01c5a5ff230e..a7b2542fd7ba 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -241,42 +241,33 @@ typedef enum {
241 */ 241 */
242#define XFS_SB_MAX_SHARED_VN 0 242#define XFS_SB_MAX_SHARED_VN 0
243 243
244#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_NUM)
245int xfs_sb_version_num(xfs_sb_t *sbp);
246#define XFS_SB_VERSION_NUM(sbp) xfs_sb_version_num(sbp)
247#else
248#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) 244#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
249#endif
250 245
251#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_GOOD_VERSION)
252int xfs_sb_good_version(xfs_sb_t *sbp);
253#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp) 246#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
254#else
255#define XFS_SB_GOOD_VERSION_INT(sbp) \
256 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
257 ((sbp)->sb_versionnum <= XFS_SB_VERSION_3)) || \
258 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
259 !(((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
260 (((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
261 ((sbp)->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))
262
263#ifdef __KERNEL__ 247#ifdef __KERNEL__
264#define XFS_SB_GOOD_VERSION(sbp) \ 248static inline int xfs_sb_good_version(xfs_sb_t *sbp)
265 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 249{
266 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN) )) 250 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
267#else 251 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
268/* 252 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
269 * extra 2 paren's here (( to unconfuse paren-matching editors 253 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
270 * like vi because XFS_SB_GOOD_VERSION_INT is a partial expression 254 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
271 * and the two XFS_SB_GOOD_VERSION's each 2 more close paren's to 255 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
272 * complete the expression. 256 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)));
273 */ 257}
274#define XFS_SB_GOOD_VERSION(sbp) \ 258#else
275 (XFS_SB_GOOD_VERSION_INT(sbp) && \ 259static inline int xfs_sb_good_version(xfs_sb_t *sbp)
276 (!((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \ 260{
277 (sbp)->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)) )) 261 return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
262 (sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
263 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
264 !((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
265 ((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
266 (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
267 (!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
268 (sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
269}
278#endif /* __KERNEL__ */ 270#endif /* __KERNEL__ */
279#endif
280 271
281#define XFS_SB_GOOD_SASH_VERSION(sbp) \ 272#define XFS_SB_GOOD_SASH_VERSION(sbp) \
282 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \ 273 ((((sbp)->sb_versionnum >= XFS_SB_VERSION_1) && \
@@ -284,224 +275,178 @@ int xfs_sb_good_version(xfs_sb_t *sbp);
284 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 275 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
285 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS))) 276 !((sbp)->sb_versionnum & ~XFS_SB_VERSION_OKSASHBITS)))
286 277
287#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TONEW)
288unsigned xfs_sb_version_tonew(unsigned v);
289#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) 278#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v)
290#else 279static inline unsigned xfs_sb_version_tonew(unsigned v)
291#define XFS_SB_VERSION_TONEW(v) \ 280{
292 ((((v) == XFS_SB_VERSION_1) ? \ 281 return ((((v) == XFS_SB_VERSION_1) ? \
293 0 : \ 282 0 : \
294 (((v) == XFS_SB_VERSION_2) ? \ 283 (((v) == XFS_SB_VERSION_2) ? \
295 XFS_SB_VERSION_ATTRBIT : \ 284 XFS_SB_VERSION_ATTRBIT : \
296 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \ 285 (XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \
297 XFS_SB_VERSION_4) 286 XFS_SB_VERSION_4);
298#endif 287}
299 288
300#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_TOOLD)
301unsigned xfs_sb_version_toold(unsigned v);
302#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v) 289#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
303#else 290static inline unsigned xfs_sb_version_toold(unsigned v)
304#define XFS_SB_VERSION_TOOLD(v) \ 291{
305 (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ 292 return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
306 0 : \ 293 0 : \
307 (((v) & XFS_SB_VERSION_NLINKBIT) ? \ 294 (((v) & XFS_SB_VERSION_NLINKBIT) ? \
308 XFS_SB_VERSION_3 : \ 295 XFS_SB_VERSION_3 : \
309 (((v) & XFS_SB_VERSION_ATTRBIT) ? \ 296 (((v) & XFS_SB_VERSION_ATTRBIT) ? \
310 XFS_SB_VERSION_2 : \ 297 XFS_SB_VERSION_2 : \
311 XFS_SB_VERSION_1))) 298 XFS_SB_VERSION_1)));
312#endif 299}
313 300
314#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR)
315int xfs_sb_version_hasattr(xfs_sb_t *sbp);
316#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp) 301#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
317#else 302static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
318#define XFS_SB_VERSION_HASATTR(sbp) \ 303{
319 (((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ 304 return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
320 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 305 ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
321 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 306 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
322 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT))) 307 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
323#endif 308}
324 309
325#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR)
326void xfs_sb_version_addattr(xfs_sb_t *sbp);
327#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp) 310#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
328#else 311static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
329#define XFS_SB_VERSION_ADDATTR(sbp) \ 312{
330 ((sbp)->sb_versionnum = \ 313 (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
331 (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
332 XFS_SB_VERSION_2 : \ 314 XFS_SB_VERSION_2 : \
333 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \ 315 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \
334 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \ 316 ((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \
335 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)))) 317 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
336#endif 318}
337 319
338#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASNLINK)
339int xfs_sb_version_hasnlink(xfs_sb_t *sbp);
340#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp) 320#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
341#else 321static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
342#define XFS_SB_VERSION_HASNLINK(sbp) \ 322{
343 (((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 323 return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
344 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 324 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
345 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT))) 325 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
346#endif 326}
347 327
348#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDNLINK)
349void xfs_sb_version_addnlink(xfs_sb_t *sbp);
350#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp) 328#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
351#else 329static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
352#define XFS_SB_VERSION_ADDNLINK(sbp) \ 330{
353 ((sbp)->sb_versionnum = \ 331 (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
354 ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
355 XFS_SB_VERSION_3 : \ 332 XFS_SB_VERSION_3 : \
356 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT))) 333 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
357#endif 334}
358 335
359#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASQUOTA)
360int xfs_sb_version_hasquota(xfs_sb_t *sbp);
361#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp) 336#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
362#else 337static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
363#define XFS_SB_VERSION_HASQUOTA(sbp) \ 338{
364 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 339 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
365 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT)) 340 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
366#endif 341}
367 342
368#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDQUOTA)
369void xfs_sb_version_addquota(xfs_sb_t *sbp);
370#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp) 343#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
371#else 344static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
372#define XFS_SB_VERSION_ADDQUOTA(sbp) \ 345{
373 ((sbp)->sb_versionnum = \ 346 (sbp)->sb_versionnum = \
374 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ 347 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
375 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ 348 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
376 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \ 349 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \
377 XFS_SB_VERSION_QUOTABIT))) 350 XFS_SB_VERSION_QUOTABIT));
378#endif 351}
379 352
380#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASALIGN)
381int xfs_sb_version_hasalign(xfs_sb_t *sbp);
382#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp) 353#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
383#else 354static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
384#define XFS_SB_VERSION_HASALIGN(sbp) \ 355{
385 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 356 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
386 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT)) 357 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
387#endif 358}
388 359
389#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBALIGN)
390void xfs_sb_version_subalign(xfs_sb_t *sbp);
391#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp) 360#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
392#else 361static inline void xfs_sb_version_subalign(xfs_sb_t *sbp)
393#define XFS_SB_VERSION_SUBALIGN(sbp) \ 362{
394 ((sbp)->sb_versionnum = \ 363 (sbp)->sb_versionnum = \
395 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT)) 364 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT);
396#endif 365}
397 366
398#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDALIGN)
399int xfs_sb_version_hasdalign(xfs_sb_t *sbp);
400#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp) 367#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp)
401#else 368static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
402#define XFS_SB_VERSION_HASDALIGN(sbp) \ 369{
403 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 370 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
404 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT)) 371 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
405#endif 372}
406 373
407#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDDALIGN)
408int xfs_sb_version_adddalign(xfs_sb_t *sbp);
409#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp) 374#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
410#else 375static inline int xfs_sb_version_adddalign(xfs_sb_t *sbp)
411#define XFS_SB_VERSION_ADDDALIGN(sbp) \ 376{
412 ((sbp)->sb_versionnum = \ 377 return (sbp)->sb_versionnum = \
413 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT)) 378 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT);
414#endif 379}
415 380
416#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSHARED)
417int xfs_sb_version_hasshared(xfs_sb_t *sbp);
418#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp) 381#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
419#else 382static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
420#define XFS_SB_VERSION_HASSHARED(sbp) \ 383{
421 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 384 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
422 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT)) 385 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
423#endif 386}
424 387
425#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDSHARED)
426int xfs_sb_version_addshared(xfs_sb_t *sbp);
427#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp) 388#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
428#else 389static inline int xfs_sb_version_addshared(xfs_sb_t *sbp)
429#define XFS_SB_VERSION_ADDSHARED(sbp) \ 390{
430 ((sbp)->sb_versionnum = \ 391 return (sbp)->sb_versionnum = \
431 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT)) 392 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT);
432#endif 393}
433 394
434#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBSHARED)
435int xfs_sb_version_subshared(xfs_sb_t *sbp);
436#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp) 395#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
437#else 396static inline int xfs_sb_version_subshared(xfs_sb_t *sbp)
438#define XFS_SB_VERSION_SUBSHARED(sbp) \ 397{
439 ((sbp)->sb_versionnum = \ 398 return (sbp)->sb_versionnum = \
440 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT)) 399 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT);
441#endif 400}
442 401
443#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASDIRV2)
444int xfs_sb_version_hasdirv2(xfs_sb_t *sbp);
445#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp) 402#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
446#else 403static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
447#define XFS_SB_VERSION_HASDIRV2(sbp) \ 404{
448 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 405 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
449 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) 406 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
450#endif 407}
451 408
452#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASLOGV2)
453int xfs_sb_version_haslogv2(xfs_sb_t *sbp);
454#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp) 409#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp)
455#else 410static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
456#define XFS_SB_VERSION_HASLOGV2(sbp) \ 411{
457 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 412 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
458 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT)) 413 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
459#endif 414}
460 415
461#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASEXTFLGBIT)
462int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp);
463#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp) 416#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
464#else 417static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
465#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) \ 418{
466 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 419 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
467 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT)) 420 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
468#endif 421}
469 422
470#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDEXTFLGBIT)
471int xfs_sb_version_addextflgbit(xfs_sb_t *sbp);
472#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp) 423#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
473#else 424static inline int xfs_sb_version_addextflgbit(xfs_sb_t *sbp)
474#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) \ 425{
475 ((sbp)->sb_versionnum = \ 426 return (sbp)->sb_versionnum = \
476 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT)) 427 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT);
477#endif 428}
478 429
479#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_SUBEXTFLGBIT)
480int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
481#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp) 430#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
482#else 431static inline int xfs_sb_version_subextflgbit(xfs_sb_t *sbp)
483#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) \ 432{
484 ((sbp)->sb_versionnum = \ 433 return (sbp)->sb_versionnum = \
485 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT)) 434 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT);
486#endif 435}
487 436
488#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASSECTOR)
489int xfs_sb_version_hassector(xfs_sb_t *sbp);
490#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp) 437#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
491#else 438static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
492#define XFS_SB_VERSION_HASSECTOR(sbp) \ 439{
493 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 440 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
494 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT)) 441 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
495#endif 442}
496 443
497#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASMOREBITSBIT)
498int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
499#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp) 444#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp)
500#else 445static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
501#define XFS_SB_VERSION_HASMOREBITS(sbp) \ 446{
502 ((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 447 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
503 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT)) 448 ((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
504#endif 449}
505 450
506/* 451/*
507 * sb_features2 bit version macros. 452 * sb_features2 bit version macros.
@@ -512,65 +457,36 @@ int xfs_sb_version_hasmorebits(xfs_sb_t *sbp);
512 * ((XFS_SB_VERSION_HASMOREBITS(sbp) && 457 * ((XFS_SB_VERSION_HASMOREBITS(sbp) &&
513 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) 458 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
514 */ 459 */
515#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_HASATTR2) 460
516int xfs_sb_version_hasattr2(xfs_sb_t *sbp);
517#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp) 461#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
518#else 462static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
519#define XFS_SB_VERSION_HASATTR2(sbp) \ 463{
520 ((XFS_SB_VERSION_HASMOREBITS(sbp)) && \ 464 return (XFS_SB_VERSION_HASMOREBITS(sbp)) && \
521 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT)) 465 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
522#endif 466}
523 467
524#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_VERSION_ADDATTR2)
525void xfs_sb_version_addattr2(xfs_sb_t *sbp);
526#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp) 468#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp)
527#else 469static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
528#define XFS_SB_VERSION_ADDATTR2(sbp) \ 470{
529 ((sbp)->sb_versionnum = \ 471 ((sbp)->sb_versionnum = \
530 ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \ 472 ((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \
531 ((sbp)->sb_features2 = \ 473 ((sbp)->sb_features2 = \
532 ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT))) 474 ((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
533#endif 475}
476
534/* 477/*
535 * end of superblock version macros 478 * end of superblock version macros
536 */ 479 */
537 480
538#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */ 481#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
539#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
540xfs_agblock_t xfs_sb_block(struct xfs_mount *mp);
541#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
542#else
543#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR) 482#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
544#endif
545
546#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_HDR_BLOCK)
547xfs_agblock_t xfs_hdr_block(struct xfs_mount *mp, xfs_daddr_t d);
548#define XFS_HDR_BLOCK(mp,d) xfs_hdr_block(mp,d)
549#else
550#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp,d)))
551#endif
552#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DADDR_TO_FSB)
553xfs_fsblock_t xfs_daddr_to_fsb(struct xfs_mount *mp, xfs_daddr_t d);
554#define XFS_DADDR_TO_FSB(mp,d) xfs_daddr_to_fsb(mp,d)
555#else
556#define XFS_DADDR_TO_FSB(mp,d) \
557 XFS_AGB_TO_FSB(mp, XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
558#endif
559#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_FSB_TO_DADDR)
560xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
561#define XFS_FSB_TO_DADDR(mp,fsbno) xfs_fsb_to_daddr(mp,fsbno)
562#else
563#define XFS_FSB_TO_DADDR(mp,fsbno) \
564 XFS_AGB_TO_DADDR(mp, XFS_FSB_TO_AGNO(mp,fsbno), \
565 XFS_FSB_TO_AGBNO(mp,fsbno))
566#endif
567
568#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
569xfs_sb_t *xfs_buf_to_sbp(struct xfs_buf *bp);
570#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
571#else
572#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp)) 483#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
573#endif 484
485#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
486#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
487 XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
488#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
489 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
574 490
575/* 491/*
576 * File system sector to basic block conversions. 492 * File system sector to basic block conversions.