From: Darrick J. Wong <djwong@xxxxxxxxxx> Support metadata directories in xfs_check. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- db/check.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/db/check.c b/db/check.c index 964756d0ae5..5297ea25459 100644 --- a/db/check.c +++ b/db/check.c @@ -2649,7 +2649,9 @@ process_dir( if (!sflag || id->ilist || CHECK_BLIST(bno)) dbprintf(_("no .. entry for directory %lld\n"), id->ino); error++; - } else if (parent == id->ino && id->ino != mp->m_sb.sb_rootino) { + } else if (parent == id->ino && + id->ino != mp->m_sb.sb_rootino && + id->ino != mp->m_sb.sb_metadirino) { if (!sflag || id->ilist || CHECK_BLIST(bno)) dbprintf(_(". and .. same for non-root directory %lld\n"), id->ino); @@ -2659,6 +2661,11 @@ process_dir( dbprintf(_("root directory %lld has .. %lld\n"), id->ino, parent); error++; + } else if (id->ino == mp->m_sb.sb_metadirino && id->ino != parent) { + if (!sflag || id->ilist || CHECK_BLIST(bno)) + dbprintf(_("metadata directory %lld has .. %lld\n"), + id->ino, parent); + error++; } else if (parent != NULLFSINO && id->ino != parent) addparent_inode(id, parent); } @@ -2902,6 +2909,9 @@ process_inode( type = DBM_DIR; if (dip->di_format == XFS_DINODE_FMT_LOCAL) break; + if (xfs_has_metadir(mp) && + id->ino == mp->m_sb.sb_metadirino) + addlink_inode(id); blkmap = blkmap_alloc(dnextents); break; case S_IFREG: @@ -2910,18 +2920,21 @@ process_inode( else if (id->ino == mp->m_sb.sb_rbmino) { type = DBM_RTBITMAP; blkmap = blkmap_alloc(dnextents); - addlink_inode(id); + if (!xfs_has_metadir(mp)) + addlink_inode(id); } else if (id->ino == mp->m_sb.sb_rsumino) { type = DBM_RTSUM; blkmap = blkmap_alloc(dnextents); - addlink_inode(id); + if (!xfs_has_metadir(mp)) + addlink_inode(id); } else if (id->ino == mp->m_sb.sb_uquotino || id->ino == mp->m_sb.sb_gquotino || id->ino == mp->m_sb.sb_pquotino) { type = DBM_QUOTA; blkmap = blkmap_alloc(dnextents); - addlink_inode(id); + if (!xfs_has_metadir(mp)) + addlink_inode(id); } else type = DBM_DATA;