From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/3] xfs: replace do_mod with native operations
Date: Fri, 8 Jun 2018 08:28:08 +1000 [thread overview]
Message-ID: <20180607222808.GU10363@dastard> (raw)
In-Reply-To: <20180607155437.GK25007@magnolia>
On Thu, Jun 07, 2018 at 08:54:37AM -0700, Darrick J. Wong wrote:
> On Thu, Jun 07, 2018 at 03:27:50PM +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > 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>
> > ---
.....
> > @@ -1090,7 +1094,7 @@ xfs_adjust_extent_unmap_boundaries(
> > struct xfs_mount *mp = ip->i_mount;
> > struct xfs_bmbt_irec imap;
> > int nimap, error;
> > - xfs_extlen_t mod = 0;
> > + xfs_rtblock_t mod = 0;
> >
> > nimap = 1;
> > error = xfs_bmapi_read(ip, *startoffset_fsb, 1, &imap, &nimap, 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);
> > + div64_u64_rem(imap.br_startblock, mp->m_sb.sb_rextsize, &mod);
>
> Why does this need to be a div64_u64_rem? sb_rextsize is 32-bit, so the
> remainder won't exceed 2^32-1, right?
>
> > if (mod)
> > *startoffset_fsb += mp->m_sb.sb_rextsize - mod;
>
> Indeed if it ever did that would screw up this logic, wouldn't it?
Yeah, i think I screwed that one up, probably confused rextsize with
rextents. IOWs mod can remain as a xfs_extlen_t and this can become
div_u64_rem().
I'll fix and repost.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-06-07 22:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 5:27 [PATCH 0/3] xfs: minor cleanups Dave Chinner
2018-06-07 5:27 ` [PATCH 1/3] xfs: move various type verifiers to common file Dave Chinner
2018-06-07 11:41 ` Brian Foster
2018-06-07 15:23 ` Darrick J. Wong
2018-06-08 6:24 ` Christoph Hellwig
2018-06-07 5:27 ` [PATCH 2/3] xfs: replace do_mod with native operations Dave Chinner
2018-06-07 11:42 ` Brian Foster
2018-06-07 16:01 ` Darrick J. Wong
2018-06-07 22:23 ` Dave Chinner
2018-06-07 15:54 ` Darrick J. Wong
2018-06-07 22:28 ` Dave Chinner [this message]
2018-06-08 0:43 ` [PATCH 2/3 V2] " Dave Chinner
2018-06-08 6:19 ` Christoph Hellwig
2018-06-08 7:31 ` Dave Chinner
2018-06-07 5:27 ` [PATCH 3/3] xfs: clean up MIN/MAX Dave Chinner
2018-06-07 11:42 ` Brian Foster
2018-06-08 6:23 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180607222808.GU10363@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox