]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: clean up MIN/MAX
authorDave Chinner <dchinner@redhat.com>
Thu, 28 Jun 2018 20:11:58 +0000 (15:11 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 28 Jun 2018 20:11:58 +0000 (15:11 -0500)
Source kernel commit: 9bb54cb56ae8498d35392745f8f050112cec5dcb

Get rid of the MIN/MAX macros and just use the native min/max macros
directly in the XFS code.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr_leaf.c
libxfs/xfs_bmap.c
libxfs/xfs_da_btree.c
libxfs/xfs_dir2_block.c
libxfs/xfs_dir2_leaf.c
libxfs/xfs_sb.c
libxfs/xfs_trans_resv.c

index c200084976f88cd6aa10250d8e600778d41f725c..469e87d03484bed3c62f5eab9ff5cd83014447d5 100644 (file)
@@ -460,7 +460,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes)
         * A data fork btree root must have space for at least
         * MINDBTPTRS key/ptr pairs if the data fork is small or empty.
         */
-       minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS));
+       minforkoff = max(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS));
        minforkoff = roundup(minforkoff, 8) >> 3;
 
        /* attr fork btree root can have at least this many key/ptr pairs */
index 02de4cbf7c83f2b362cadae0693fcf37d6c4275a..aab06d973bf51f09a798e04e6bd8526aaa48981a 100644 (file)
@@ -3458,7 +3458,7 @@ xfs_bmap_btalloc(
        xfs_rmap_skip_owner_update(&args.oinfo);
 
        /* Trim the allocation back to the maximum an AG can fit. */
-       args.maxlen = MIN(ap->length, mp->m_ag_max_usable);
+       args.maxlen = min(ap->length, mp->m_ag_max_usable);
        args.firstblock = *ap->firstblock;
        blen = 0;
        if (nullfb) {
index 73fc24358f19f907573ca57385b18d11862aea99..51f0d5608e46eed655be2f279c55cc590741f629 100644 (file)
@@ -2076,7 +2076,7 @@ xfs_da_grow_inode_int(
                 */
                mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP);
                for (b = *bno, mapi = 0; b < *bno + count; ) {
-                       nmap = MIN(XFS_BMAP_MAX_NMAP, count);
+                       nmap = min(XFS_BMAP_MAX_NMAP, count);
                        c = (int)(*bno + count - b);
                        error = xfs_bmapi_write(tp, dp, b, c,
                                        xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
index d1ffdb391aaf7417b1cf3a0e414f6edf7613d021..554029c2245f05e3920ebdabc588099d53706262 100644 (file)
@@ -498,8 +498,8 @@ xfs_dir2_block_addname(
                        if (mid - lowstale)
                                memmove(&blp[lowstale], &blp[lowstale + 1],
                                        (mid - lowstale) * sizeof(*blp));
-                       lfloglow = MIN(lowstale, lfloglow);
-                       lfloghigh = MAX(mid, lfloghigh);
+                       lfloglow = min(lowstale, lfloglow);
+                       lfloghigh = max(mid, lfloghigh);
                }
                /*
                 * Move entries toward the high-numbered stale entry.
@@ -510,8 +510,8 @@ xfs_dir2_block_addname(
                        if (highstale - mid)
                                memmove(&blp[mid + 1], &blp[mid],
                                        (highstale - mid) * sizeof(*blp));
-                       lfloglow = MIN(mid, lfloglow);
-                       lfloghigh = MAX(highstale, lfloghigh);
+                       lfloglow = min(mid, lfloglow);
+                       lfloghigh = max(highstale, lfloghigh);
                }
                be32_add_cpu(&btp->stale, -1);
        }
index 17415bcbb7735e23d863a6e4407a6dad7dc1a55e..dbe4d2efb069a6ea6f03c21bf71b723ef2e87b3a 100644 (file)
@@ -587,8 +587,8 @@ xfs_dir3_leaf_find_entry(
                                (index - lowstale - 1) *
                                        sizeof(xfs_dir2_leaf_entry_t));
                }
-               *lfloglow = MIN(lowstale, *lfloglow);
-               *lfloghigh = MAX(index - 1, *lfloghigh);
+               *lfloglow = min(lowstale, *lfloglow);
+               *lfloghigh = max(index - 1, *lfloghigh);
                leafhdr->stale--;
                return &ents[index - 1];
        }
@@ -607,8 +607,8 @@ xfs_dir3_leaf_find_entry(
                memmove(&ents[index + 1], &ents[index],
                        (highstale - index) * sizeof(xfs_dir2_leaf_entry_t));
        }
-       *lfloglow = MIN(index, *lfloglow);
-       *lfloghigh = MAX(highstale, *lfloghigh);
+       *lfloglow = min(index, *lfloglow);
+       *lfloghigh = max(highstale, *lfloghigh);
        leafhdr->stale--;
        return &ents[index];
 }
index acfcb3aa01c4c4ee7a689548a71c1a1bf7dde3b4..e0513f69996901120172c8616a0020db26ced1f6 100644 (file)
@@ -753,7 +753,7 @@ xfs_sb_mount_common(
        mp->m_refc_mnr[1] = mp->m_refc_mxr[1] / 2;
 
        mp->m_bsize = XFS_FSB_TO_BB(mp, 1);
-       mp->m_ialloc_inos = (int)MAX((uint16_t)XFS_INODES_PER_CHUNK,
+       mp->m_ialloc_inos = max_t(uint16_t, XFS_INODES_PER_CHUNK,
                                        sbp->sb_inopblock);
        mp->m_ialloc_blks = mp->m_ialloc_inos >> sbp->sb_inopblog;
 
index 63e4b56e4b4b2e6617912e5f2f9256db9a864cbd..4ecf7c2e8740811e2ba336837de58b03f4367c08 100644 (file)
@@ -235,7 +235,7 @@ xfs_calc_write_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX((xfs_calc_inode_res(mp, 1) +
+               max((xfs_calc_inode_res(mp, 1) +
                     xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
                                      XFS_FSB_TO_B(mp, 1)) +
                     xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
@@ -262,7 +262,7 @@ xfs_calc_itruncate_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX((xfs_calc_inode_res(mp, 1) +
+               max((xfs_calc_inode_res(mp, 1) +
                     xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1,
                                      XFS_FSB_TO_B(mp, 1))),
                    (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
@@ -287,7 +287,7 @@ xfs_calc_rename_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX((xfs_calc_inode_res(mp, 4) +
+               max((xfs_calc_inode_res(mp, 4) +
                     xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp),
                                      XFS_FSB_TO_B(mp, 1))),
                    (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) +
@@ -327,7 +327,7 @@ xfs_calc_link_reservation(
 {
        return XFS_DQUOT_LOGRES(mp) +
                xfs_calc_iunlink_remove_reservation(mp) +
-               MAX((xfs_calc_inode_res(mp, 2) +
+               max((xfs_calc_inode_res(mp, 2) +
                     xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
                                      XFS_FSB_TO_B(mp, 1))),
                    (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
@@ -365,7 +365,7 @@ xfs_calc_remove_reservation(
 {
        return XFS_DQUOT_LOGRES(mp) +
                xfs_calc_iunlink_add_reservation(mp) +
-               MAX((xfs_calc_inode_res(mp, 1) +
+               max((xfs_calc_inode_res(mp, 1) +
                     xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
                                      XFS_FSB_TO_B(mp, 1))),
                    (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
@@ -423,7 +423,7 @@ STATIC uint
 xfs_calc_icreate_reservation(xfs_mount_t *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX(xfs_calc_icreate_resv_alloc(mp),
+               max(xfs_calc_icreate_resv_alloc(mp),
                    xfs_calc_create_resv_modify(mp));
 }
 
@@ -631,7 +631,7 @@ STATIC uint
 xfs_calc_attrinval_reservation(
        struct xfs_mount        *mp)
 {
-       return MAX((xfs_calc_inode_res(mp, 1) +
+       return max((xfs_calc_inode_res(mp, 1) +
                    xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
                                     XFS_FSB_TO_B(mp, 1))),
                   (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
@@ -695,7 +695,7 @@ xfs_calc_attrrm_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX((xfs_calc_inode_res(mp, 1) +
+               max((xfs_calc_inode_res(mp, 1) +
                     xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH,
                                      XFS_FSB_TO_B(mp, 1)) +
                     (uint)XFS_FSB_TO_B(mp,