xfs: move the per-fork nextents fields into struct xfs_ifork
There are there are three extents counters per inode, one for each of the forks. Two are in the legacy icdinode and one is directly in struct xfs_inode. Switch to a single counter in the xfs_ifork structure where it uses up padding at the end of the structure. This simplifies various bits of code that just wants the number of extents counter and can now directly dereference it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
committed by
Darrick J. Wong
parent
b2c20045b6
commit
daf83964a3
@ -825,7 +825,7 @@ xfs_ialloc(
|
||||
inode->i_mode &= ~S_ISGID;
|
||||
|
||||
ip->i_d.di_size = 0;
|
||||
ip->i_d.di_nextents = 0;
|
||||
ip->i_df.if_nextents = 0;
|
||||
ASSERT(ip->i_d.di_nblocks == 0);
|
||||
|
||||
tv = current_time(inode);
|
||||
@ -919,7 +919,6 @@ xfs_ialloc(
|
||||
* Attribute fork settings for new inode.
|
||||
*/
|
||||
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
|
||||
ip->i_d.di_anextents = 0;
|
||||
|
||||
/*
|
||||
* Log the new values stuffed into the inode.
|
||||
@ -1686,7 +1685,7 @@ xfs_inactive_truncate(
|
||||
if (error)
|
||||
goto error_trans_cancel;
|
||||
|
||||
ASSERT(ip->i_d.di_nextents == 0);
|
||||
ASSERT(ip->i_df.if_nextents == 0);
|
||||
|
||||
error = xfs_trans_commit(tp);
|
||||
if (error)
|
||||
@ -1836,7 +1835,7 @@ xfs_inactive(
|
||||
|
||||
if (S_ISREG(VFS_I(ip)->i_mode) &&
|
||||
(ip->i_d.di_size != 0 || XFS_ISIZE(ip) != 0 ||
|
||||
ip->i_d.di_nextents > 0 || ip->i_delayed_blks > 0))
|
||||
ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
|
||||
truncate = 1;
|
||||
|
||||
error = xfs_qm_dqattach(ip);
|
||||
@ -1862,7 +1861,6 @@ xfs_inactive(
|
||||
}
|
||||
|
||||
ASSERT(!ip->i_afp);
|
||||
ASSERT(ip->i_d.di_anextents == 0);
|
||||
ASSERT(ip->i_d.di_forkoff == 0);
|
||||
|
||||
/*
|
||||
@ -2731,8 +2729,7 @@ xfs_ifree(
|
||||
|
||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
||||
ASSERT(VFS_I(ip)->i_nlink == 0);
|
||||
ASSERT(ip->i_d.di_nextents == 0);
|
||||
ASSERT(ip->i_d.di_anextents == 0);
|
||||
ASSERT(ip->i_df.if_nextents == 0);
|
||||
ASSERT(ip->i_d.di_size == 0 || !S_ISREG(VFS_I(ip)->i_mode));
|
||||
ASSERT(ip->i_d.di_nblocks == 0);
|
||||
|
||||
@ -3628,7 +3625,7 @@ xfs_iflush(
|
||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
|
||||
ASSERT(xfs_isiflocked(ip));
|
||||
ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
|
||||
ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
|
||||
ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
|
||||
|
||||
*bpp = NULL;
|
||||
|
||||
@ -3710,7 +3707,7 @@ xfs_iflush_int(
|
||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
|
||||
ASSERT(xfs_isiflocked(ip));
|
||||
ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
|
||||
ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
|
||||
ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
|
||||
ASSERT(iip != NULL && iip->ili_fields != 0);
|
||||
|
||||
dip = xfs_buf_offset(bp, ip->i_imap.im_boffset);
|
||||
@ -3751,13 +3748,13 @@ xfs_iflush_int(
|
||||
goto flush_out;
|
||||
}
|
||||
}
|
||||
if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents >
|
||||
if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) >
|
||||
ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) {
|
||||
xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
|
||||
"%s: detected corrupt incore inode %Lu, "
|
||||
"total extents = %d, nblocks = %Ld, ptr "PTR_FMT,
|
||||
__func__, ip->i_ino,
|
||||
ip->i_d.di_nextents + ip->i_d.di_anextents,
|
||||
ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp),
|
||||
ip->i_d.di_nblocks, ip);
|
||||
goto flush_out;
|
||||
}
|
||||
|
Reference in New Issue
Block a user