From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/9] xfs: cleanup xfs_verify_media_error
Date: Thu, 24 Sep 2026 13:14:51 -0700 [thread overview]
Message-ID: <20260924201451.GT2705364@frogsfrogsfrogs> (raw)
In-Reply-To: <20260924095740.2732474-5-hch@lst.de>
On Thu, Sep 24, 2026 at 11:57:05AM +0200, Christoph Hellwig wrote:
> Move all the reporting logic into xfs_verify_report_losses, and pass the
> enum xfs_device instead of the group type to it. This keeps all the
> reporting related conditions and translation confined to one place.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_verify_media.c | 46 +++++++++++++++++++--------------------
> 1 file changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/fs/xfs/xfs_verify_media.c b/fs/xfs/xfs_verify_media.c
> index 5ead3976d511..8ce3773aa875 100644
> --- a/fs/xfs/xfs_verify_media.c
> +++ b/fs/xfs/xfs_verify_media.c
> @@ -84,11 +84,14 @@ xfs_verify_report_data_lost(
> return 0;
> }
>
> -/* Walk reverse mappings to look for all file data loss */
> -static int
> +/*
> + * Report data loss on the physical sectors, and if possible, walk the reverse
> + * mappings to also report the loss to the files mapped to these sectors.
> + */
> +static void
> xfs_verify_report_losses(
> struct xfs_mount *mp,
> - enum xfs_group_type type,
> + enum xfs_device dev,
> xfs_daddr_t daddr,
> u64 bblen)
> {
> @@ -97,13 +100,25 @@ xfs_verify_report_losses(
> xfs_fsblock_t start_bno, end_bno;
> uint32_t start_gno, end_gno;
> int error;
> + enum xfs_group_type type;
> +
> + xfs_healthmon_report_media(mp, dev, daddr, bblen);
> + if (!xfs_has_rmapbt(mp))
> + return;
>
> - if (type == XG_TYPE_RTG) {
> + switch (dev) {
> + case XFS_DEV_RT:
> start_bno = xfs_daddr_to_rtb(mp, daddr);
> end_bno = xfs_daddr_to_rtb(mp, daddr + bblen - 1);
> - } else {
> + type = XG_TYPE_RTG;
> + break;
> + case XFS_DEV_DATA:
> start_bno = XFS_DADDR_TO_FSB(mp, daddr);
> end_bno = XFS_DADDR_TO_FSB(mp, daddr + bblen - 1);
> + type = XG_TYPE_AG;
> + break;
> + default:
> + return;
> }
>
> tp = xfs_trans_alloc_empty(mp);
> @@ -164,7 +179,6 @@ xfs_verify_report_losses(
> }
>
> xfs_trans_cancel(tp);
> - return 0;
> }
>
> /*
> @@ -236,25 +250,11 @@ xfs_verify_media_error(
> case BLK_STS_PROTECTION:
> case BLK_STS_IOERR:
> case BLK_STS_MEDIUM:
> + if (me->me_flags & XFS_VERIFY_MEDIA_REPORT)
> + xfs_verify_report_losses(mp, me->me_dev, daddr,
> + bio_bbcount);
> break;
> default:
> - return;
> - }
> -
> - if (!(me->me_flags & XFS_VERIFY_MEDIA_REPORT))
> - return;
> -
> - xfs_healthmon_report_media(mp, me->me_dev, daddr, bio_bbcount);
> -
> - if (!xfs_has_rmapbt(mp))
> - return;
> -
> - switch (me->me_dev) {
> - case XFS_DEV_DATA:
> - xfs_verify_report_losses(mp, XG_TYPE_AG, daddr, bio_bbcount);
> - break;
> - case XFS_DEV_RT:
> - xfs_verify_report_losses(mp, XG_TYPE_RTG, daddr, bio_bbcount);
> break;
> }
> }
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-09-24 20:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 9:57 misc cleanups Christoph Hellwig
2026-09-24 9:57 ` [PATCH 1/9] xfs: centralize setting of buf_ops/buf_type/magic for rtblocks Christoph Hellwig
2026-09-24 19:01 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 2/9] xfs: factor out a xfs_rtfile_initialize_buf helper Christoph Hellwig
2026-09-24 19:02 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 3/9] xfs: add a xfs_rtblock_payload helper Christoph Hellwig
2026-09-24 20:13 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 4/9] xfs: cleanup xfs_verify_media_error Christoph Hellwig
2026-09-24 20:14 ` Darrick J. Wong [this message]
2026-09-24 9:57 ` [PATCH 5/9] xfs: use bdev_rw_virt in xfs_verify_media Christoph Hellwig
2026-09-24 20:18 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 6/9] xfs: lift setting the NOFS context to xfs_end_io Christoph Hellwig
2026-09-24 20:18 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 7/9] xfs: split xfs_end_ioend_write Christoph Hellwig
2026-09-24 20:26 ` Darrick J. Wong
2026-09-25 5:46 ` Christoph Hellwig
2026-09-24 9:57 ` [PATCH 8/9] xfs: factor out a xfs_zoned_fill_srcmap helper Christoph Hellwig
2026-09-24 20:27 ` Darrick J. Wong
2026-09-24 9:57 ` [PATCH 9/9] xfs: calculate end_fsb later in xfs_zoned_fill_srcmap Christoph Hellwig
2026-09-24 20:29 ` Darrick J. Wong
2026-10-05 18:06 ` misc cleanups Carlos Maiolino
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=20260924201451.GT2705364@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hch@lst.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.