From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 2/2] xfs: provide helper for counting extents from if_bytes
Date: Mon, 7 Nov 2016 09:02:58 +1100 [thread overview]
Message-ID: <20161106220258.GM14023@dastard> (raw)
In-Reply-To: <6191b8d6-4a89-0191-728a-18ebdf9254c6@sandeen.net>
On Fri, Nov 04, 2016 at 09:27:18PM -0500, Eric Sandeen wrote:
> The open-coded pattern:
>
> ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)
>
> is all over the xfs code; provide a new helper
> xfs_iext_count(ifp) to count the number of inline extents
> in an inode fork.
....
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
> index 5dd56d3..a9e4904 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.c
> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
> @@ -775,6 +775,16 @@
> }
> }
>
> +/* Count number of inline extents based on if_bytes */
> +xfs_extnum_t
> +xfs_iext_count(struct xfs_ifork *ifp)
> +{
> + xfs_extnum_t nextents;
> +
> + nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
> + return nextents;
> +}
Why not just "return ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);"?
Otherwise looks good - a needed cleanup.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2016-11-06 22:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-05 2:09 [PATCH 0/2] xfs: fix up xfs_swap_extent_forks inline extent handling Eric Sandeen
2016-11-05 2:24 ` [PATCH 1/2] " Eric Sandeen
2016-11-07 14:57 ` Brian Foster
2016-11-07 16:38 ` Eric Sandeen
2016-11-05 2:27 ` [PATCH 2/2] xfs: provide helper for counting extents from if_bytes Eric Sandeen
2016-11-06 22:02 ` Dave Chinner [this message]
2016-11-07 16:45 ` Eric Sandeen
2016-11-07 14:58 ` Brian Foster
2016-11-07 17:35 ` [PATCH 2/2 V2] " Eric Sandeen
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=20161106220258.GM14023@dastard \
--to=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=sandeen@sandeen.net \
/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;
as well as URLs for NNTP newsgroup(s).