diff options
-rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 07349a183a11..1c9e75521250 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c | |||
@@ -376,7 +376,7 @@ xfs_ialloc_ag_alloc( | |||
376 | */ | 376 | */ |
377 | newlen = args.mp->m_ialloc_inos; | 377 | newlen = args.mp->m_ialloc_inos; |
378 | if (args.mp->m_maxicount && | 378 | if (args.mp->m_maxicount && |
379 | percpu_counter_read(&args.mp->m_icount) + newlen > | 379 | percpu_counter_read_positive(&args.mp->m_icount) + newlen > |
380 | args.mp->m_maxicount) | 380 | args.mp->m_maxicount) |
381 | return -ENOSPC; | 381 | return -ENOSPC; |
382 | args.minlen = args.maxlen = args.mp->m_ialloc_blks; | 382 | args.minlen = args.maxlen = args.mp->m_ialloc_blks; |
@@ -1339,10 +1339,13 @@ xfs_dialloc( | |||
1339 | * If we have already hit the ceiling of inode blocks then clear | 1339 | * If we have already hit the ceiling of inode blocks then clear |
1340 | * okalloc so we scan all available agi structures for a free | 1340 | * okalloc so we scan all available agi structures for a free |
1341 | * inode. | 1341 | * inode. |
1342 | * | ||
1343 | * Read rough value of mp->m_icount by percpu_counter_read_positive, | ||
1344 | * which will sacrifice the preciseness but improve the performance. | ||
1342 | */ | 1345 | */ |
1343 | if (mp->m_maxicount && | 1346 | if (mp->m_maxicount && |
1344 | percpu_counter_read(&mp->m_icount) + mp->m_ialloc_inos > | 1347 | percpu_counter_read_positive(&mp->m_icount) + mp->m_ialloc_inos |
1345 | mp->m_maxicount) { | 1348 | > mp->m_maxicount) { |
1346 | noroom = 1; | 1349 | noroom = 1; |
1347 | okalloc = 0; | 1350 | okalloc = 0; |
1348 | } | 1351 | } |