From: Darrick J. Wong <djwong@kernel.org>
Any time we try to modify a file's contents and it fails due to ENOSPC
or EDQUOT, force inode inactivation work to try to free space. We're
going to use the xfs_inodegc_free_space function externally in the next
patch, so add it to xfs_icache.h now to reduce churn.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_icache.c | 10 ++++++++--
fs/xfs/xfs_icache.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 6081bba3c6ce..594d340bbe37 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1868,10 +1868,16 @@ xfs_blockgc_free_space(
struct xfs_mount *mp,
struct xfs_eofblocks *eofb)
{
+ int error;
+
trace_xfs_blockgc_free_space(mp, eofb, _RET_IP_);
- return xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
+ error = xfs_inode_walk(mp, 0, xfs_blockgc_scan_inode, eofb,
XFS_ICI_BLOCKGC_TAG);
+ if (error)
+ return error;
+
+ return xfs_inodegc_free_space(mp, eofb);
}
/*@@ -2054,7 +2060,7 @@ xfs_inactive_inode(
* corrupted, we still need to clear the INACTIVE iflag so that we can move
* on to reclaiming the inode.
*/
-static int
+int
xfs_inodegc_free_space(
struct xfs_mount *mp,
struct xfs_eofblocks *eofb)
diff --git a/fs/xfs/xfs_icache.h b/fs/xfs/xfs_icache.h
index c199b920722a..9d5a1f4c0369 100644
--- a/fs/xfs/xfs_icache.h
+++ b/fs/xfs/xfs_icache.h
@@ -86,5 +86,6 @@ void xfs_inodegc_worker(struct work_struct *work);
void xfs_inodegc_force(struct xfs_mount *mp);
void xfs_inodegc_stop(struct xfs_mount *mp);
void xfs_inodegc_start(struct xfs_mount *mp);
+int xfs_inodegc_free_space(struct xfs_mount *mp, struct xfs_eofblocks *eofb);
#endif