Re: [PATCH 4/4] xfs_repair: check the rt summary against observations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Looks good.

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

> Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  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



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux