提交 3616625a 编写于 作者: Z Zhang Yi 提交者: openeuler-sync-bot

jbd2: remove __journal_try_to_free_buffer()

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I70WHL
CVE: NA

Reference: https://lore.kernel.org/linux-ext4/20230606135928.434610-1-yi.zhang@huaweicloud.com/T/#t

--------------------------------

__journal_try_to_free_buffer() has only one caller and it's logic is
much simple now, so just remove it and open code in
jbd2_journal_try_to_free_buffers().
Signed-off-by: NZhang Yi <yi.zhang@huawei.com>
Reviewed-by: NJan Kara <jack@suse.cz>
Signed-off-by: NZhihao Cheng <chengzhihao1@huawei.com>
(cherry picked from commit b177d4d4)
上级 1b4d87d1
...@@ -2073,29 +2073,6 @@ void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) ...@@ -2073,29 +2073,6 @@ void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh)
__brelse(bh); __brelse(bh);
} }
/*
* Called from jbd2_journal_try_to_free_buffers().
*
* Called under jh->b_state_lock
*/
static void
__journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
{
struct journal_head *jh;
jh = bh2jh(bh);
if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)
return;
spin_lock(&journal->j_list_lock);
/* Remove written-back checkpointed metadata buffer */
if (jh->b_cp_transaction != NULL)
jbd2_journal_try_remove_checkpoint(jh);
spin_unlock(&journal->j_list_lock);
return;
}
/** /**
* jbd2_journal_try_to_free_buffers() - try to free page buffers. * jbd2_journal_try_to_free_buffers() - try to free page buffers.
* @journal: journal for operation * @journal: journal for operation
...@@ -2153,7 +2130,13 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page) ...@@ -2153,7 +2130,13 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct page *page)
continue; continue;
spin_lock(&jh->b_state_lock); spin_lock(&jh->b_state_lock);
__journal_try_to_free_buffer(journal, bh); if (!jh->b_transaction && !jh->b_next_transaction) {
spin_lock(&journal->j_list_lock);
/* Remove written-back checkpointed metadata buffer */
if (jh->b_cp_transaction != NULL)
jbd2_journal_try_remove_checkpoint(jh);
spin_unlock(&journal->j_list_lock);
}
spin_unlock(&jh->b_state_lock); spin_unlock(&jh->b_state_lock);
jbd2_journal_put_journal_head(jh); jbd2_journal_put_journal_head(jh);
if (buffer_jbd(bh)) if (buffer_jbd(bh))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册