]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: convert XFS_IFORK_PTR to a static inline helper
authorDarrick J. Wong <djwong@kernel.org>
Wed, 24 Aug 2022 08:44:55 +0000 (10:44 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 30 Aug 2022 08:19:38 +0000 (10:19 +0200)
Source kernel commit: 732436ef916b4f338d672ea56accfdb11e8d0732

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>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
13 files changed:
db/namei.c
include/xfs_inode.h
libxfs/xfs_attr_leaf.c
libxfs/xfs_bmap.c
libxfs/xfs_bmap_btree.c
libxfs/xfs_btree.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_sf.c
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h
libxfs/xfs_symlink_remote.c
repair/phase6.c
repair/quotacheck.c

index e44667a9b2f9d0959e93851576fa6f1eb5fdc673..f06ee3e9599bc6865c234e61b88a526936657c29 100644 (file)
@@ -377,7 +377,7 @@ list_leafdir(
        struct xfs_inode        *dp = args->dp;
        struct xfs_mount        *mp = dp->i_mount;
        struct xfs_buf          *bp = NULL;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(dp, XFS_DATA_FORK);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(dp, XFS_DATA_FORK);
        struct xfs_da_geometry  *geo = mp->m_dir_geo;
        xfs_dir2_off_t          dirboff;
        xfs_dablk_t             dabno = 0;
index 6a29b0983e1c12809e9ca106fcc2b8adf2bc8801..c9485386e1ad77645d0e9d2b4aa0d36b5632a4f7 100644 (file)
@@ -100,6 +100,24 @@ typedef struct xfs_inode {
        struct inode            i_vnode;
 } xfs_inode_t;
 
+static inline struct xfs_ifork *
+xfs_ifork_ptr(
+       struct xfs_inode        *ip,
+       int                     whichfork)
+{
+       switch (whichfork) {
+       case XFS_DATA_FORK:
+               return &ip->i_df;
+       case XFS_ATTR_FORK:
+               return ip->i_afp;
+       case XFS_COW_FORK:
+               return ip->i_cowfp;
+       default:
+               ASSERT(0);
+               return NULL;
+       }
+}
+
 /* Convert from vfs inode to xfs inode */
 static inline struct xfs_inode *XFS_I(struct inode *inode)
 {
index 75d36141ff302450c59234f2722e9e5c5df83e62..f82066ecf5d9e4d23c061b9027db4e325cc546ae 100644 (file)
@@ -1053,7 +1053,7 @@ xfs_attr_shortform_verify(
        int64_t                         size;
 
        ASSERT(ip->i_afp->if_format == XFS_DINODE_FMT_LOCAL);
-       ifp = XFS_IFORK_PTR(ip, XFS_ATTR_FORK);
+       ifp = xfs_ifork_ptr(ip, XFS_ATTR_FORK);
        sfp = (struct xfs_attr_shortform *)ifp->if_u1.if_data;
        size = ifp->if_bytes;
 
index 3093ab1bb6b4521202200c3e74f590652485ed72..1a72ae238b00fcdd963898ee919c251bfcc50e7c 100644 (file)
@@ -121,7 +121,7 @@ xfs_bmbt_lookup_first(
  */
 static inline bool xfs_bmap_needs_btree(struct xfs_inode *ip, int whichfork)
 {
-       struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork);
 
        return whichfork != XFS_COW_FORK &&
                ifp->if_format == XFS_DINODE_FMT_EXTENTS &&
@@ -133,7 +133,7 @@ static inline bool xfs_bmap_needs_btree(struct xfs_inode *ip, int whichfork)
  */
 static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
 {
-       struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork);
 
        return whichfork != XFS_COW_FORK &&
                ifp->if_format == XFS_DINODE_FMT_BTREE &&
@@ -312,7 +312,7 @@ xfs_bmap_check_leaf_extents(
        int                     whichfork)      /* data or attr fork */
 {
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_block  *block; /* current btree block */
        xfs_fsblock_t           bno;    /* block # of "block" */
        struct xfs_buf          *bp;    /* buffer for "block" */
@@ -531,7 +531,7 @@ xfs_bmap_btree_to_extents(
        int                     *logflagsp, /* inode logging flags */
        int                     whichfork)  /* data or attr fork */
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_btree_block  *rblock = ifp->if_broot;
        struct xfs_btree_block  *cblock;/* child btree block */
@@ -609,7 +609,7 @@ xfs_bmap_extents_to_btree(
 
        mp = ip->i_mount;
        ASSERT(whichfork != XFS_COW_FORK);
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        ASSERT(ifp->if_format == XFS_DINODE_FMT_EXTENTS);
 
        /*
@@ -738,7 +738,7 @@ xfs_bmap_local_to_extents_empty(
        struct xfs_inode        *ip,
        int                     whichfork)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
 
        ASSERT(whichfork != XFS_COW_FORK);
        ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL);
@@ -778,7 +778,7 @@ xfs_bmap_local_to_extents(
         * So sending the data fork of a regular inode is invalid.
         */
        ASSERT(!(S_ISREG(VFS_I(ip)->i_mode) && whichfork == XFS_DATA_FORK));
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        ASSERT(ifp->if_format == XFS_DINODE_FMT_LOCAL);
 
        if (!ifp->if_bytes) {
@@ -1109,7 +1109,7 @@ xfs_iread_bmbt_block(
        xfs_extnum_t            num_recs;
        xfs_extnum_t            j;
        int                     whichfork = cur->bc_ino.whichfork;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
 
        block = xfs_btree_get_block(cur, level, &bp);
 
@@ -1157,7 +1157,7 @@ xfs_iread_extents(
        int                     whichfork)
 {
        struct xfs_iread_state  ir;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_btree_cur    *cur;
        int                     error;
@@ -1201,7 +1201,7 @@ xfs_bmap_first_unused(
        xfs_fileoff_t           *first_unused,  /* unused block */
        int                     whichfork)      /* data or attr fork */
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec    got;
        struct xfs_iext_cursor  icur;
        xfs_fileoff_t           lastaddr = 0;
@@ -1248,7 +1248,7 @@ xfs_bmap_last_before(
        xfs_fileoff_t           *last_block,    /* last block */
        int                     whichfork)      /* data or attr fork */
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec    got;
        struct xfs_iext_cursor  icur;
        int                     error;
@@ -1282,7 +1282,7 @@ xfs_bmap_last_extent(
        struct xfs_bmbt_irec    *rec,
        int                     *is_empty)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_iext_cursor  icur;
        int                     error;
 
@@ -1348,7 +1348,7 @@ xfs_bmap_last_offset(
        xfs_fileoff_t           *last_block,
        int                     whichfork)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec    rec;
        int                     is_empty;
        int                     error;
@@ -1382,7 +1382,7 @@ xfs_bmap_add_extent_delay_real(
        int                     whichfork)
 {
        struct xfs_mount        *mp = bma->ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(bma->ip, whichfork);
        struct xfs_bmbt_irec    *new = &bma->got;
        int                     error;  /* error return value */
        int                     i;      /* temp state */
@@ -1948,7 +1948,7 @@ xfs_bmap_add_extent_unwritten_real(
        *logflagsp = 0;
 
        cur = *curp;
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
 
        ASSERT(!isnullstartblock(new->br_startblock));
 
@@ -2473,7 +2473,7 @@ xfs_bmap_add_extent_hole_delay(
        uint32_t                state = xfs_bmap_fork_to_state(whichfork);
        xfs_filblks_t           temp;    /* temp for indirect calculations */
 
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        ASSERT(isnullstartblock(new->br_startblock));
 
        /*
@@ -2609,7 +2609,7 @@ xfs_bmap_add_extent_hole_real(
        int                     *logflagsp,
        uint32_t                flags)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_mount        *mp = ip->i_mount;
        struct xfs_btree_cur    *cur = *curp;
        int                     error;  /* error return value */
@@ -3860,7 +3860,7 @@ xfs_bmapi_read(
 {
        struct xfs_mount        *mp = ip->i_mount;
        int                     whichfork = xfs_bmapi_whichfork(flags);
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec    got;
        xfs_fileoff_t           obno;
        xfs_fileoff_t           end;
@@ -3953,7 +3953,7 @@ xfs_bmapi_reserve_delalloc(
        int                     eof)
 {
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        xfs_extlen_t            alen;
        xfs_extlen_t            indlen;
        int                     error;
@@ -4080,7 +4080,7 @@ xfs_bmapi_allocate(
 {
        struct xfs_mount        *mp = bma->ip->i_mount;
        int                     whichfork = xfs_bmapi_whichfork(bma->flags);
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(bma->ip, whichfork);
        int                     tmp_logflags = 0;
        int                     error;
 
@@ -4179,7 +4179,7 @@ xfs_bmapi_convert_unwritten(
        uint32_t                flags)
 {
        int                     whichfork = xfs_bmapi_whichfork(flags);
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(bma->ip, whichfork);
        int                     tmp_logflags = 0;
        int                     error;
 
@@ -4256,7 +4256,7 @@ xfs_bmapi_minleft(
        struct xfs_inode        *ip,
        int                     fork)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, fork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, fork);
 
        if (tp && tp->t_firstblock != NULLFSBLOCK)
                return 0;
@@ -4277,7 +4277,7 @@ xfs_bmapi_finish(
        int                     whichfork,
        int                     error)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(bma->ip, whichfork);
 
        if ((bma->logflags & xfs_ilog_fext(whichfork)) &&
            ifp->if_format != XFS_DINODE_FMT_EXTENTS)
@@ -4316,7 +4316,7 @@ xfs_bmapi_write(
        };
        struct xfs_mount        *mp = ip->i_mount;
        int                     whichfork = xfs_bmapi_whichfork(flags);
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        xfs_fileoff_t           end;            /* end of mapped file region */
        bool                    eof = false;    /* after the end of extents */
        int                     error;          /* error return */
@@ -4497,7 +4497,7 @@ xfs_bmapi_convert_delalloc(
        struct iomap            *iomap,
        unsigned int            *seq)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_mount        *mp = ip->i_mount;
        xfs_fileoff_t           offset_fsb = XFS_B_TO_FSBT(mp, offset);
        struct xfs_bmalloca     bma = { NULL };
@@ -4634,7 +4634,7 @@ xfs_bmapi_remap(
        int                     whichfork = xfs_bmapi_whichfork(flags);
        int                     logflags = 0, error;
 
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        ASSERT(len > 0);
        ASSERT(len <= (xfs_filblks_t)XFS_MAX_BMBT_EXTLEN);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
@@ -4791,7 +4791,7 @@ xfs_bmap_del_extent_delay(
        struct xfs_bmbt_irec    *del)
 {
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec    new;
        int64_t                 da_old, da_new, da_diff = 0;
        xfs_fileoff_t           del_endoff, got_endoff;
@@ -4918,7 +4918,7 @@ xfs_bmap_del_extent_cow(
        struct xfs_bmbt_irec    *del)
 {
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, XFS_COW_FORK);
        struct xfs_bmbt_irec    new;
        xfs_fileoff_t           del_endoff, got_endoff;
        uint32_t                state = BMAP_COWFORK;
@@ -5016,7 +5016,7 @@ xfs_bmap_del_extent_real(
        mp = ip->i_mount;
        XFS_STATS_INC(mp, xs_del_exlist);
 
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        ASSERT(del->br_blockcount > 0);
        xfs_iext_get_extent(ifp, icur, &got);
        ASSERT(got.br_startoff <= del->br_startoff);
@@ -5282,7 +5282,7 @@ __xfs_bunmapi(
 
        whichfork = xfs_bmapi_whichfork(flags);
        ASSERT(whichfork != XFS_COW_FORK);
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ifp)))
                return -EFSCORRUPTED;
        if (xfs_is_shutdown(mp))
@@ -5623,7 +5623,7 @@ xfs_bmse_merge(
        struct xfs_btree_cur            *cur,
        int                             *logflags)      /* output */
 {
-       struct xfs_ifork                *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork                *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_bmbt_irec            new;
        xfs_filblks_t                   blockcount;
        int                             error, i;
@@ -5744,7 +5744,7 @@ xfs_bmap_collapse_extents(
 {
        int                     whichfork = XFS_DATA_FORK;
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_cur    *cur = NULL;
        struct xfs_bmbt_irec    got, prev;
        struct xfs_iext_cursor  icur;
@@ -5859,7 +5859,7 @@ xfs_bmap_insert_extents(
 {
        int                     whichfork = XFS_DATA_FORK;
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_cur    *cur = NULL;
        struct xfs_bmbt_irec    got, next;
        struct xfs_iext_cursor  icur;
@@ -5959,7 +5959,7 @@ xfs_bmap_split_extent(
        xfs_fileoff_t           split_fsb)
 {
        int                             whichfork = XFS_DATA_FORK;
-       struct xfs_ifork                *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork                *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_cur            *cur = NULL;
        struct xfs_bmbt_irec            got;
        struct xfs_bmbt_irec            new; /* split extent */
index c691252257727673815c8655ffb3589a6bc2c0fa..1d1e2f5da3f58fead0cc4aed9e37e582cf04576d 100644 (file)
@@ -302,7 +302,7 @@ xfs_bmbt_get_minrecs(
        if (level == cur->bc_nlevels - 1) {
                struct xfs_ifork        *ifp;
 
-               ifp = XFS_IFORK_PTR(cur->bc_ino.ip,
+               ifp = xfs_ifork_ptr(cur->bc_ino.ip,
                                    cur->bc_ino.whichfork);
 
                return xfs_bmbt_maxrecs(cur->bc_mp,
@@ -320,7 +320,7 @@ xfs_bmbt_get_maxrecs(
        if (level == cur->bc_nlevels - 1) {
                struct xfs_ifork        *ifp;
 
-               ifp = XFS_IFORK_PTR(cur->bc_ino.ip,
+               ifp = xfs_ifork_ptr(cur->bc_ino.ip,
                                    cur->bc_ino.whichfork);
 
                return xfs_bmbt_maxrecs(cur->bc_mp,
@@ -548,7 +548,7 @@ xfs_bmbt_init_cursor(
        struct xfs_inode        *ip,            /* inode owning the btree */
        int                     whichfork)      /* data or attr fork */
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_cur    *cur;
        ASSERT(whichfork != XFS_COW_FORK);
 
@@ -662,7 +662,7 @@ xfs_bmbt_change_owner(
 
        ASSERT(tp || buffer_list);
        ASSERT(!(tp && buffer_list));
-       ASSERT(XFS_IFORK_PTR(ip, whichfork)->if_format == XFS_DINODE_FMT_BTREE);
+       ASSERT(xfs_ifork_ptr(ip, whichfork)->if_format == XFS_DINODE_FMT_BTREE);
 
        cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
        cur->bc_ino.flags |= XFS_BTCUR_BMBT_INVALID_OWNER;
index 4048cd9ff56bfb26e94e03a3c9013e73a05bdd7e..65d38637764c821474faf90ad25738f44a841f40 100644 (file)
@@ -719,7 +719,7 @@ xfs_btree_ifork_ptr(
 
        if (cur->bc_flags & XFS_BTREE_STAGING)
                return cur->bc_ino.ifake->if_fork;
-       return XFS_IFORK_PTR(cur->bc_ino.ip, cur->bc_ino.whichfork);
+       return xfs_ifork_ptr(cur->bc_ino.ip, cur->bc_ino.whichfork);
 }
 
 /*
@@ -3553,7 +3553,7 @@ xfs_btree_kill_iroot(
 {
        int                     whichfork = cur->bc_ino.whichfork;
        struct xfs_inode        *ip = cur->bc_ino.ip;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_btree_block  *block;
        struct xfs_btree_block  *cblock;
        union xfs_btree_key     *kp;
index 1b8c2521c02b6af6325af68598e5d83a536b0483..73379b19a6449d1e2ff3bd4efdf0fe179fd8eede 100644 (file)
@@ -1068,7 +1068,7 @@ xfs_dir2_sf_to_block(
        struct xfs_trans        *tp = args->trans;
        struct xfs_inode        *dp = args->dp;
        struct xfs_mount        *mp = dp->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(dp, XFS_DATA_FORK);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(dp, XFS_DATA_FORK);
        struct xfs_da_geometry  *geo = args->geo;
        xfs_dir2_db_t           blkno;          /* dir-relative block # (0) */
        xfs_dir2_data_hdr_t     *hdr;           /* block header */
index 751b634780cfc0fb7e028f49a56e4d604ae0fbb7..9dc42db1993684ad54d05a357b3d3917aacbdc62 100644 (file)
@@ -710,7 +710,7 @@ xfs_dir2_sf_verify(
        struct xfs_inode                *ip)
 {
        struct xfs_mount                *mp = ip->i_mount;
-       struct xfs_ifork                *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+       struct xfs_ifork                *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
        struct xfs_dir2_sf_hdr          *sfp;
        struct xfs_dir2_sf_entry        *sfep;
        struct xfs_dir2_sf_entry        *next_sfep;
index cf0dd52eb3c940a245cdf2c170a7c19968c1bb33..bcf3d1bdeed0fc91d0be0796fcc75b18ee898aa2 100644 (file)
@@ -33,7 +33,7 @@ xfs_init_local_fork(
        const void              *data,
        int64_t                 size)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        int                     mem_size = size;
        bool                    zero_terminate;
 
@@ -100,7 +100,7 @@ xfs_iformat_extents(
        int                     whichfork)
 {
        struct xfs_mount        *mp = ip->i_mount;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        int                     state = xfs_bmap_fork_to_state(whichfork);
        xfs_extnum_t            nex = xfs_dfork_nextents(dip, whichfork);
        int                     size = nex * sizeof(xfs_bmbt_rec_t);
@@ -171,7 +171,7 @@ xfs_iformat_btree(
        int                     size;
        int                     level;
 
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
        size = XFS_BMAP_BROOT_SPACE(mp, dfp);
        nrecs = be16_to_cpu(dfp->bb_numrecs);
@@ -368,7 +368,7 @@ xfs_iroot_realloc(
                return;
        }
 
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        if (rec_diff > 0) {
                /*
                 * If there wasn't any memory allocated before, just
@@ -478,7 +478,7 @@ xfs_idata_realloc(
        int64_t                 byte_diff,
        int                     whichfork)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        int64_t                 new_size = ifp->if_bytes + byte_diff;
 
        ASSERT(new_size >= 0);
@@ -537,7 +537,7 @@ xfs_iextents_copy(
        int                     whichfork)
 {
        int                     state = xfs_bmap_fork_to_state(whichfork);
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        struct xfs_iext_cursor  icur;
        struct xfs_bmbt_irec    rec;
        int64_t                 copied = 0;
@@ -589,7 +589,7 @@ xfs_iflush_fork(
 
        if (!iip)
                return;
-       ifp = XFS_IFORK_PTR(ip, whichfork);
+       ifp = xfs_ifork_ptr(ip, whichfork);
        /*
         * This can happen if we gave up in iformat in an error path,
         * for the attribute fork.
@@ -729,7 +729,7 @@ xfs_iext_count_may_overflow(
        int                     whichfork,
        int                     nr_to_add)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, whichfork);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, whichfork);
        uint64_t                max_exts;
        uint64_t                nr_exts;
 
index 4f68c1f20beb386f2009062bb44ab1488b97eafa..50c5fae4e35db7aa212c541c98e88de0975a01a6 100644 (file)
@@ -81,12 +81,6 @@ struct xfs_ifork {
 #define XFS_IFORK_Q(ip)                        ((ip)->i_forkoff != 0)
 #define XFS_IFORK_BOFF(ip)             ((int)((ip)->i_forkoff << 3))
 
-#define XFS_IFORK_PTR(ip,w)            \
-       ((w) == XFS_DATA_FORK ? \
-               &(ip)->i_df : \
-               ((w) == XFS_ATTR_FORK ? \
-                       (ip)->i_afp : \
-                       (ip)->i_cowfp))
 #define XFS_IFORK_DSIZE(ip) \
        (XFS_IFORK_Q(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount))
 #define XFS_IFORK_ASIZE(ip) \
index 14c186a586e3a059f42d3fb527f1bdf6dc931425..29c9f1cc1212d31da2353b17cae42b891338abf6 100644 (file)
@@ -201,7 +201,7 @@ xfs_failaddr_t
 xfs_symlink_shortform_verify(
        struct xfs_inode        *ip)
 {
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
        char                    *sfp = (char *)ifp->if_u1.if_data;
        int                     size = ifp->if_bytes;
        char                    *endp = sfp + size;
index c04b2e0999c0a181f93b6b63a6a7dcb5453b6fef..c98fe31b17e1954d25c286788e73b097c3132dc0 100644 (file)
@@ -1209,7 +1209,7 @@ dir_binval(
                return 0;
 
        geo = tp->t_mountp->m_dir_geo;
-       ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+       ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
        for_each_xfs_iext(ifp, &icur, &rec) {
                for (dabno = roundup(rec.br_startoff, geo->fsbcount);
                     dabno < rec.br_startoff + rec.br_blockcount;
index ba87081ce82565cb9ba5c8acae94dfc540f44b50..4cb38db3ddd6d75c175fdd5350018cc7c61fdb0c 100644 (file)
@@ -162,7 +162,7 @@ qc_count_rtblocks(
        struct xfs_iext_cursor  icur;
        struct xfs_bmbt_irec    got;
        xfs_filblks_t           count = 0;
-       struct xfs_ifork        *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+       struct xfs_ifork        *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
        int                     error;
 
        error = -libxfs_iread_extents(NULL, ip, XFS_DATA_FORK);
@@ -438,7 +438,7 @@ quotacheck_verify(
                return;
        }
 
-       ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
+       ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
        error = -libxfs_iread_extents(NULL, ip, XFS_DATA_FORK);
        if (error) {
                do_warn(