linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/5] xfs: reinitialize rm_flags when unpacking an offset into an rmap irec
Date: Thu, 29 Aug 2019 00:29:57 -0700	[thread overview]
Message-ID: <20190829072957.GF18102@infradead.org> (raw)
In-Reply-To: <156685618619.2853674.16603505107055424362.stgit@magnolia>

On Mon, Aug 26, 2019 at 02:49:46PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> In xfs_rmap_irec_offset_unpack, we should always clear the contents of
> rm_flags before we begin unpacking the encoded (ondisk) offset into the
> incore rm_offset and incore rm_flags fields.  Remove the open-coded
> field zeroing as this encourages api misuse.

This one doesn't fit the series' theme, does it? :)

> +++ b/fs/xfs/libxfs/xfs_rmap.c
> @@ -168,7 +168,6 @@ xfs_rmap_btrec_to_irec(
>  	union xfs_btree_rec	*rec,
>  	struct xfs_rmap_irec	*irec)
>  {
> -	irec->rm_flags = 0;
>  	irec->rm_startblock = be32_to_cpu(rec->rmap.rm_startblock);
>  	irec->rm_blockcount = be32_to_cpu(rec->rmap.rm_blockcount);
>  	irec->rm_owner = be64_to_cpu(rec->rmap.rm_owner);
> diff --git a/fs/xfs/libxfs/xfs_rmap.h b/fs/xfs/libxfs/xfs_rmap.h
> index 0c2c3cb73429..abe633403fd1 100644
> --- a/fs/xfs/libxfs/xfs_rmap.h
> +++ b/fs/xfs/libxfs/xfs_rmap.h
> @@ -68,6 +68,7 @@ xfs_rmap_irec_offset_unpack(
>  	if (offset & ~(XFS_RMAP_OFF_MASK | XFS_RMAP_OFF_FLAGS))
>  		return -EFSCORRUPTED;
>  	irec->rm_offset = XFS_RMAP_OFF(offset);
> +	irec->rm_flags = 0;

The change looks sensible-ish.  But why do we even have a separate
xfs_rmap_irec_offset_unpack with a single caller nd out of the
way in a header?  Wouldn't it make sense to just merge the two
functions?

  parent reply	other threads:[~2019-08-29  7:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 21:49 [PATCH 0/5] xfs: remove unnecessary parameters and returns Darrick J. Wong
2019-08-26 21:49 ` [PATCH 1/5] xfs: remove unnecessary parameter from xfs_iext_inc_seq Darrick J. Wong
2019-08-26 23:16   ` Dave Chinner
2019-08-29  7:25   ` Christoph Hellwig
2019-08-26 21:49 ` [PATCH 2/5] xfs: remove unnecessary int returns from deferred rmap functions Darrick J. Wong
2019-08-26 23:22   ` Dave Chinner
2019-08-29  7:26   ` Christoph Hellwig
2019-08-26 21:49 ` [PATCH 3/5] xfs: remove unnecessary int returns from deferred refcount functions Darrick J. Wong
2019-08-26 23:24   ` Dave Chinner
2019-08-29  7:26   ` Christoph Hellwig
2019-08-26 21:49 ` [PATCH 4/5] xfs: remove unnecessary int returns from deferred bmap functions Darrick J. Wong
2019-08-26 23:25   ` Dave Chinner
2019-08-29  7:27   ` Christoph Hellwig
2019-08-26 21:49 ` [PATCH 5/5] xfs: reinitialize rm_flags when unpacking an offset into an rmap irec Darrick J. Wong
2019-08-26 23:26   ` Dave Chinner
2019-08-29  7:29   ` Christoph Hellwig [this message]
2019-08-29 16:01     ` Darrick J. Wong
2019-08-30 15:31       ` 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=20190829072957.GF18102@infradead.org \
    --to=hch@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).