diff options
| author | 2018-03-06 17:08:31 -0800 | |
|---|---|---|
| committer | 2018-03-11 20:27:56 -0700 | |
| commit | 6231848c3aa5c7378fb0dd7a7fff53e9db7edd09 (patch) | |
| tree | 748319f4f4cc850389eb207aa9021c53e2498bdb /fs/xfs/xfs_inode.c | |
| parent | xfs: convert a few more directory asserts to corruption (diff) | |
| download | linux-dev-6231848c3aa5c7378fb0dd7a7fff53e9db7edd09.tar.xz linux-dev-6231848c3aa5c7378fb0dd7a7fff53e9db7edd09.zip | |
xfs: check for cow blocks before trying to clear them
There's no point in allocating a transaction and locking the inode in
preparation to clear cow blocks if there actually are any cow fork
extents. Therefore, move the xfs_reflink_cancel_cow_range hunk to
xfs_inactive and check the cow ifp first. This makes inode reclamation
run faster.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
| -rw-r--r-- | fs/xfs/xfs_inode.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 604ee384a00a..50fbbf5f5a7a 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1872,6 +1872,7 @@ xfs_inactive( xfs_inode_t *ip) { struct xfs_mount *mp; + struct xfs_ifork *cow_ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); int error; int truncate = 0; @@ -1892,6 +1893,10 @@ xfs_inactive( if (mp->m_flags & XFS_MOUNT_RDONLY) return; + /* Try to clean out the cow blocks if there are any. */ + if (xfs_is_reflink_inode(ip) && cow_ifp->if_bytes > 0) + xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true); + if (VFS_I(ip)->i_nlink != 0) { /* * force is true because we are evicting an inode from the |
