public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chandan Babu R <chandan.babu@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: sandeen@sandeen.net, Christoph Hellwig <hch@lst.de>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] xfs_repair: check the rt summary against observations
Date: Mon, 16 May 2022 16:30:27 +0530	[thread overview]
Message-ID: <87sfp9rbak.fsf@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <165247405608.275439.17901954488914628121.stgit@magnolia>

On Fri, May 13, 2022 at 01:34:16 PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Teach xfs_repair to check the ondisk realtime summary file against its
> own observations.
>

Looks good.

Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>

> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
>  repair/phase5.c |    1 +
>  repair/rt.c     |   71 +++++--------------------------------------------------
>  repair/rt.h     |   11 +--------
>  3 files changed, 8 insertions(+), 75 deletions(-)
>
>
> diff --git a/repair/phase5.c b/repair/phase5.c
> index d1ddd224..b04912d8 100644
> --- a/repair/phase5.c
> +++ b/repair/phase5.c
> @@ -609,6 +609,7 @@ check_rtmetadata(
>  	rtinit(mp);
>  	generate_rtinfo(mp, btmcompute, sumcompute);
>  	check_rtbitmap(mp);
> +	check_rtsummary(mp);
>  }
>  
>  void
> diff --git a/repair/rt.c b/repair/rt.c
> index b964d168..a4cca7aa 100644
> --- a/repair/rt.c
> +++ b/repair/rt.c
> @@ -198,72 +198,13 @@ check_rtbitmap(
>  			mp->m_sb.sb_rbmblocks);
>  }
>  
> -#if 0
> -/*
> - * returns 1 if bad, 0 if good
> - */
> -int
> -check_summary(xfs_mount_t *mp)
> -{
> -	xfs_rfsblock_t	bno;
> -	xfs_suminfo_t	*csp;
> -	xfs_suminfo_t	*fsp;
> -	int		log;
> -	int		error = 0;
> -
> -	error = 0;
> -	csp = sumcompute;
> -	fsp = sumfile;
> -	for (log = 0; log < mp->m_rsumlevels; log++) {
> -		for (bno = 0;
> -		     bno < mp->m_sb.sb_rbmblocks;
> -		     bno++, csp++, fsp++) {
> -			if (*csp != *fsp) {
> -				do_warn(
> -	_("rt summary mismatch, size %d block %llu, file: %d, computed: %d\n"),
> -						log, bno, *fsp, *csp);
> -				error = 1;
> -			}
> -		}
> -	}
> -
> -	return(error);
> -}
> -
> -/*
> - * copy the real-time summary file data into memory
> - */
>  void
> -process_rtsummary(
> -	xfs_mount_t		*mp,
> -	struct xfs_dinode	*dino,
> -	blkmap_t		*blkmap)
> +check_rtsummary(
> +	struct xfs_mount	*mp)
>  {
> -	xfs_fsblock_t		bno;
> -	struct xfs_buf		*bp;
> -	char			*bytes;
> -	int			sumbno;
> +	if (need_rsumino)
> +		return;
>  
> -	for (sumbno = 0; sumbno < blkmap->count; sumbno++) {
> -		bno = blkmap_get(blkmap, sumbno);
> -		if (bno == NULLFSBLOCK) {
> -			do_warn(_("block %d for rtsummary inode is missing\n"),
> -					sumbno);
> -			error++;
> -			continue;
> -		}
> -		error = -libxfs_buf_read(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),
> -				XFS_FSB_TO_BB(mp, 1), 0, NULL, &bp);
> -		if (error) {
> -			do_warn(_("can't read block %d for rtsummary inode\n"),
> -					sumbno);
> -			error++;
> -			continue;
> -		}
> -		bytes = bp->b_un.b_addr;
> -		memmove((char *)sumfile + sumbno * mp->m_sb.sb_blocksize, bytes,
> -			mp->m_sb.sb_blocksize);
> -		libxfs_buf_relse(bp);
> -	}
> +	check_rtfile_contents(mp, "rtsummary", mp->m_sb.sb_rsumino, sumcompute,
> +			XFS_B_TO_FSB(mp, mp->m_rsumsize));
>  }
> -#endif
> diff --git a/repair/rt.h b/repair/rt.h
> index 2023153f..be24e91c 100644
> --- a/repair/rt.h
> +++ b/repair/rt.h
> @@ -17,15 +17,6 @@ generate_rtinfo(xfs_mount_t	*mp,
>  		xfs_suminfo_t	*sumcompute);
>  
>  void check_rtbitmap(struct xfs_mount *mp);
> -
> -#if 0
> -
> -int
> -check_summary(xfs_mount_t	*mp);
> -
> -void
> -process_rtsummary(xfs_mount_t	*mp,
> -		struct blkmap	*blkmap);
> -#endif
> +void check_rtsummary(struct xfs_mount *mp);
>  
>  #endif /* _XFS_REPAIR_RT_H_ */


-- 
chandan

  reply	other threads:[~2022-05-16 11:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 20:33 [PATCHSET v2 0/4] xfs_repair: check rt bitmap and summary Darrick J. Wong
2022-05-13 20:33 ` [PATCH 1/4] xfs_repair: fix sizing of the incore rt space usage map calculation Darrick J. Wong
2022-05-16  9:03   ` Chandan Babu R
2022-05-13 20:34 ` [PATCH 2/4] xfs_repair: check free rt extent count Darrick J. Wong
2022-05-16  9:43   ` Chandan Babu R
2022-05-16 13:44   ` Christoph Hellwig
2022-05-13 20:34 ` [PATCH 3/4] xfs_repair: check the rt bitmap against observations Darrick J. Wong
2022-05-16 10:50   ` Chandan Babu R
2022-05-13 20:34 ` [PATCH 4/4] xfs_repair: check the rt summary " Darrick J. Wong
2022-05-16 11:00   ` Chandan Babu R [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-05 16:04 [PATCHSET 0/4] xfs_repair: check rt bitmap and summary Darrick J. Wong
2022-05-05 16:05 ` [PATCH 4/4] xfs_repair: check the rt summary against observations Darrick J. Wong
2022-05-10 12:54   ` 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=87sfp9rbak.fsf@debian-BULLSEYE-live-builder-AMD64 \
    --to=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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