case XFS_COW_FORK:
/* No CoW forks filesystem doesn't support out of place writes */
if (!xfs_has_reflink(mp) && !xfs_has_zoned(mp)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
break;
* attr here.
*/
if (!xfs_has_attr(mp))
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
break;
default:
ASSERT(whichfork == XFS_DATA_FORK);
int error;
if (xchk_file_looks_zapped(sc, XFS_SICK_INO_BMBTD_ZAPPED)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
* returning immediately.
*/
if (xchk_file_looks_zapped(sc, XFS_SICK_INO_BMBTA_ZAPPED)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
struct xfs_inode *ip)
{
if (!igrab(VFS_I(ip))) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
return -EFSCORRUPTED;
}
/* Metadata inodes don't live on the rt device. */
if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
/* They should never participate in reflink. */
if (xfs_is_reflink_inode(sc->ip)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
&error))
return error;
if (shared)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
}
/*
*/
if (xfs_inode_hasattr(sc->ip)) {
if (!xfs_has_metadir(sc->mp)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
void xchk_block_set_corrupt(struct xfs_scrub *sc,
struct xfs_buf *bp);
void xchk_ino_set_corrupt(struct xfs_scrub *sc, xfs_ino_t ino);
+#define xchk_ip_set_corrupt(_sc, _ip) \
+ xchk_ino_set_corrupt((_sc), (_ip)->i_ino)
void xchk_fblock_set_corrupt(struct xfs_scrub *sc, int whichfork,
xfs_fileoff_t offset);
#ifdef CONFIG_XFS_QUOTA
/* Plausible size? */
if (sc->ip->i_disk_size < xfs_dir2_sf_hdr_size(0)) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
xchk_dirtree_evaluate(dl, &oc);
if (xchk_dirtree_parentless(dl)) {
if (oc.good || oc.bad || oc.suspect)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
} else {
if (oc.bad || oc.good + oc.suspect != 1)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
if (oc.suspect)
xchk_ino_xref_set_corrupt(sc, sc->ip->i_ino);
}
/* Parent required to do anything else. */
if (mpath->dp == NULL) {
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
return 0;
}
trace_xchk_metapath_lookup(sc, mpath->path, mpath->dp, ino);
if (error == -ENOENT) {
/* No directory entry at all */
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
error = 0;
goto out_ilock;
}
goto out_ilock;
if (ino != sc->ip->i_ino) {
/* Pointing to wrong inode */
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
}
out_ilock:
* count, but it will let them decrease it.
*/
if (total_links > XFS_NLINK_PINNED) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
} else if (total_links > XFS_MAXLINK) {
xchk_ino_set_warning(sc, ip->i_ino);
/* Link counts should match. */
if (total_links != actual_nlink) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
}
* back references.
*/
if (obs.backrefs != 0) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
}
* children.
*/
if (obs.children != 0) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
}
}
* the root directory.
*/
if (obs.parents != 1) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
}
} else if (actual_nlink > 0) {
* least one parent.
*/
if (obs.parents == 0) {
- xchk_ino_set_corrupt(sc, ip->i_ino);
+ xchk_ip_set_corrupt(sc, ip);
goto out_corrupt;
}
}
pp->pptrs_found++;
if (VFS_I(sc->ip)->i_nlink == 0 && pp->pptrs_found > 0)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
else if (VFS_I(sc->ip)->i_nlink > 0 &&
pp->pptrs_found == 0)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
} else {
/*
* Starting with metadir, we allow checking of parent pointers
pp->pptrs_found++;
if (VFS_I(sc->ip)->i_nlink != pp->pptrs_found)
- xchk_ino_set_corrupt(sc, sc->ip->i_ino);
+ xchk_ip_set_corrupt(sc, sc->ip);
}
return 0;
/* Is sb_rextents correct? */
if (mp->m_sb.sb_rextents != rtb->rextents) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
/* Is sb_rextslog correct? */
if (mp->m_sb.sb_rextslog != rtb->rextslog) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
* case can we exceed 4bn bitmap blocks since the super field is a u32.
*/
if (rtb->rbmblocks > U32_MAX) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
if (mp->m_sb.sb_rbmblocks != rtb->rbmblocks) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
/* The bitmap file length must be aligned to an fsblock. */
if (rbmip->i_disk_size & mp->m_blockmask) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
* file can be larger than sb_rbmblocks.
*/
if (rbmip->i_disk_size < XFS_FSB_TO_B(mp, rtb->rbmblocks)) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
/* Is sb_rextents correct? */
if (mp->m_sb.sb_rextents != rts->rextents) {
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
/* Is m_rsumlevels correct? */
if (mp->m_rsumlevels != rts->rsumlevels) {
- xchk_ino_set_corrupt(sc, rsumip->i_ino);
+ xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/* Is m_rsumsize correct? */
if (mp->m_rsumblocks != rts->rsumblocks) {
- xchk_ino_set_corrupt(sc, rsumip->i_ino);
+ xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
/* The summary file length must be aligned to an fsblock. */
if (rsumip->i_disk_size & mp->m_blockmask) {
- xchk_ino_set_corrupt(sc, rsumip->i_ino);
+ xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
* the file can be larger than rsumsize.
*/
if (rsumip->i_disk_size < XFS_FSB_TO_B(mp, rts->rsumblocks)) {
- xchk_ino_set_corrupt(sc, rsumip->i_ino);
+ xchk_ip_set_corrupt(sc, rsumip);
return 0;
}
* EFSCORRUPTED means the rtbitmap is corrupt, which is an xref
* error since we're checking the summary file.
*/
- xchk_ino_set_corrupt(sc, rbmip->i_ino);
+ xchk_ip_set_corrupt(sc, rbmip);
return 0;
}
if (error)