ext4: optimize ext4_should_retry_alloc() to improve ENOSPC performance

If there are no pending blocks to be released after a commit, forcing
a journal commit has no hope of helping.  It's possible that a commit
had just completed, so if there are now free blocks available for
allocation, it's worth retrying the commit.

Reported-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o
2016-06-26 18:24:01 -04:00
parent 1a695a905c
commit d08854f5bc
4 changed files with 23 additions and 4 deletions

View File

@@ -1430,6 +1430,7 @@ struct ext4_sb_info {
unsigned short *s_mb_offsets;
unsigned int *s_mb_maxs;
unsigned int s_group_info_size;
unsigned int s_mb_free_pending;
/* tunables */
unsigned long s_stripe;