]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: replace XFS_IFORK_Q with a proper predicate function
authorDarrick J. Wong <djwong@kernel.org>
Wed, 24 Aug 2022 13:40:21 +0000 (15:40 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 30 Aug 2022 08:25:18 +0000 (10:25 +0200)
Source kernel commit: 932b42c66cb5d0ca9800b128415b4ad6b1952b3e

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>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
include/xfs_inode.h
libxfs/util.c
libxfs/xfs_attr.c
libxfs/xfs_attr.h
libxfs/xfs_bmap.c
libxfs/xfs_inode_fork.c
libxfs/xfs_inode_fork.h

index 6470fe4d7164f43fd584f1e54315de6c6dd11601..d3c2bb8faf709c39e5f959516412b23fd151a0e6 100644 (file)
@@ -100,6 +100,11 @@ typedef struct xfs_inode {
        struct inode            i_vnode;
 } xfs_inode_t;
 
+static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
+{
+       return ip->i_forkoff > 0;
+}
+
 static inline struct xfs_ifork *
 xfs_ifork_ptr(
        struct xfs_inode        *ip,
@@ -109,7 +114,7 @@ xfs_ifork_ptr(
        case XFS_DATA_FORK:
                return &ip->i_df;
        case XFS_ATTR_FORK:
-               if (!XFS_IFORK_Q(ip))
+               if (!xfs_inode_has_attr_fork(ip))
                        return NULL;
                return &ip->i_af;
        case XFS_COW_FORK:
index 3e12a188f6200aa044a43126b4ad853851d0cce1..a41d50c4a7fbfca538e50064c7ff949ff5d20caa 100644 (file)
@@ -374,7 +374,7 @@ libxfs_iflush_int(
        if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL &&
            xfs_ifork_verify_local_data(ip))
                return -EFSCORRUPTED;
-       if (XFS_IFORK_Q(ip) &&
+       if (xfs_inode_has_attr_fork(ip) &&
            ip->i_af.if_format == XFS_DINODE_FMT_LOCAL &&
            xfs_ifork_verify_local_attr(ip))
                return -EFSCORRUPTED;
@@ -388,7 +388,7 @@ libxfs_iflush_int(
        xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
 
        xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK);
-       if (XFS_IFORK_Q(ip))
+       if (xfs_inode_has_attr_fork(ip))
                xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK);
 
        /* generate the checksum. */
index 404cff6791cb5a6d258dff409f902bd6c96d903f..2103a06b9ee33777fb4504d17499d3e94182c032 100644 (file)
@@ -65,7 +65,7 @@ int
 xfs_inode_hasattr(
        struct xfs_inode        *ip)
 {
-       if (!XFS_IFORK_Q(ip))
+       if (!xfs_inode_has_attr_fork(ip))
                return 0;
        if (ip->i_af.if_format == XFS_DINODE_FMT_EXTENTS &&
            ip->i_af.if_nextents == 0)
@@ -997,7 +997,7 @@ xfs_attr_set(
                 * If the inode doesn't have an attribute fork, add one.
                 * (inode must not be locked when we call this routine)
                 */
-               if (XFS_IFORK_Q(dp) == 0) {
+               if (xfs_inode_has_attr_fork(dp) == 0) {
                        int sf_size = sizeof(struct xfs_attr_sf_hdr) +
                                xfs_attr_sf_entsize_byname(args->namelen,
                                                args->valuelen);
index 36371c3b9069c4b05013572dfc2999316334a850..81be9b3e40047b928707e620820616407309a197 100644 (file)
@@ -576,7 +576,7 @@ xfs_attr_init_add_state(struct xfs_da_args *args)
         * context, i_af is guaranteed to exist. Hence if the attr fork is
         * null, we were called from a pure remove operation and so we are done.
         */
-       if (!XFS_IFORK_Q(args->dp))
+       if (!xfs_inode_has_attr_fork(args->dp))
                return XFS_DAS_DONE;
 
        args->op_flags |= XFS_DA_OP_ADDNAME;
index c2f87bbbd2f61dc9b4b310abc04eee750d28f678..11d0aa0e79034bb1c34c7e7ec4ee1a716f7eed90 100644 (file)
@@ -1016,7 +1016,7 @@ xfs_bmap_add_attrfork(
        int                     logflags;       /* logging flags */
        int                     error;          /* error return value */
 
-       ASSERT(XFS_IFORK_Q(ip) == 0);
+       ASSERT(xfs_inode_has_attr_fork(ip) == 0);
 
        mp = ip->i_mount;
        ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
@@ -1027,7 +1027,7 @@ xfs_bmap_add_attrfork(
                        rsvd, &tp);
        if (error)
                return error;
-       if (XFS_IFORK_Q(ip))
+       if (xfs_inode_has_attr_fork(ip))
                goto trans_cancel;
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
index 225b7f8ca4855a06cab4d403c8b215d1fe39f8a5..616f31b3c1c9220db442067e7a2d834d235ce9bf 100644 (file)
@@ -715,7 +715,7 @@ xfs_ifork_verify_local_attr(
        struct xfs_ifork        *ifp = &ip->i_af;
        xfs_failaddr_t          fa;
 
-       if (!XFS_IFORK_Q(ip))
+       if (!xfs_inode_has_attr_fork(ip))
                fa = __this_address;
        else
                fa = xfs_attr_shortform_verify(ip);
index 0b912bbe4f4bcf9b2aa7c3829ae9b02f1c2c91f5..efee1195654083697a1b8502d17be4ea1cfdf749 100644 (file)
@@ -78,13 +78,12 @@ struct xfs_ifork {
  * Fork handling.
  */
 
-#define XFS_IFORK_Q(ip)                        ((ip)->i_forkoff != 0)
 #define XFS_IFORK_BOFF(ip)             ((int)((ip)->i_forkoff << 3))
 
 #define XFS_IFORK_DSIZE(ip) \
-       (XFS_IFORK_Q(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount))
+       (xfs_inode_has_attr_fork(ip) ? XFS_IFORK_BOFF(ip) : XFS_LITINO((ip)->i_mount))
 #define XFS_IFORK_ASIZE(ip) \
-       (XFS_IFORK_Q(ip) ? XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : 0)
+       (xfs_inode_has_attr_fork(ip) ? XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : 0)
 #define XFS_IFORK_SIZE(ip,w) \
        ((w) == XFS_DATA_FORK ? \
                XFS_IFORK_DSIZE(ip) : \