diff options
author | Dave Chinner <dchinner@redhat.com> | 2011-06-22 21:35:00 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2011-06-23 23:13:46 -0400 |
commit | df4368a146d2b350b8398babfe11e2088f741d67 (patch) | |
tree | 2e8137eeaac9528f29fbab770fdf078a7496d5b5 /fs/xfs | |
parent | 778e24bb6dd8682318bb496d4bfdc32b501a6420 (diff) |
xfs: clear XFS_IDIRTY_RELEASE on truncate down
When an inode is truncated down, speculative preallocation is
removed from the inode. This should also reset the state bits for
controlling whether preallocation is subsequently removed when the
file is next closed. The flag is not being cleared, so repeated
operations on a file that first involve a truncate (e.g. multiple
repeated dd invocations on a file) give different file layouts for
the second and subsequent invocations.
Fix this by clearing the XFS_IDIRTY_RELEASE state bit when the
XFS_ITRUNCATED bit is detected in xfs_release() and hence ensure
that speculative delalloc is removed on files that have been
truncated down.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index b7a5fe7c52c8..619720705bc6 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -960,8 +960,11 @@ xfs_release( | |||
960 | * be exposed to that problem. | 960 | * be exposed to that problem. |
961 | */ | 961 | */ |
962 | truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); | 962 | truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); |
963 | if (truncated && VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0) | 963 | if (truncated) { |
964 | xfs_flush_pages(ip, 0, -1, XBF_ASYNC, FI_NONE); | 964 | xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE); |
965 | if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0) | ||
966 | xfs_flush_pages(ip, 0, -1, XBF_ASYNC, FI_NONE); | ||
967 | } | ||
965 | } | 968 | } |
966 | 969 | ||
967 | if (ip->i_d.di_nlink == 0) | 970 | if (ip->i_d.di_nlink == 0) |