diff options
author | Dave Chinner <dchinner@redhat.com> | 2018-06-08 18:54:22 +0200 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-06-08 19:07:52 +0200 |
commit | 0703a8e1c17e2cba742eafe640be3b60f77352c4 (patch) | |
tree | f52e7880cb8e77ef601a5937b1586271e2389b9b /fs/xfs/xfs_bmap_util.c | |
parent | xfs: don't call xfs_da_shrink_inode with NULL bp (diff) | |
download | linux-0703a8e1c17e2cba742eafe640be3b60f77352c4.tar.xz linux-0703a8e1c17e2cba742eafe640be3b60f77352c4.zip |
xfs: replace do_mod with native operations
do_mod() is a hold-over from when we have different sizes for file
offsets and and other internal values for 40 bit XFS filesystems.
Hence depending on build flags variables passed to do_mod() could
change size. We no longer support those small format filesystems and
hence everything is of fixed size theses days, even on 32 bit
platforms.
As such, we can convert all the do_mod() callers to platform
optimised modulus operations as defined by linux/math64.h.
Individual conversions depend on the types of variables being used.
Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 7d26933a542f..c35009a86699 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -80,6 +80,7 @@ xfs_bmap_rtalloc( int error; /* error return value */ xfs_mount_t *mp; /* mount point structure */ xfs_extlen_t prod = 0; /* product factor for allocators */ + xfs_extlen_t mod = 0; /* product factor for allocators */ xfs_extlen_t ralen = 0; /* realtime allocation length */ xfs_extlen_t align; /* minimum allocation alignment */ xfs_rtblock_t rtb; @@ -99,7 +100,8 @@ xfs_bmap_rtalloc( * If the offset & length are not perfectly aligned * then kill prod, it will just get us in trouble. */ - if (do_mod(ap->offset, align) || ap->length % align) + div_u64_rem(ap->offset, align, &mod); + if (mod || ap->length % align) prod = 1; /* * Set ralen to be the actual requested length in rtextents. @@ -936,9 +938,11 @@ xfs_alloc_file_space( do_div(s, extsz); s *= extsz; e = startoffset_fsb + allocatesize_fsb; - if ((temp = do_mod(startoffset_fsb, extsz))) + div_u64_rem(startoffset_fsb, extsz, &temp); + if (temp) e += temp; - if ((temp = do_mod(e, extsz))) + div_u64_rem(e, extsz, &temp); + if (temp) e += extsz - temp; } else { s = 0; @@ -1099,7 +1103,7 @@ xfs_adjust_extent_unmap_boundaries( if (nimap && imap.br_startblock != HOLESTARTBLOCK) { ASSERT(imap.br_startblock != DELAYSTARTBLOCK); - mod = do_mod(imap.br_startblock, mp->m_sb.sb_rextsize); + div_u64_rem(imap.br_startblock, mp->m_sb.sb_rextsize, &mod); if (mod) *startoffset_fsb += mp->m_sb.sb_rextsize - mod; } |