xfs_agblock_t agbno;
int j;
int nfree;
+ int ninodes;
int off;
int state;
ino_tree_node_t *ino_rec = NULL;
* Mark sparse inodes as such in the in-core tree. Verify that sparse
* inodes are free and that freecount is consistent with the free mask.
*/
- nfree = 0;
+ nfree = ninodes = 0;
for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
if (ino_issparse(rp, j)) {
if (!suspect && !XFS_INOBT_IS_FREE_DISK(rp, j)) {
}
if (!suspect && ino_rec)
set_inode_sparse(ino_rec, j);
- } else if (XFS_INOBT_IS_FREE_DISK(rp, j)) {
- /* freecount only tracks non-sparse inos */
- nfree++;
+ } else {
+ /* count fields track non-sparse inos */
+ if (XFS_INOBT_IS_FREE_DISK(rp, j))
+ nfree++;
+ ninodes++;
}
}
agno, ino, freecount, nfree);
}
+ /* verify sparse record formats have a valid inode count */
+ if (xfs_sb_version_hassparseinodes(&mp->m_sb) &&
+ ninodes != rp->ir_u.sp.ir_count) {
+ do_warn(
+_("invalid inode count, inode chunk %d/%u, count %d ninodes %d\n"),
+ agno, ino, rp->ir_u.sp.ir_count, ninodes);
+ }
+
return suspect;
}
xfs_agblock_t agbno;
int j;
int nfree;
+ int ninodes;
int off;
int state;
ino_tree_node_t *ino_rec = NULL;
return ++suspect;
}
- nfree = 0;
+ nfree = ninodes = 0;
for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
int isfree = XFS_INOBT_IS_FREE_DISK(rp, j);
int issparse = ino_issparse(rp, j);
+ if (!issparse)
+ ninodes++;
if (isfree && !issparse)
nfree++;
* Mark sparse inodes as such in the in-core tree. Verify that sparse
* inodes are free and that freecount is consistent with the free mask.
*/
- nfree = 0;
+ nfree = ninodes = 0;
for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
if (ino_issparse(rp, j)) {
if (!suspect && !XFS_INOBT_IS_FREE_DISK(rp, j)) {
}
if (!suspect && ino_rec)
set_inode_sparse(ino_rec, j);
- } else if (XFS_INOBT_IS_FREE_DISK(rp, j)) {
- /* freecount only tracks non-sparse inos */
- nfree++;
+ } else {
+ /* count fields track non-sparse inos */
+ if (XFS_INOBT_IS_FREE_DISK(rp, j))
+ nfree++;
+ ninodes++;
}
+
}
check_freecount:
_("finobt record with no free inodes, inode chunk %d/%u\n"), agno, ino);
}
+ /* verify sparse record formats have a valid inode count */
+ if (xfs_sb_version_hassparseinodes(&mp->m_sb) &&
+ ninodes != rp->ir_u.sp.ir_count) {
+ do_warn(
+_("invalid inode count, inode chunk %d/%u, count %d ninodes %d\n"),
+ agno, ino, rp->ir_u.sp.ir_count, ninodes);
+ }
+
return suspect;
}