Skip to content

Commit 932b42c

Browse files
author
Darrick J. Wong
committed
xfs: replace XFS_IFORK_Q with a proper predicate function
Replace this shouty macro with a real C function that has a more descriptive name. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent e45d7cb commit 932b42c

File tree

13 files changed

+31
-27
lines changed

13 files changed

+31
-27
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int
6767
xfs_inode_hasattr(
6868
struct xfs_inode *ip)
6969
{
70-
if (!XFS_IFORK_Q(ip))
70+
if (!xfs_inode_has_attr_fork(ip))
7171
return 0;
7272
if (ip->i_af.if_format == XFS_DINODE_FMT_EXTENTS &&
7373
ip->i_af.if_nextents == 0)
@@ -999,7 +999,7 @@ xfs_attr_set(
999999
* If the inode doesn't have an attribute fork, add one.
10001000
* (inode must not be locked when we call this routine)
10011001
*/
1002-
if (XFS_IFORK_Q(dp) == 0) {
1002+
if (xfs_inode_has_attr_fork(dp) == 0) {
10031003
int sf_size = sizeof(struct xfs_attr_sf_hdr) +
10041004
xfs_attr_sf_entsize_byname(args->namelen,
10051005
args->valuelen);

fs/xfs/libxfs/xfs_attr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ xfs_attr_init_add_state(struct xfs_da_args *args)
576576
* context, i_af is guaranteed to exist. Hence if the attr fork is
577577
* null, we were called from a pure remove operation and so we are done.
578578
*/
579-
if (!XFS_IFORK_Q(args->dp))
579+
if (!xfs_inode_has_attr_fork(args->dp))
580580
return XFS_DAS_DONE;
581581

582582
args->op_flags |= XFS_DA_OP_ADDNAME;

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ xfs_bmap_add_attrfork(
10231023
int logflags; /* logging flags */
10241024
int error; /* error return value */
10251025

1026-
ASSERT(XFS_IFORK_Q(ip) == 0);
1026+
ASSERT(xfs_inode_has_attr_fork(ip) == 0);
10271027

10281028
mp = ip->i_mount;
10291029
ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
@@ -1034,7 +1034,7 @@ xfs_bmap_add_attrfork(
10341034
rsvd, &tp);
10351035
if (error)
10361036
return error;
1037-
if (XFS_IFORK_Q(ip))
1037+
if (xfs_inode_has_attr_fork(ip))
10381038
goto trans_cancel;
10391039

10401040
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);

fs/xfs/libxfs/xfs_inode_fork.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ xfs_ifork_verify_local_attr(
717717
struct xfs_ifork *ifp = &ip->i_af;
718718
xfs_failaddr_t fa;
719719

720-
if (!XFS_IFORK_Q(ip))
720+
if (!xfs_inode_has_attr_fork(ip))
721721
fa = __this_address;
722722
else
723723
fa = xfs_attr_shortform_verify(ip);

fs/xfs/libxfs/xfs_inode_fork.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ struct xfs_ifork {
7878
* Fork handling.
7979
*/
8080

81-
#define XFS_IFORK_Q(ip) ((ip)->i_forkoff != 0)
8281
#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_forkoff << 3))
8382

8483
#define XFS_IFORK_DSIZE(ip) \
85-
(XFS_IFORK_Q(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount))
84+
(xfs_inode_has_attr_fork(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount))
8685
#define XFS_IFORK_ASIZE(ip) \
87-
(XFS_IFORK_Q(ip) ? XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : 0)
86+
(xfs_inode_has_attr_fork(ip) ? XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : 0)
8887
#define XFS_IFORK_SIZE(ip,w) \
8988
((w) == XFS_DATA_FORK ? \
9089
XFS_IFORK_DSIZE(ip) : \

fs/xfs/scrub/btree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ xchk_btree_check_iroot_minrecs(
462462
*/
463463
if (bs->cur->bc_btnum == XFS_BTNUM_BMAP &&
464464
bs->cur->bc_ino.whichfork == XFS_DATA_FORK &&
465-
XFS_IFORK_Q(bs->sc->ip))
465+
xfs_inode_has_attr_fork(bs->sc->ip))
466466
return false;
467467

468468
return true;

fs/xfs/xfs_attr_inactive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ xfs_attr_inactive(
338338
ASSERT(! XFS_NOT_DQATTACHED(mp, dp));
339339

340340
xfs_ilock(dp, lock_mode);
341-
if (!XFS_IFORK_Q(dp))
341+
if (!xfs_inode_has_attr_fork(dp))
342342
goto out_destroy_fork;
343343
xfs_iunlock(dp, lock_mode);
344344

@@ -351,7 +351,7 @@ xfs_attr_inactive(
351351
lock_mode = XFS_ILOCK_EXCL;
352352
xfs_ilock(dp, lock_mode);
353353

354-
if (!XFS_IFORK_Q(dp))
354+
if (!xfs_inode_has_attr_fork(dp))
355355
goto out_cancel;
356356

357357
/*

fs/xfs/xfs_bmap_util.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ xfs_getbmap(
444444
xfs_ilock(ip, XFS_IOLOCK_SHARED);
445445
switch (whichfork) {
446446
case XFS_ATTR_FORK:
447-
if (!XFS_IFORK_Q(ip))
447+
if (!xfs_inode_has_attr_fork(ip))
448448
goto out_unlock_iolock;
449449

450450
max_len = 1LL << 32;
@@ -1320,7 +1320,7 @@ xfs_swap_extents_check_format(
13201320
* extent format...
13211321
*/
13221322
if (tifp->if_format == XFS_DINODE_FMT_BTREE) {
1323-
if (XFS_IFORK_Q(ip) &&
1323+
if (xfs_inode_has_attr_fork(ip) &&
13241324
XFS_BMAP_BMDR_SPACE(tifp->if_broot) > XFS_IFORK_BOFF(ip))
13251325
return -EINVAL;
13261326
if (tifp->if_nextents <= XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK))
@@ -1329,7 +1329,7 @@ xfs_swap_extents_check_format(
13291329

13301330
/* Reciprocal target->temp btree format checks */
13311331
if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
1332-
if (XFS_IFORK_Q(tip) &&
1332+
if (xfs_inode_has_attr_fork(tip) &&
13331333
XFS_BMAP_BMDR_SPACE(ip->i_df.if_broot) > XFS_IFORK_BOFF(tip))
13341334
return -EINVAL;
13351335
if (ifp->if_nextents <= XFS_IFORK_MAXEXT(tip, XFS_DATA_FORK))
@@ -1506,14 +1506,14 @@ xfs_swap_extent_forks(
15061506
/*
15071507
* Count the number of extended attribute blocks
15081508
*/
1509-
if (XFS_IFORK_Q(ip) && ip->i_af.if_nextents > 0 &&
1509+
if (xfs_inode_has_attr_fork(ip) && ip->i_af.if_nextents > 0 &&
15101510
ip->i_af.if_format != XFS_DINODE_FMT_LOCAL) {
15111511
error = xfs_bmap_count_blocks(tp, ip, XFS_ATTR_FORK, &junk,
15121512
&aforkblks);
15131513
if (error)
15141514
return error;
15151515
}
1516-
if (XFS_IFORK_Q(tip) && tip->i_af.if_nextents > 0 &&
1516+
if (xfs_inode_has_attr_fork(tip) && tip->i_af.if_nextents > 0 &&
15171517
tip->i_af.if_format != XFS_DINODE_FMT_LOCAL) {
15181518
error = xfs_bmap_count_blocks(tp, tip, XFS_ATTR_FORK, &junk,
15191519
&taforkblks);

fs/xfs/xfs_inode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ xfs_ilock_attr_map_shared(
125125
{
126126
uint lock_mode = XFS_ILOCK_SHARED;
127127

128-
if (XFS_IFORK_Q(ip) && xfs_need_iread_extents(&ip->i_af))
128+
if (xfs_inode_has_attr_fork(ip) && xfs_need_iread_extents(&ip->i_af))
129129
lock_mode = XFS_ILOCK_EXCL;
130130
xfs_ilock(ip, lock_mode);
131131
return lock_mode;
@@ -635,7 +635,7 @@ xfs_ip2xflags(
635635
flags |= FS_XFLAG_COWEXTSIZE;
636636
}
637637

638-
if (XFS_IFORK_Q(ip))
638+
if (xfs_inode_has_attr_fork(ip))
639639
flags |= FS_XFLAG_HASATTR;
640640
return flags;
641641
}
@@ -1762,7 +1762,7 @@ xfs_inactive(
17621762
* now. The code calls a routine that recursively deconstructs the
17631763
* attribute fork. If also blows away the in-core attribute fork.
17641764
*/
1765-
if (XFS_IFORK_Q(ip)) {
1765+
if (xfs_inode_has_attr_fork(ip)) {
17661766
error = xfs_attr_inactive(ip);
17671767
if (error)
17681768
goto out;
@@ -3501,7 +3501,7 @@ xfs_iflush(
35013501
if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL &&
35023502
xfs_ifork_verify_local_data(ip))
35033503
goto flush_out;
3504-
if (XFS_IFORK_Q(ip) &&
3504+
if (xfs_inode_has_attr_fork(ip) &&
35053505
ip->i_af.if_format == XFS_DINODE_FMT_LOCAL &&
35063506
xfs_ifork_verify_local_attr(ip))
35073507
goto flush_out;
@@ -3520,7 +3520,7 @@ xfs_iflush(
35203520
}
35213521

35223522
xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK);
3523-
if (XFS_IFORK_Q(ip))
3523+
if (xfs_inode_has_attr_fork(ip))
35243524
xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK);
35253525

35263526
/*

fs/xfs/xfs_inode.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ typedef struct xfs_inode {
7777
struct list_head i_ioend_list;
7878
} xfs_inode_t;
7979

80+
static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
81+
{
82+
return ip->i_forkoff > 0;
83+
}
84+
8085
static inline struct xfs_ifork *
8186
xfs_ifork_ptr(
8287
struct xfs_inode *ip,
@@ -86,7 +91,7 @@ xfs_ifork_ptr(
8691
case XFS_DATA_FORK:
8792
return &ip->i_df;
8893
case XFS_ATTR_FORK:
89-
if (!XFS_IFORK_Q(ip))
94+
if (!xfs_inode_has_attr_fork(ip))
9095
return NULL;
9196
return &ip->i_af;
9297
case XFS_COW_FORK:

0 commit comments

Comments
 (0)