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 7/8] xfs: remove redundant stat checks after xfs_refcount_delete()
Date: Fri, 16 Oct 2026 12:47:26 -0700 [thread overview]
Message-ID: <20261016194726.GI107986@frogsfrogsfrogs> (raw)
In-Reply-To: <20261016193422.1630907-8-sandeen@redhat.com>
On Fri, Oct 16, 2026 at 02:29:07PM -0500, Eric Sandeen wrote:
> xfs_refcount_delete() simply returns the error and status from
> xfs_btree_delete, which now validates the delete or returns an error.
>
> This makes every instance of the 2nd test in this idiom:
>
> error = xfs_refcount_delete(cur, &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;
> }
>
> unnecessary/unreachable code. Remove them.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_refcount.c | 30 ------------------------------
> 1 file changed, 30 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
> index bf7526621681..924f839b35a0 100644
> --- a/fs/xfs/libxfs/xfs_refcount.c
> +++ b/fs/xfs/libxfs/xfs_refcount.c
> @@ -500,21 +500,11 @@ xfs_refcount_merge_center_extents(
> error = xfs_refcount_delete(cur, &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;
> - }
>
> if (center->rc_refcount > 1) {
> error = xfs_refcount_delete(cur, &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;
> - }
> }
>
> /* Enlarge the left extent. */
> @@ -574,11 +564,6 @@ xfs_refcount_merge_left_extent(
> error = xfs_refcount_delete(cur, &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;
> - }
> }
>
> /* Enlarge the left extent. */
> @@ -641,11 +626,6 @@ xfs_refcount_merge_right_extent(
> error = xfs_refcount_delete(cur, &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;
> - }
> }
>
> /* Enlarge the right extent. */
> @@ -1232,11 +1212,6 @@ xfs_refcount_adjust_extents(
> error = xfs_refcount_delete(cur, &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;
> - }
> goto advloop;
> } else {
> error = xrefc_free_extent(cur, &ext);
> @@ -1847,11 +1822,6 @@ xfs_refcount_adjust_cow_extents(
> error = xfs_refcount_delete(cur, &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;
> - }
> break;
> default:
> ASSERT(0);
> --
> 2.55.0
>
>
next prev parent reply other threads:[~2026-10-16 19:47 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
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 [this message]
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=20261016194726.GI107986@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