From: Darrick J. Wong <djwong@xxxxxxxxxx> Check and repair the new block headers attached to rtsummary blocks. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- repair/phase6.c | 19 ++++++++++++++++--- repair/rt.c | 6 +++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/repair/phase6.c b/repair/phase6.c index ad70b22a953..1dbd600915d 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -886,6 +886,8 @@ fill_rsumino(xfs_mount_t *mp) } while (bno < end_bno) { + xfs_daddr_t daddr; + /* * fill the file one block at a time */ @@ -899,9 +901,8 @@ fill_rsumino(xfs_mount_t *mp) ASSERT(map.br_startblock != HOLESTARTBLOCK); - error = -libxfs_trans_read_buf( - mp, tp, mp->m_dev, - XFS_FSB_TO_DADDR(mp, map.br_startblock), + daddr = XFS_FSB_TO_DADDR(mp, map.br_startblock); + error = -libxfs_trans_read_buf(mp, tp, mp->m_dev, daddr, XFS_FSB_TO_BB(mp, 1), 1, &bp, NULL); if (error) { @@ -915,6 +916,18 @@ _("can't access block %" PRIu64 " (fsbno %" PRIu64 ") of realtime summary inode memcpy(xfs_rsumblock_infoptr(bp, 0), smp, mp->m_blockwsize << XFS_WORDLOG); + if (xfs_has_rtgroups(mp)) { + struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; + + bp->b_ops = &xfs_rtsummary_buf_ops; + hdr->rt_magic = cpu_to_be32(XFS_RTSUMMARY_MAGIC); + hdr->rt_owner = cpu_to_be64(ip->i_ino); + hdr->rt_lsn = 0; + hdr->rt_blkno = cpu_to_be64(daddr); + platform_uuid_copy(&hdr->rt_uuid, + &mp->m_sb.sb_meta_uuid); + } + libxfs_trans_log_buf(tp, bp, 0, mp->m_sb.sb_blocksize - 1); smp += mp->m_blockwsize; diff --git a/repair/rt.c b/repair/rt.c index e7190383da3..33641031731 100644 --- a/repair/rt.c +++ b/repair/rt.c @@ -261,11 +261,15 @@ void check_rtsummary( struct xfs_mount *mp) { + const struct xfs_buf_ops *buf_ops = NULL; + if (need_rsumino) return; + if (xfs_has_rtgroups(mp)) + buf_ops = &xfs_rtsummary_buf_ops; check_rtfile_contents(mp, "rtsummary", mp->m_sb.sb_rsumino, sumcompute, - XFS_B_TO_FSB(mp, mp->m_rsumsize), NULL); + XFS_B_TO_FSB(mp, mp->m_rsumsize), buf_ops); } void