int whichfork)
{
xfs_bmbt_rec_t *rp;
+ xfs_extnum_t max_nex;
rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
*nex = xfs_dfork_nextents(dip, whichfork);
- if (*nex < 0 || *nex > XFS_DFORK_SIZE(dip, mp, whichfork) /
+ max_nex = xfs_iext_max_nextents(
+ xfs_dinode_has_large_extent_counts(dip),
+ whichfork);
+ if (*nex > max_nex || *nex > XFS_DFORK_SIZE(dip, mp, whichfork) /
sizeof(xfs_bmbt_rec_t)) {
if (!sflag || id->ilist)
- dbprintf(_("bad number of extents %d for inode %lld\n"),
- *nex, id->ino);
+ dbprintf(_("bad number of extents %llu for inode %lld\n"),
+ (unsigned long long)*nex, id->ino);
error++;
return;
}
{
int whichfork;
int used;
- xfs_extnum_t nex;
+ xfs_extnum_t nex, max_nex;
whichfork = (itype == TYP_ATTR) ? XFS_ATTR_FORK : XFS_DATA_FORK;
nex = xfs_dfork_nextents(dip, whichfork);
+ max_nex = xfs_iext_max_nextents(
+ xfs_dinode_has_large_extent_counts(dip),
+ whichfork);
used = nex * sizeof(xfs_bmbt_rec_t);
- if (nex < 0 || used > XFS_DFORK_SIZE(dip, mp, whichfork)) {
+ if (nex > max_nex || used > XFS_DFORK_SIZE(dip, mp, whichfork)) {
if (show_warnings)
- print_warning("bad number of extents %d in inode %lld",
- nex, (long long)cur_ino);
+ print_warning("bad number of extents %llu in inode %lld",
+ (unsigned long long)nex, (long long)cur_ino);
return 1;
}
xfs_bmbt_rec_t *rp;
xfs_fileoff_t first_key;
xfs_fileoff_t last_key;
- xfs_extnum_t numrecs;
+ xfs_extnum_t numrecs, max_numrecs;
int ret;
lino = XFS_AGINO_TO_INO(mp, agno, ino);
* be in the range of valid on-disk numbers, which is:
* 0 < numrecs < 2^31 - 1
*/
- if (numrecs < 0)
+ max_numrecs = xfs_iext_max_nextents(
+ xfs_dinode_has_large_extent_counts(dip),
+ whichfork);
+ if (numrecs > max_numrecs)
numrecs = *nex;
/*
{
xfs_ino_t lino = XFS_AGINO_TO_INO(mp, agno, ino);
int err = 0;
- xfs_extnum_t nex;
+ xfs_extnum_t nex, max_nex;
/*
* extent count on disk is only valid for positive values. The kernel
* here, trash it!
*/
nex = xfs_dfork_data_extents(dino);
- if (nex < 0)
+ max_nex = xfs_iext_max_nextents(
+ xfs_dinode_has_large_extent_counts(dino),
+ XFS_DATA_FORK);
+ if (nex > max_nex)
*nextents = 1;
else
*nextents = nex;