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

xfs: convert XFS_IFORK_PTR to a static inline helper

We're about to make this logic do a bit more, so convert the macro to a
static inline function for better typechecking and fewer shouty macros.
No functional changes here.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>

+95 -83
+1 -1
fs/xfs/libxfs/xfs_attr_leaf.c
··· 1056 1056 int64_t size; 1057 1057 1058 1058 ASSERT(ip->i_afp->if_format == XFS_DINODE_FMT_LOCAL); 1059 - ifp = XFS_IFORK_PTR(ip, XFS_ATTR_FORK); 1059 + ifp = xfs_ifork_ptr(ip, XFS_ATTR_FORK); 1060 1060 sfp = (struct xfs_attr_shortform *)ifp->if_u1.if_data; 1061 1061 size = ifp->if_bytes; 1062 1062
+34 -34
fs/xfs/libxfs/xfs_bmap.c
··· 128 128 */ 129 129 static inline bool xfs_bmap_needs_btree(struct xfs_inode *ip, int whichfork) 130 130 { 131 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 131 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 132 132 133 133 return whichfork != XFS_COW_FORK && 134 134 ifp->if_format == XFS_DINODE_FMT_EXTENTS && ··· 140 140 */ 141 141 static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork) 142 142 { 143 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 143 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 144 144 145 145 return whichfork != XFS_COW_FORK && 146 146 ifp->if_format == XFS_DINODE_FMT_BTREE && ··· 319 319 int whichfork) /* data or attr fork */ 320 320 { 321 321 struct xfs_mount *mp = ip->i_mount; 322 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 322 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 323 323 struct xfs_btree_block *block; /* current btree block */ 324 324 xfs_fsblock_t bno; /* block # of "block" */ 325 325 struct xfs_buf *bp; /* buffer for "block" */ ··· 538 538 int *logflagsp, /* inode logging flags */ 539 539 int whichfork) /* data or attr fork */ 540 540 { 541 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 541 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 542 542 struct xfs_mount *mp = ip->i_mount; 543 543 struct xfs_btree_block *rblock = ifp->if_broot; 544 544 struct xfs_btree_block *cblock;/* child btree block */ ··· 616 616 617 617 mp = ip->i_mount; 618 618 ASSERT(whichfork != XFS_COW_FORK); 619 - ifp = XFS_IFORK_PTR(ip, whichfork); 619 + ifp = xfs_ifork_ptr(ip, whichfork); 620 620 ASSERT(ifp->if_format == XFS_DINODE_FMT_EXTENTS); 621 621 622 622 /* ··· 745 745 struct xfs_inode *ip, 746 746 int whichfork) 747 747 { 748 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 748 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 749 749 750 750 ASSERT(whichfork != XFS_COW_FORK); 751 751 ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL); ··· 785 785 * So sending the data fork of a regular inode is invalid. 786 786 */ 787 787 ASSERT(!(S_ISREG(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK)); 788 - ifp = XFS_IFORK_PTR(ip, whichfork); 788 + ifp = xfs_ifork_ptr(ip, whichfork); 789 789 ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL); 790 790 791 791 if (!ifp->if_bytes) { ··· 1116 1116 xfs_extnum_t num_recs; 1117 1117 xfs_extnum_t j; 1118 1118 int whichfork = cur->bc_ino.whichfork; 1119 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1119 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1120 1120 1121 1121 block = xfs_btree_get_block(cur, level, &bp); 1122 1122 ··· 1164 1164 int whichfork) 1165 1165 { 1166 1166 struct xfs_iread_state ir; 1167 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1167 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1168 1168 struct xfs_mount *mp = ip->i_mount; 1169 1169 struct xfs_btree_cur *cur; 1170 1170 int error; ··· 1208 1208 xfs_fileoff_t *first_unused, /* unused block */ 1209 1209 int whichfork) /* data or attr fork */ 1210 1210 { 1211 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1211 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1212 1212 struct xfs_bmbt_irec got; 1213 1213 struct xfs_iext_cursor icur; 1214 1214 xfs_fileoff_t lastaddr = 0; ··· 1255 1255 xfs_fileoff_t *last_block, /* last block */ 1256 1256 int whichfork) /* data or attr fork */ 1257 1257 { 1258 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1258 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1259 1259 struct xfs_bmbt_irec got; 1260 1260 struct xfs_iext_cursor icur; 1261 1261 int error; ··· 1289 1289 struct xfs_bmbt_irec *rec, 1290 1290 int *is_empty) 1291 1291 { 1292 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1292 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1293 1293 struct xfs_iext_cursor icur; 1294 1294 int error; 1295 1295 ··· 1355 1355 xfs_fileoff_t *last_block, 1356 1356 int whichfork) 1357 1357 { 1358 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1358 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1359 1359 struct xfs_bmbt_irec rec; 1360 1360 int is_empty; 1361 1361 int error; ··· 1389 1389 int whichfork) 1390 1390 { 1391 1391 struct xfs_mount *mp = bma->ip->i_mount; 1392 - struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork); 1392 + struct xfs_ifork *ifp = xfs_ifork_ptr(bma->ip, whichfork); 1393 1393 struct xfs_bmbt_irec *new = &bma->got; 1394 1394 int error; /* error return value */ 1395 1395 int i; /* temp state */ ··· 1955 1955 *logflagsp = 0; 1956 1956 1957 1957 cur = *curp; 1958 - ifp = XFS_IFORK_PTR(ip, whichfork); 1958 + ifp = xfs_ifork_ptr(ip, whichfork); 1959 1959 1960 1960 ASSERT(!isnullstartblock(new->br_startblock)); 1961 1961 ··· 2480 2480 uint32_t state = xfs_bmap_fork_to_state(whichfork); 2481 2481 xfs_filblks_t temp; /* temp for indirect calculations */ 2482 2482 2483 - ifp = XFS_IFORK_PTR(ip, whichfork); 2483 + ifp = xfs_ifork_ptr(ip, whichfork); 2484 2484 ASSERT(isnullstartblock(new->br_startblock)); 2485 2485 2486 2486 /* ··· 2616 2616 int *logflagsp, 2617 2617 uint32_t flags) 2618 2618 { 2619 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 2619 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 2620 2620 struct xfs_mount *mp = ip->i_mount; 2621 2621 struct xfs_btree_cur *cur = *curp; 2622 2622 int error; /* error return value */ ··· 3867 3867 { 3868 3868 struct xfs_mount *mp = ip->i_mount; 3869 3869 int whichfork = xfs_bmapi_whichfork(flags); 3870 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 3870 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 3871 3871 struct xfs_bmbt_irec got; 3872 3872 xfs_fileoff_t obno; 3873 3873 xfs_fileoff_t end; ··· 3960 3960 int eof) 3961 3961 { 3962 3962 struct xfs_mount *mp = ip->i_mount; 3963 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 3963 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 3964 3964 xfs_extlen_t alen; 3965 3965 xfs_extlen_t indlen; 3966 3966 int error; ··· 4087 4087 { 4088 4088 struct xfs_mount *mp = bma->ip->i_mount; 4089 4089 int whichfork = xfs_bmapi_whichfork(bma->flags); 4090 - struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork); 4090 + struct xfs_ifork *ifp = xfs_ifork_ptr(bma->ip, whichfork); 4091 4091 int tmp_logflags = 0; 4092 4092 int error; 4093 4093 ··· 4186 4186 uint32_t flags) 4187 4187 { 4188 4188 int whichfork = xfs_bmapi_whichfork(flags); 4189 - struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork); 4189 + struct xfs_ifork *ifp = xfs_ifork_ptr(bma->ip, whichfork); 4190 4190 int tmp_logflags = 0; 4191 4191 int error; 4192 4192 ··· 4263 4263 struct xfs_inode *ip, 4264 4264 int fork) 4265 4265 { 4266 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, fork); 4266 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, fork); 4267 4267 4268 4268 if (tp && tp->t_firstblock != NULLFSBLOCK) 4269 4269 return 0; ··· 4284 4284 int whichfork, 4285 4285 int error) 4286 4286 { 4287 - struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork); 4287 + struct xfs_ifork *ifp = xfs_ifork_ptr(bma->ip, whichfork); 4288 4288 4289 4289 if ((bma->logflags & xfs_ilog_fext(whichfork)) && 4290 4290 ifp->if_format != XFS_DINODE_FMT_EXTENTS) ··· 4323 4323 }; 4324 4324 struct xfs_mount *mp = ip->i_mount; 4325 4325 int whichfork = xfs_bmapi_whichfork(flags); 4326 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 4326 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 4327 4327 xfs_fileoff_t end; /* end of mapped file region */ 4328 4328 bool eof = false; /* after the end of extents */ 4329 4329 int error; /* error return */ ··· 4504 4504 struct iomap *iomap, 4505 4505 unsigned int *seq) 4506 4506 { 4507 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 4507 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 4508 4508 struct xfs_mount *mp = ip->i_mount; 4509 4509 xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset); 4510 4510 struct xfs_bmalloca bma = { NULL }; ··· 4641 4641 int whichfork = xfs_bmapi_whichfork(flags); 4642 4642 int logflags = 0, error; 4643 4643 4644 - ifp = XFS_IFORK_PTR(ip, whichfork); 4644 + ifp = xfs_ifork_ptr(ip, whichfork); 4645 4645 ASSERT(len > 0); 4646 4646 ASSERT(len <= (xfs_filblks_t)XFS_MAX_BMBT_EXTLEN); 4647 4647 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); ··· 4798 4798 struct xfs_bmbt_irec *del) 4799 4799 { 4800 4800 struct xfs_mount *mp = ip->i_mount; 4801 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 4801 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 4802 4802 struct xfs_bmbt_irec new; 4803 4803 int64_t da_old, da_new, da_diff = 0; 4804 4804 xfs_fileoff_t del_endoff, got_endoff; ··· 4925 4925 struct xfs_bmbt_irec *del) 4926 4926 { 4927 4927 struct xfs_mount *mp = ip->i_mount; 4928 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); 4928 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_COW_FORK); 4929 4929 struct xfs_bmbt_irec new; 4930 4930 xfs_fileoff_t del_endoff, got_endoff; 4931 4931 uint32_t state = BMAP_COWFORK; ··· 5023 5023 mp = ip->i_mount; 5024 5024 XFS_STATS_INC(mp, xs_del_exlist); 5025 5025 5026 - ifp = XFS_IFORK_PTR(ip, whichfork); 5026 + ifp = xfs_ifork_ptr(ip, whichfork); 5027 5027 ASSERT(del->br_blockcount > 0); 5028 5028 xfs_iext_get_extent(ifp, icur, &got); 5029 5029 ASSERT(got.br_startoff <= del->br_startoff); ··· 5289 5289 5290 5290 whichfork = xfs_bmapi_whichfork(flags); 5291 5291 ASSERT(whichfork != XFS_COW_FORK); 5292 - ifp = XFS_IFORK_PTR(ip, whichfork); 5292 + ifp = xfs_ifork_ptr(ip, whichfork); 5293 5293 if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ifp))) 5294 5294 return -EFSCORRUPTED; 5295 5295 if (xfs_is_shutdown(mp)) ··· 5630 5630 struct xfs_btree_cur *cur, 5631 5631 int *logflags) /* output */ 5632 5632 { 5633 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 5633 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 5634 5634 struct xfs_bmbt_irec new; 5635 5635 xfs_filblks_t blockcount; 5636 5636 int error, i; ··· 5751 5751 { 5752 5752 int whichfork = XFS_DATA_FORK; 5753 5753 struct xfs_mount *mp = ip->i_mount; 5754 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 5754 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 5755 5755 struct xfs_btree_cur *cur = NULL; 5756 5756 struct xfs_bmbt_irec got, prev; 5757 5757 struct xfs_iext_cursor icur; ··· 5866 5866 { 5867 5867 int whichfork = XFS_DATA_FORK; 5868 5868 struct xfs_mount *mp = ip->i_mount; 5869 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 5869 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 5870 5870 struct xfs_btree_cur *cur = NULL; 5871 5871 struct xfs_bmbt_irec got, next; 5872 5872 struct xfs_iext_cursor icur; ··· 5966 5966 xfs_fileoff_t split_fsb) 5967 5967 { 5968 5968 int whichfork = XFS_DATA_FORK; 5969 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 5969 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 5970 5970 struct xfs_btree_cur *cur = NULL; 5971 5971 struct xfs_bmbt_irec got; 5972 5972 struct xfs_bmbt_irec new; /* split extent */
+4 -4
fs/xfs/libxfs/xfs_bmap_btree.c
··· 304 304 if (level == cur->bc_nlevels - 1) { 305 305 struct xfs_ifork *ifp; 306 306 307 - ifp = XFS_IFORK_PTR(cur->bc_ino.ip, 307 + ifp = xfs_ifork_ptr(cur->bc_ino.ip, 308 308 cur->bc_ino.whichfork); 309 309 310 310 return xfs_bmbt_maxrecs(cur->bc_mp, ··· 322 322 if (level == cur->bc_nlevels - 1) { 323 323 struct xfs_ifork *ifp; 324 324 325 - ifp = XFS_IFORK_PTR(cur->bc_ino.ip, 325 + ifp = xfs_ifork_ptr(cur->bc_ino.ip, 326 326 cur->bc_ino.whichfork); 327 327 328 328 return xfs_bmbt_maxrecs(cur->bc_mp, ··· 550 550 struct xfs_inode *ip, /* inode owning the btree */ 551 551 int whichfork) /* data or attr fork */ 552 552 { 553 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 553 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 554 554 struct xfs_btree_cur *cur; 555 555 ASSERT(whichfork != XFS_COW_FORK); 556 556 ··· 664 664 665 665 ASSERT(tp || buffer_list); 666 666 ASSERT(!(tp && buffer_list)); 667 - ASSERT(XFS_IFORK_PTR(ip, whichfork)->if_format == XFS_DINODE_FMT_BTREE); 667 + ASSERT(xfs_ifork_ptr(ip, whichfork)->if_format == XFS_DINODE_FMT_BTREE); 668 668 669 669 cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork); 670 670 cur->bc_ino.flags |= XFS_BTCUR_BMBT_INVALID_OWNER;
+2 -2
fs/xfs/libxfs/xfs_btree.c
··· 722 722 723 723 if (cur->bc_flags & XFS_BTREE_STAGING) 724 724 return cur->bc_ino.ifake->if_fork; 725 - return XFS_IFORK_PTR(cur->bc_ino.ip, cur->bc_ino.whichfork); 725 + return xfs_ifork_ptr(cur->bc_ino.ip, cur->bc_ino.whichfork); 726 726 } 727 727 728 728 /* ··· 3556 3556 { 3557 3557 int whichfork = cur->bc_ino.whichfork; 3558 3558 struct xfs_inode *ip = cur->bc_ino.ip; 3559 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 3559 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 3560 3560 struct xfs_btree_block *block; 3561 3561 struct xfs_btree_block *cblock; 3562 3562 union xfs_btree_key *kp;
+1 -1
fs/xfs/libxfs/xfs_dir2_block.c
··· 1071 1071 struct xfs_trans *tp = args->trans; 1072 1072 struct xfs_inode *dp = args->dp; 1073 1073 struct xfs_mount *mp = dp->i_mount; 1074 - struct xfs_ifork *ifp = XFS_IFORK_PTR(dp, XFS_DATA_FORK); 1074 + struct xfs_ifork *ifp = xfs_ifork_ptr(dp, XFS_DATA_FORK); 1075 1075 struct xfs_da_geometry *geo = args->geo; 1076 1076 xfs_dir2_db_t blkno; /* dir-relative block # (0) */ 1077 1077 xfs_dir2_data_hdr_t *hdr; /* block header */
+1 -1
fs/xfs/libxfs/xfs_dir2_sf.c
··· 710 710 struct xfs_inode *ip) 711 711 { 712 712 struct xfs_mount *mp = ip->i_mount; 713 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 713 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); 714 714 struct xfs_dir2_sf_hdr *sfp; 715 715 struct xfs_dir2_sf_entry *sfep; 716 716 struct xfs_dir2_sf_entry *next_sfep;
+8 -8
fs/xfs/libxfs/xfs_inode_fork.c
··· 35 35 const void *data, 36 36 int64_t size) 37 37 { 38 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 38 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 39 39 int mem_size = size; 40 40 bool zero_terminate; 41 41 ··· 102 102 int whichfork) 103 103 { 104 104 struct xfs_mount *mp = ip->i_mount; 105 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 105 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 106 106 int state = xfs_bmap_fork_to_state(whichfork); 107 107 xfs_extnum_t nex = xfs_dfork_nextents(dip, whichfork); 108 108 int size = nex * sizeof(xfs_bmbt_rec_t); ··· 173 173 int size; 174 174 int level; 175 175 176 - ifp = XFS_IFORK_PTR(ip, whichfork); 176 + ifp = xfs_ifork_ptr(ip, whichfork); 177 177 dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); 178 178 size = XFS_BMAP_BROOT_SPACE(mp, dfp); 179 179 nrecs = be16_to_cpu(dfp->bb_numrecs); ··· 370 370 return; 371 371 } 372 372 373 - ifp = XFS_IFORK_PTR(ip, whichfork); 373 + ifp = xfs_ifork_ptr(ip, whichfork); 374 374 if (rec_diff > 0) { 375 375 /* 376 376 * If there wasn't any memory allocated before, just ··· 480 480 int64_t byte_diff, 481 481 int whichfork) 482 482 { 483 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 483 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 484 484 int64_t new_size = ifp->if_bytes + byte_diff; 485 485 486 486 ASSERT(new_size >= 0); ··· 539 539 int whichfork) 540 540 { 541 541 int state = xfs_bmap_fork_to_state(whichfork); 542 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 542 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 543 543 struct xfs_iext_cursor icur; 544 544 struct xfs_bmbt_irec rec; 545 545 int64_t copied = 0; ··· 591 591 592 592 if (!iip) 593 593 return; 594 - ifp = XFS_IFORK_PTR(ip, whichfork); 594 + ifp = xfs_ifork_ptr(ip, whichfork); 595 595 /* 596 596 * This can happen if we gave up in iformat in an error path, 597 597 * for the attribute fork. ··· 731 731 int whichfork, 732 732 int nr_to_add) 733 733 { 734 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 734 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 735 735 uint64_t max_exts; 736 736 uint64_t nr_exts; 737 737
-6
fs/xfs/libxfs/xfs_inode_fork.h
··· 81 81 #define XFS_IFORK_Q(ip) ((ip)->i_forkoff != 0) 82 82 #define XFS_IFORK_BOFF(ip) ((int)((ip)->i_forkoff << 3)) 83 83 84 - #define XFS_IFORK_PTR(ip,w) \ 85 - ((w) == XFS_DATA_FORK ? \ 86 - &(ip)->i_df : \ 87 - ((w) == XFS_ATTR_FORK ? \ 88 - (ip)->i_afp : \ 89 - (ip)->i_cowfp)) 90 84 #define XFS_IFORK_DSIZE(ip) \ 91 85 (XFS_IFORK_Q(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount)) 92 86 #define XFS_IFORK_ASIZE(ip) \
+7 -7
fs/xfs/scrub/bmap.c
··· 377 377 struct xfs_inode *ip = bs->cur->bc_ino.ip; 378 378 struct xfs_buf *bp = NULL; 379 379 struct xfs_btree_block *block; 380 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, info->whichfork); 380 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, info->whichfork); 381 381 uint64_t owner; 382 382 int i; 383 383 ··· 426 426 struct xchk_bmap_info *info) 427 427 { 428 428 struct xfs_owner_info oinfo; 429 - struct xfs_ifork *ifp = XFS_IFORK_PTR(sc->ip, whichfork); 429 + struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, whichfork); 430 430 struct xfs_mount *mp = sc->mp; 431 431 struct xfs_inode *ip = sc->ip; 432 432 struct xfs_btree_cur *cur; ··· 478 478 return 0; 479 479 480 480 /* Now look up the bmbt record. */ 481 - ifp = XFS_IFORK_PTR(sc->ip, sbcri->whichfork); 481 + ifp = xfs_ifork_ptr(sc->ip, sbcri->whichfork); 482 482 if (!ifp) { 483 483 xchk_fblock_set_corrupt(sc, sbcri->whichfork, 484 484 rec->rm_offset); ··· 563 563 struct xfs_scrub *sc, 564 564 int whichfork) 565 565 { 566 - struct xfs_ifork *ifp = XFS_IFORK_PTR(sc->ip, whichfork); 566 + struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, whichfork); 567 567 struct xfs_perag *pag; 568 568 xfs_agnumber_t agno; 569 569 bool zero_size; ··· 578 578 if (XFS_IS_REALTIME_INODE(sc->ip) && whichfork == XFS_DATA_FORK) 579 579 return 0; 580 580 581 - ASSERT(XFS_IFORK_PTR(sc->ip, whichfork) != NULL); 581 + ASSERT(xfs_ifork_ptr(sc->ip, whichfork) != NULL); 582 582 583 583 /* 584 584 * Only do this for complex maps that are in btree format, or for ··· 624 624 struct xchk_bmap_info info = { NULL }; 625 625 struct xfs_mount *mp = sc->mp; 626 626 struct xfs_inode *ip = sc->ip; 627 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 627 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 628 628 xfs_fileoff_t endoff; 629 629 struct xfs_iext_cursor icur; 630 630 int error = 0; ··· 689 689 690 690 /* Scrub extent records. */ 691 691 info.lastoff = 0; 692 - ifp = XFS_IFORK_PTR(ip, whichfork); 692 + ifp = xfs_ifork_ptr(ip, whichfork); 693 693 for_each_xfs_iext(ifp, &icur, &irec) { 694 694 if (xchk_should_terminate(sc, &error) || 695 695 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
+1 -1
fs/xfs/scrub/dabtree.c
··· 482 482 int error; 483 483 484 484 /* Skip short format data structures; no btree to scan. */ 485 - if (!xfs_ifork_has_extents(XFS_IFORK_PTR(sc->ip, whichfork))) 485 + if (!xfs_ifork_has_extents(xfs_ifork_ptr(sc->ip, whichfork))) 486 486 return 0; 487 487 488 488 /* Set up initial da state. */
+1 -1
fs/xfs/scrub/dir.c
··· 667 667 { 668 668 struct xfs_bmbt_irec got; 669 669 struct xfs_da_args args; 670 - struct xfs_ifork *ifp = XFS_IFORK_PTR(sc->ip, XFS_DATA_FORK); 670 + struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, XFS_DATA_FORK); 671 671 struct xfs_mount *mp = sc->mp; 672 672 xfs_fileoff_t leaf_lblk; 673 673 xfs_fileoff_t free_lblk;
+1 -1
fs/xfs/scrub/quota.c
··· 185 185 186 186 /* Check for data fork problems that apply only to quota files. */ 187 187 max_dqid_off = ((xfs_dqid_t)-1) / qi->qi_dqperchunk; 188 - ifp = XFS_IFORK_PTR(sc->ip, XFS_DATA_FORK); 188 + ifp = xfs_ifork_ptr(sc->ip, XFS_DATA_FORK); 189 189 for_each_xfs_iext(ifp, &icur, &irec) { 190 190 if (xchk_should_terminate(sc, &error)) 191 191 break;
+1 -1
fs/xfs/scrub/symlink.c
··· 41 41 42 42 if (!S_ISLNK(VFS_I(ip)->i_mode)) 43 43 return -ENOENT; 44 - ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 44 + ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); 45 45 len = ip->i_disk_size; 46 46 47 47 /* Plausible size? */
+2 -2
fs/xfs/xfs_bmap_util.c
··· 256 256 xfs_filblks_t *count) 257 257 { 258 258 struct xfs_mount *mp = ip->i_mount; 259 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 259 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 260 260 struct xfs_btree_cur *cur; 261 261 xfs_extlen_t btblocks = 0; 262 262 int error; ··· 439 439 whichfork = XFS_COW_FORK; 440 440 else 441 441 whichfork = XFS_DATA_FORK; 442 - ifp = XFS_IFORK_PTR(ip, whichfork); 442 + ifp = xfs_ifork_ptr(ip, whichfork); 443 443 444 444 xfs_ilock(ip, XFS_IOLOCK_SHARED); 445 445 switch (whichfork) {
+1 -1
fs/xfs/xfs_dir2_readdir.c
··· 248 248 struct xfs_inode *dp = args->dp; 249 249 struct xfs_buf *bp = NULL; 250 250 struct xfs_da_geometry *geo = args->geo; 251 - struct xfs_ifork *ifp = XFS_IFORK_PTR(dp, XFS_DATA_FORK); 251 + struct xfs_ifork *ifp = xfs_ifork_ptr(dp, XFS_DATA_FORK); 252 252 struct xfs_bmbt_irec map; 253 253 struct blk_plug plug; 254 254 xfs_dir2_off_t new_off;
+1 -1
fs/xfs/xfs_icache.c
··· 1774 1774 struct xfs_inode *ip, 1775 1775 int whichfork) 1776 1776 { 1777 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 1777 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 1778 1778 struct xfs_bmbt_irec got; 1779 1779 struct xfs_iext_cursor icur; 1780 1780
+3 -3
fs/xfs/xfs_inode.c
··· 1293 1293 1294 1294 if (!xfs_is_reflink_inode(ip)) 1295 1295 return; 1296 - dfork = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 1297 - cfork = XFS_IFORK_PTR(ip, XFS_COW_FORK); 1296 + dfork = xfs_ifork_ptr(ip, XFS_DATA_FORK); 1297 + cfork = xfs_ifork_ptr(ip, XFS_COW_FORK); 1298 1298 if (dfork->if_bytes == 0 && cfork->if_bytes == 0) 1299 1299 ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; 1300 1300 if (cfork->if_bytes == 0) ··· 1643 1643 struct xfs_inode *ip) 1644 1644 { 1645 1645 struct xfs_mount *mp = ip->i_mount; 1646 - struct xfs_ifork *cow_ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); 1646 + struct xfs_ifork *cow_ifp = xfs_ifork_ptr(ip, XFS_COW_FORK); 1647 1647 1648 1648 /* 1649 1649 * If the inode is already free, then there can be nothing
+18
fs/xfs/xfs_inode.h
··· 77 77 struct list_head i_ioend_list; 78 78 } xfs_inode_t; 79 79 80 + static inline struct xfs_ifork * 81 + xfs_ifork_ptr( 82 + struct xfs_inode *ip, 83 + int whichfork) 84 + { 85 + switch (whichfork) { 86 + case XFS_DATA_FORK: 87 + return &ip->i_df; 88 + case XFS_ATTR_FORK: 89 + return ip->i_afp; 90 + case XFS_COW_FORK: 91 + return ip->i_cowfp; 92 + default: 93 + ASSERT(0); 94 + return NULL; 95 + } 96 + } 97 + 80 98 /* Convert from vfs inode to xfs inode */ 81 99 static inline struct xfs_inode *XFS_I(struct inode *inode) 82 100 {
+1 -1
fs/xfs/xfs_ioctl.c
··· 991 991 struct fileattr *fa) 992 992 { 993 993 struct xfs_mount *mp = ip->i_mount; 994 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 994 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 995 995 996 996 fileattr_fill_xflags(fa, xfs_ip2xflags(ip)); 997 997
+2 -2
fs/xfs/xfs_iomap.c
··· 159 159 struct xfs_inode *ip, 160 160 xfs_fileoff_t end_fsb) 161 161 { 162 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 162 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); 163 163 xfs_extlen_t extsz = xfs_get_extsz_hint(ip); 164 164 xfs_extlen_t align = xfs_eof_alignment(ip); 165 165 struct xfs_bmbt_irec irec; ··· 370 370 struct xfs_iext_cursor ncur = *icur; 371 371 struct xfs_bmbt_irec prev, got; 372 372 struct xfs_mount *mp = ip->i_mount; 373 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); 373 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); 374 374 xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset); 375 375 int64_t freesp; 376 376 xfs_fsblock_t qblocks;
+1 -1
fs/xfs/xfs_qm.c
··· 1154 1154 ASSERT(ip->i_delayed_blks == 0); 1155 1155 1156 1156 if (XFS_IS_REALTIME_INODE(ip)) { 1157 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 1157 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); 1158 1158 1159 1159 error = xfs_iread_extents(tp, ip, XFS_DATA_FORK); 1160 1160 if (error)
+3 -3
fs/xfs/xfs_reflink.c
··· 453 453 xfs_fileoff_t end_fsb, 454 454 bool cancel_real) 455 455 { 456 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); 456 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_COW_FORK); 457 457 struct xfs_bmbt_irec got, del; 458 458 struct xfs_iext_cursor icur; 459 459 int error = 0; ··· 594 594 struct xfs_bmbt_irec got, del, data; 595 595 struct xfs_mount *mp = ip->i_mount; 596 596 struct xfs_trans *tp; 597 - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); 597 + struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_COW_FORK); 598 598 unsigned int resblks; 599 599 int nmaps; 600 600 int error; ··· 1425 1425 bool found; 1426 1426 int error; 1427 1427 1428 - ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 1428 + ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); 1429 1429 error = xfs_iread_extents(tp, ip, XFS_DATA_FORK); 1430 1430 if (error) 1431 1431 return error;