[PATCH v3 3/3] xfs: Print error when unable to allocate inodes or out of free inodes.

raghu.prabhu13
2012-09-26T06:55:59Z

From: Raghavendra D Prabhu <rprabhu@wnohang.net>

When xfs_dialloc is unable to allocate required number of inodes due to global
ceiling, or AGs are out of free inodes but not allowed to allocate inodes or
unable to allocate without continguous free space, printk the error in
ratelimited manner.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
---
fs/xfs/xfs_ialloc.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index e75a39d..e9f911b2 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -991,7 +991,7 @@ xfs_dialloc(

xfs_perag_put(pag);
*inop = NULLFSINO;
- return 0;
+ goto out_spc;
}

if (ialloced) {
@@ -1017,7 +1017,7 @@ nextag:
agno = 0;
if (agno == start_agno) {
*inop = NULLFSINO;
- return noroom ? ENOSPC : 0;
+ goto out_spc;
}
}

@@ -1027,6 +1027,28 @@ out_alloc:
out_error:
xfs_perag_put(pag);
return XFS_ERROR(error);
+out_spc:
+ if (noroom) {
+ xfs_err_ratelimited(mp, "Hit global inode ceiling:");
+ error = ENOSPC;
+ } else if (!okalloc) {
+ /*
+ * implies noroom=0 && (!pag->pagi_freecount && !okalloc) for
+ * all pag
+ */
+ xfs_err_ratelimited(mp,
+ "No AGs with free inodes and allocation not allowed:");
+ error = 0;
+ } else {
+ xfs_err_ratelimited(mp,
+ "Unable to allocate continguous space for inodes:");
+ error = 0;
+ }
+
+ xfs_err_ratelimited(mp, "Required %d, Current %llu, Maximum %llu",
+ XFS_IALLOC_INODES(mp), mp->m_sb.sb_icount, mp->m_maxicount);
+ return error;
+
}

/*
--
1.7.12.1