aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-12-18 15:00:11 -0500
committerBen Myers <bpm@sgi.com>2012-01-17 16:08:53 -0500
commitce7ae151ddada3dbf67301464343c154903166b3 (patch)
treedb56a153e7ae07aa5103d001a7d7252dc0891c7e /fs/xfs/xfs_inode.c
parentf392e6319a4e9a028b0c8b48f000bb01d660ad53 (diff)
xfs: remove the i_size field in struct xfs_inode
There is no fundamental need to keep an in-memory inode size copy in the XFS inode. We already have the on-disk value in the dinode, and the separate in-memory copy that we need for regular files only in the XFS inode. Remove the xfs_inode i_size field and change the XFS_ISIZE macro to use the VFS inode i_size field for regular files. Switch code that was directly accessing the i_size field in the xfs_inode to XFS_ISIZE, or in cases where we are limited to regular files direct access of the VFS inode i_size field. This also allows dropping some fairly complicated code in the write path which dealt with keeping the xfs_inode i_size uptodate with the VFS i_size that is getting updated inside ->write_end. Note that we do not bother resetting the VFS i_size when truncating a file that gets freed to zero as there is no point in doing so because the VFS inode is no longer in use at this point. Just relax the assert in xfs_ifree to only check the on-disk size instead. Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 62603369b523..b21022499c2e 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -347,7 +347,6 @@ xfs_iformat(
347 return XFS_ERROR(EFSCORRUPTED); 347 return XFS_ERROR(EFSCORRUPTED);
348 } 348 }
349 ip->i_d.di_size = 0; 349 ip->i_d.di_size = 0;
350 ip->i_size = 0;
351 ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip); 350 ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip);
352 break; 351 break;
353 352
@@ -853,7 +852,6 @@ xfs_iread(
853 } 852 }
854 853
855 ip->i_delayed_blks = 0; 854 ip->i_delayed_blks = 0;
856 ip->i_size = ip->i_d.di_size;
857 855
858 /* 856 /*
859 * Mark the buffer containing the inode as something to keep 857 * Mark the buffer containing the inode as something to keep
@@ -1043,7 +1041,6 @@ xfs_ialloc(
1043 } 1041 }
1044 1042
1045 ip->i_d.di_size = 0; 1043 ip->i_d.di_size = 0;
1046 ip->i_size = 0;
1047 ip->i_d.di_nextents = 0; 1044 ip->i_d.di_nextents = 0;
1048 ASSERT(ip->i_d.di_nblocks == 0); 1045 ASSERT(ip->i_d.di_nblocks == 0);
1049 1046
@@ -1198,7 +1195,7 @@ xfs_itruncate_extents(
1198 int done = 0; 1195 int done = 0;
1199 1196
1200 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL)); 1197 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL));
1201 ASSERT(new_size <= ip->i_size); 1198 ASSERT(new_size <= XFS_ISIZE(ip));
1202 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); 1199 ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
1203 ASSERT(ip->i_itemp != NULL); 1200 ASSERT(ip->i_itemp != NULL);
1204 ASSERT(ip->i_itemp->ili_lock_flags == 0); 1201 ASSERT(ip->i_itemp->ili_lock_flags == 0);
@@ -1712,8 +1709,7 @@ xfs_ifree(
1712 ASSERT(ip->i_d.di_nlink == 0); 1709 ASSERT(ip->i_d.di_nlink == 0);
1713 ASSERT(ip->i_d.di_nextents == 0); 1710 ASSERT(ip->i_d.di_nextents == 0);
1714 ASSERT(ip->i_d.di_anextents == 0); 1711 ASSERT(ip->i_d.di_anextents == 0);
1715 ASSERT((ip->i_d.di_size == 0 && ip->i_size == 0) || 1712 ASSERT(ip->i_d.di_size == 0 || !S_ISREG(ip->i_d.di_mode));
1716 (!S_ISREG(ip->i_d.di_mode)));
1717 ASSERT(ip->i_d.di_nblocks == 0); 1713 ASSERT(ip->i_d.di_nblocks == 0);
1718 1714
1719 /* 1715 /*