Skip to content

Commit daf8396

Browse files
Christoph Hellwigdjwong
authored andcommitted
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 <[email protected]> Reviewed-by: Chandan Babu R <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent b2c2004 commit daf8396

24 files changed

+132
-162
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ xfs_inode_hasattr(
6262
{
6363
if (!XFS_IFORK_Q(ip) ||
6464
(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
65-
ip->i_d.di_anextents == 0))
65+
ip->i_afp->if_nextents == 0))
6666
return 0;
6767
return 1;
6868
}
@@ -214,7 +214,7 @@ xfs_attr_set_args(
214214
*/
215215
if (dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL ||
216216
(dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
217-
dp->i_d.di_anextents == 0)) {
217+
dp->i_afp->if_nextents == 0)) {
218218

219219
/*
220220
* Build initial attribute list (if required).

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,12 @@ xfs_attr_fork_remove(
718718
struct xfs_inode *ip,
719719
struct xfs_trans *tp)
720720
{
721+
ASSERT(ip->i_afp->if_nextents == 0);
722+
721723
xfs_idestroy_fork(ip, XFS_ATTR_FORK);
722724
ip->i_d.di_forkoff = 0;
723725
ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
724726

725-
ASSERT(ip->i_d.di_anextents == 0);
726727
ASSERT(ip->i_afp == NULL);
727728

728729
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);

0 commit comments

Comments
 (0)