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/ext4_jbd2.h | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) | |
download | linux-stable-d08854f5bcf3ea0cabc6fd2fc49c2d97e00c7c88.tar.gz linux-stable-d08854f5bcf3ea0cabc6fd2fc49c2d97e00c7c88.tar.bz2 linux-stable-d08854f5bcf3ea0cabc6fd2fc49c2d97e00c7c88.zip |
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/ext4_jbd2.h')
-rw-r--r-- | fs/ext4/ext4_jbd2.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index 09c1ef38cbe6..b1d52c14098e 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h @@ -175,6 +175,13 @@ struct ext4_journal_cb_entry { * There is no guaranteed calling order of multiple registered callbacks on * the same transaction. */ +static inline void _ext4_journal_callback_add(handle_t *handle, + struct ext4_journal_cb_entry *jce) +{ + /* Add the jce to transaction's private list */ + list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list); +} + static inline void ext4_journal_callback_add(handle_t *handle, void (*func)(struct super_block *sb, struct ext4_journal_cb_entry *jce, @@ -187,10 +194,11 @@ static inline void ext4_journal_callback_add(handle_t *handle, /* Add the jce to transaction's private list */ jce->jce_func = func; spin_lock(&sbi->s_md_lock); - list_add_tail(&jce->jce_list, &handle->h_transaction->t_private_list); + _ext4_journal_callback_add(handle, jce); spin_unlock(&sbi->s_md_lock); } + /** * ext4_journal_callback_del: delete a registered callback * @handle: active journal transaction handle on which callback was registered |