diff options
author | Theodore Ts'o <tytso@mit.edu> | 2016-06-26 18:24:01 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-06-26 18:24:01 -0400 |
commit | d08854f5bcf3ea0cabc6fd2fc49c2d97e00c7c88 (patch) | |
tree | 50365a520f03df76963fb61fc12be9689a718d58 /fs/ext4/balloc.c | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) |
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>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 3020fd70c392..0b8105b3293d 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -610,7 +610,9 @@ int ext4_should_retry_alloc(struct super_block *sb, int *retries) jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id); - jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); + smp_mb(); + if (EXT4_SB(sb)->s_mb_free_pending) + jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal); return 1; } |