From: "Darrick J. Wong" <djwong@kernel.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs@vger.kernel.org, cem@kernel.org, hch@lst.de, dgc@kernel.org
Subject: Re: [PATCH 2/8] xfs: remove redundant stat checks after xfs_refcount_insert()
Date: Fri, 16 Oct 2026 12:44:54 -0700 [thread overview]
Message-ID: <20261016194454.GD107986@frogsfrogsfrogs> (raw)
In-Reply-To: <20261016193422.1630907-3-sandeen@redhat.com>
On Fri, Oct 16, 2026 at 02:29:02PM -0500, Eric Sandeen wrote:
> xfs_refcount_insert() simply returns the error and status from
> xfs_btree_insert, which has already validated the insert or returned
> an error.
>
> This makes every instance of the 2nd test in this idiom:
>
> if ((error = xfs_refcount_insert(cnt_cur, &i)))
> return error;
> if (XFS_IS_CORRUPT(mp, i != 1)) {
> xfs_btree_mark_sick(cnt_cur);
> return -EFSCORRUPTED;
> }
>
> unnecessary/unreachable code. Remove them.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks ok,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_refcount.c | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
> index 49e9993ce360..aec6c839220a 100644
> --- a/fs/xfs/libxfs/xfs_refcount.c
> +++ b/fs/xfs/libxfs/xfs_refcount.c
> @@ -457,12 +457,8 @@ xfs_refcount_split_extent(
> error = xfs_refcount_insert(cur, &tmp, &found_rec);
> if (error)
> goto out_error;
> - if (XFS_IS_CORRUPT(cur->bc_mp, found_rec != 1)) {
> - xfs_btree_mark_sick(cur);
> - error = -EFSCORRUPTED;
> - goto out_error;
> - }
> - return error;
> +
> + return 0;
>
> out_error:
> trace_xfs_refcount_split_extent_error(cur, error, _RET_IP_);
> @@ -1191,12 +1187,6 @@ xfs_refcount_adjust_extents(
> &found_tmp);
> if (error)
> goto out_error;
> - if (XFS_IS_CORRUPT(cur->bc_mp,
> - found_tmp != 1)) {
> - xfs_btree_mark_sick(cur);
> - error = -EFSCORRUPTED;
> - goto out_error;
> - }
> } else {
> error = xrefc_free_extent(cur, &tmp);
> if (error)
> @@ -1841,11 +1831,6 @@ xfs_refcount_adjust_cow_extents(
> &found_tmp);
> if (error)
> goto out_error;
> - if (XFS_IS_CORRUPT(cur->bc_mp, found_tmp != 1)) {
> - xfs_btree_mark_sick(cur);
> - error = -EFSCORRUPTED;
> - goto out_error;
> - }
> break;
> case XFS_REFCOUNT_ADJUST_COW_FREE:
> /* Removing a CoW reservation, there should be one extent. */
> --
> 2.55.0
>
>
next prev parent reply other threads:[~2026-10-16 19:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 19:29 [PATCH 0/8] xfs: consolidate btree insert/delete checks Eric Sandeen
2026-10-16 19:29 ` [PATCH 1/8] xfs: remove redundant stat checks after xfs_btree_insert() Eric Sandeen
2026-10-16 19:44 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 2/8] xfs: remove redundant stat checks after xfs_refcount_insert() Eric Sandeen
2026-10-16 19:44 ` Darrick J. Wong [this message]
2026-10-16 19:29 ` [PATCH 3/8] xfs: remove redundant stat checks after xfs_inobt_insert_rec() Eric Sandeen
2026-10-16 19:45 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 4/8] xfs: remove redundant stat check after rcbagbt_insert() Eric Sandeen
2026-10-16 19:45 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 5/8] xfs: remove status parameter from several btree insert functions Eric Sandeen
2026-10-16 19:46 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 6/8] xfs: add stat check to xfs_btree_delete and remove caller checks Eric Sandeen
2026-10-16 19:47 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 7/8] xfs: remove redundant stat checks after xfs_refcount_delete() Eric Sandeen
2026-10-16 19:47 ` Darrick J. Wong
2026-10-16 19:29 ` [PATCH 8/8] xfs: remove status parameter from two btree delete functions Eric Sandeen
2026-10-16 19:47 ` Darrick J. Wong
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=20261016194454.GD107986@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=dgc@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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