Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>

+31 -27
+2 -2
fs/xfs/libxfs/xfs_attr.c
··· 67 67 xfs_inode_hasattr( 68 68 struct xfs_inode *ip) 69 69 { 70 - if (!XFS_IFORK_Q(ip)) 70 + if (!xfs_inode_has_attr_fork(ip)) 71 71 return 0; 72 72 if (ip->i_af.if_format == XFS_DINODE_FMT_EXTENTS && 73 73 ip->i_af.if_nextents == 0) ··· 999 999 * If the inode doesn't have an attribute fork, add one. 1000 1000 * (inode must not be locked when we call this routine) 1001 1001 */ 1002 - if (XFS_IFORK_Q(dp) == 0) { 1002 + if (xfs_inode_has_attr_fork(dp) == 0) { 1003 1003 int sf_size = sizeof(struct xfs_attr_sf_hdr) + 1004 1004 xfs_attr_sf_entsize_byname(args->namelen, 1005 1005 args->valuelen);
+1 -1
fs/xfs/libxfs/xfs_attr.h
··· 576 576 * context, i_af is guaranteed to exist. Hence if the attr fork is 577 577 * null, we were called from a pure remove operation and so we are done. 578 578 */ 579 - if (!XFS_IFORK_Q(args->dp)) 579 + if (!xfs_inode_has_attr_fork(args->dp)) 580 580 return XFS_DAS_DONE; 581 581 582 582 args->op_flags |= XFS_DA_OP_ADDNAME;
+2 -2
fs/xfs/libxfs/xfs_bmap.c
··· 1023 1023 int logflags; /* logging flags */ 1024 1024 int error; /* error return value */ 1025 1025 1026 - ASSERT(XFS_IFORK_Q(ip) == 0); 1026 + ASSERT(xfs_inode_has_attr_fork(ip) == 0); 1027 1027 1028 1028 mp = ip->i_mount; 1029 1029 ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); ··· 1034 1034 rsvd, &tp); 1035 1035 if (error) 1036 1036 return error; 1037 - if (XFS_IFORK_Q(ip)) 1037 + if (xfs_inode_has_attr_fork(ip)) 1038 1038 goto trans_cancel; 1039 1039 1040 1040 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+1 -1
fs/xfs/libxfs/xfs_inode_fork.c
··· 717 717 struct xfs_ifork *ifp = &ip->i_af; 718 718 xfs_failaddr_t fa; 719 719 720 - if (!XFS_IFORK_Q(ip)) 720 + if (!xfs_inode_has_attr_fork(ip)) 721 721 fa = __this_address; 722 722 else 723 723 fa = xfs_attr_shortform_verify(ip);
+2 -3
fs/xfs/libxfs/xfs_inode_fork.h
··· 78 78 * Fork handling. 79 79 */ 80 80 81 - #define XFS_IFORK_Q(ip) ((ip)->i_forkoff != 0) 82 81 #define XFS_IFORK_BOFF(ip) ((int)((ip)->i_forkoff << 3)) 83 82 84 83 #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)) 86 85 #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) 88 87 #define XFS_IFORK_SIZE(ip,w) \ 89 88 ((w) == XFS_DATA_FORK ? \ 90 89 XFS_IFORK_DSIZE(ip) : \
+1 -1
fs/xfs/scrub/btree.c
··· 462 462 */ 463 463 if (bs->cur->bc_btnum == XFS_BTNUM_BMAP && 464 464 bs->cur->bc_ino.whichfork == XFS_DATA_FORK && 465 - XFS_IFORK_Q(bs->sc->ip)) 465 + xfs_inode_has_attr_fork(bs->sc->ip)) 466 466 return false; 467 467 468 468 return true;
+2 -2
fs/xfs/xfs_attr_inactive.c
··· 338 338 ASSERT(! XFS_NOT_DQATTACHED(mp, dp)); 339 339 340 340 xfs_ilock(dp, lock_mode); 341 - if (!XFS_IFORK_Q(dp)) 341 + if (!xfs_inode_has_attr_fork(dp)) 342 342 goto out_destroy_fork; 343 343 xfs_iunlock(dp, lock_mode); 344 344 ··· 351 351 lock_mode = XFS_ILOCK_EXCL; 352 352 xfs_ilock(dp, lock_mode); 353 353 354 - if (!XFS_IFORK_Q(dp)) 354 + if (!xfs_inode_has_attr_fork(dp)) 355 355 goto out_cancel; 356 356 357 357 /*
+5 -5
fs/xfs/xfs_bmap_util.c
··· 444 444 xfs_ilock(ip, XFS_IOLOCK_SHARED); 445 445 switch (whichfork) { 446 446 case XFS_ATTR_FORK: 447 - if (!XFS_IFORK_Q(ip)) 447 + if (!xfs_inode_has_attr_fork(ip)) 448 448 goto out_unlock_iolock; 449 449 450 450 max_len = 1LL << 32; ··· 1320 1320 * extent format... 1321 1321 */ 1322 1322 if (tifp->if_format == XFS_DINODE_FMT_BTREE) { 1323 - if (XFS_IFORK_Q(ip) && 1323 + if (xfs_inode_has_attr_fork(ip) && 1324 1324 XFS_BMAP_BMDR_SPACE(tifp->if_broot) > XFS_IFORK_BOFF(ip)) 1325 1325 return -EINVAL; 1326 1326 if (tifp->if_nextents <= XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)) ··· 1329 1329 1330 1330 /* Reciprocal target->temp btree format checks */ 1331 1331 if (ifp->if_format == XFS_DINODE_FMT_BTREE) { 1332 - if (XFS_IFORK_Q(tip) && 1332 + if (xfs_inode_has_attr_fork(tip) && 1333 1333 XFS_BMAP_BMDR_SPACE(ip->i_df.if_broot) > XFS_IFORK_BOFF(tip)) 1334 1334 return -EINVAL; 1335 1335 if (ifp->if_nextents <= XFS_IFORK_MAXEXT(tip, XFS_DATA_FORK)) ··· 1506 1506 /* 1507 1507 * Count the number of extended attribute blocks 1508 1508 */ 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 && 1510 1510 ip->i_af.if_format != XFS_DINODE_FMT_LOCAL) { 1511 1511 error = xfs_bmap_count_blocks(tp, ip, XFS_ATTR_FORK, &junk, 1512 1512 &aforkblks); 1513 1513 if (error) 1514 1514 return error; 1515 1515 } 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 && 1517 1517 tip->i_af.if_format != XFS_DINODE_FMT_LOCAL) { 1518 1518 error = xfs_bmap_count_blocks(tp, tip, XFS_ATTR_FORK, &junk, 1519 1519 &taforkblks);
+5 -5
fs/xfs/xfs_inode.c
··· 125 125 { 126 126 uint lock_mode = XFS_ILOCK_SHARED; 127 127 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)) 129 129 lock_mode = XFS_ILOCK_EXCL; 130 130 xfs_ilock(ip, lock_mode); 131 131 return lock_mode; ··· 635 635 flags |= FS_XFLAG_COWEXTSIZE; 636 636 } 637 637 638 - if (XFS_IFORK_Q(ip)) 638 + if (xfs_inode_has_attr_fork(ip)) 639 639 flags |= FS_XFLAG_HASATTR; 640 640 return flags; 641 641 } ··· 1762 1762 * now. The code calls a routine that recursively deconstructs the 1763 1763 * attribute fork. If also blows away the in-core attribute fork. 1764 1764 */ 1765 - if (XFS_IFORK_Q(ip)) { 1765 + if (xfs_inode_has_attr_fork(ip)) { 1766 1766 error = xfs_attr_inactive(ip); 1767 1767 if (error) 1768 1768 goto out; ··· 3501 3501 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL && 3502 3502 xfs_ifork_verify_local_data(ip)) 3503 3503 goto flush_out; 3504 - if (XFS_IFORK_Q(ip) && 3504 + if (xfs_inode_has_attr_fork(ip) && 3505 3505 ip->i_af.if_format == XFS_DINODE_FMT_LOCAL && 3506 3506 xfs_ifork_verify_local_attr(ip)) 3507 3507 goto flush_out; ··· 3520 3520 } 3521 3521 3522 3522 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); 3523 - if (XFS_IFORK_Q(ip)) 3523 + if (xfs_inode_has_attr_fork(ip)) 3524 3524 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); 3525 3525 3526 3526 /*
+6 -1
fs/xfs/xfs_inode.h
··· 77 77 struct list_head i_ioend_list; 78 78 } xfs_inode_t; 79 79 80 + static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip) 81 + { 82 + return ip->i_forkoff > 0; 83 + } 84 + 80 85 static inline struct xfs_ifork * 81 86 xfs_ifork_ptr( 82 87 struct xfs_inode *ip, ··· 91 86 case XFS_DATA_FORK: 92 87 return &ip->i_df; 93 88 case XFS_ATTR_FORK: 94 - if (!XFS_IFORK_Q(ip)) 89 + if (!xfs_inode_has_attr_fork(ip)) 95 90 return NULL; 96 91 return &ip->i_af; 97 92 case XFS_COW_FORK:
+2 -2
fs/xfs/xfs_inode_item.c
··· 143 143 xfs_log_dinode_size(ip->i_mount); 144 144 145 145 xfs_inode_item_data_fork_size(iip, nvecs, nbytes); 146 - if (XFS_IFORK_Q(ip)) 146 + if (xfs_inode_has_attr_fork(ip)) 147 147 xfs_inode_item_attr_fork_size(iip, nvecs, nbytes); 148 148 } 149 149 ··· 480 480 481 481 xfs_inode_item_format_core(ip, lv, &vecp); 482 482 xfs_inode_item_format_data_fork(iip, ilf, lv, &vecp); 483 - if (XFS_IFORK_Q(ip)) { 483 + if (xfs_inode_has_attr_fork(ip)) { 484 484 xfs_inode_item_format_attr_fork(iip, ilf, lv, &vecp); 485 485 } else { 486 486 iip->ili_fields &=
+1 -1
fs/xfs/xfs_iomap.c
··· 1307 1307 lockmode = xfs_ilock_attr_map_shared(ip); 1308 1308 1309 1309 /* if there are no attribute fork or extents, return ENOENT */ 1310 - if (!XFS_IFORK_Q(ip) || !ip->i_af.if_nextents) { 1310 + if (!xfs_inode_has_attr_fork(ip) || !ip->i_af.if_nextents) { 1311 1311 error = -ENOENT; 1312 1312 goto out_unlock; 1313 1313 }
+1 -1
fs/xfs/xfs_iops.c
··· 1279 1279 * If there is no attribute fork no ACL can exist on this inode, 1280 1280 * and it can't have any file capabilities attached to it either. 1281 1281 */ 1282 - if (!XFS_IFORK_Q(ip)) { 1282 + if (!xfs_inode_has_attr_fork(ip)) { 1283 1283 inode_has_no_xattr(inode); 1284 1284 cache_no_acl(inode); 1285 1285 }