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 3/8] xfs: remove redundant stat checks after xfs_inobt_insert_rec()
Date: Fri, 16 Oct 2026 12:45:44 -0700 [thread overview]
Message-ID: <20261016194544.GE107986@frogsfrogsfrogs> (raw)
In-Reply-To: <20261016193422.1630907-4-sandeen@redhat.com>
On Fri, Oct 16, 2026 at 02:29:03PM -0500, Eric Sandeen wrote:
> xfs_inobt_insert_rec() 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_inobt_insert_rec(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 good!
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_ialloc.c | 15 ---------------
> 1 file changed, 15 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index bb6e684f5467..fd916a2a005b 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -236,7 +236,6 @@ xfs_inobt_insert(
> xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
> return error;
> }
> - ASSERT(i == 1);
> }
>
> xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
> @@ -572,12 +571,6 @@ xfs_inobt_insert_sprec(
> nrec->ir_free, &i);
> if (error)
> goto error;
> - if (XFS_IS_CORRUPT(mp, i != 1)) {
> - xfs_btree_mark_sick(cur);
> - error = -EFSCORRUPTED;
> - goto error;
> - }
> -
> goto out;
> }
>
> @@ -647,7 +640,6 @@ xfs_finobt_insert_sprec(
> struct xfs_buf *agbp,
> struct xfs_inobt_rec_incore *nrec) /* in/out: new rec. */
> {
> - struct xfs_mount *mp = pag_mount(pag);
> struct xfs_btree_cur *cur;
> int error;
> int i;
> @@ -665,11 +657,6 @@ xfs_finobt_insert_sprec(
> nrec->ir_free, &i);
> if (error)
> goto error;
> - if (XFS_IS_CORRUPT(mp, i != 1)) {
> - xfs_btree_mark_sick(cur);
> - error = -EFSCORRUPTED;
> - goto error;
> - }
> } else {
> error = xfs_inobt_update(cur, nrec);
> if (error)
> @@ -2254,8 +2241,6 @@ xfs_difree_finobt(
> ibtrec->ir_free, &i);
> if (error)
> goto error;
> - ASSERT(i == 1);
> -
> goto out;
> }
>
> --
> 2.55.0
>
>
next prev parent reply other threads:[~2026-10-16 19:45 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 [this message]
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=20261016194544.GE107986@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