Commit 77444ac4 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

jbd2: Drop jbd2_space_needed()

The function is now just a trivial wrapper returning
journal->j_max_transaction_buffers. Drop it.
Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191105164437.32602-19-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 9f356e5a
...@@ -110,7 +110,7 @@ void __jbd2_log_wait_for_space(journal_t *journal) ...@@ -110,7 +110,7 @@ void __jbd2_log_wait_for_space(journal_t *journal)
int nblocks, space_left; int nblocks, space_left;
/* assert_spin_locked(&journal->j_state_lock); */ /* assert_spin_locked(&journal->j_state_lock); */
nblocks = jbd2_space_needed(journal); nblocks = journal->j_max_transaction_buffers;
while (jbd2_log_space_left(journal) < nblocks) { while (jbd2_log_space_left(journal) < nblocks) {
write_unlock(&journal->j_state_lock); write_unlock(&journal->j_state_lock);
mutex_lock_io(&journal->j_checkpoint_mutex); mutex_lock_io(&journal->j_checkpoint_mutex);
......
...@@ -270,12 +270,13 @@ static int add_transaction_credits(journal_t *journal, int blocks, ...@@ -270,12 +270,13 @@ static int add_transaction_credits(journal_t *journal, int blocks,
* *before* starting to dirty potentially checkpointed buffers * *before* starting to dirty potentially checkpointed buffers
* in the new transaction. * in the new transaction.
*/ */
if (jbd2_log_space_left(journal) < jbd2_space_needed(journal)) { if (jbd2_log_space_left(journal) < journal->j_max_transaction_buffers) {
atomic_sub(total, &t->t_outstanding_credits); atomic_sub(total, &t->t_outstanding_credits);
read_unlock(&journal->j_state_lock); read_unlock(&journal->j_state_lock);
jbd2_might_wait_for_commit(journal); jbd2_might_wait_for_commit(journal);
write_lock(&journal->j_state_lock); write_lock(&journal->j_state_lock);
if (jbd2_log_space_left(journal) < jbd2_space_needed(journal)) if (jbd2_log_space_left(journal) <
journal->j_max_transaction_buffers)
__jbd2_log_wait_for_space(journal); __jbd2_log_wait_for_space(journal);
write_unlock(&journal->j_state_lock); write_unlock(&journal->j_state_lock);
return 1; return 1;
......
...@@ -1562,15 +1562,6 @@ static inline int jbd2_journal_has_csum_v2or3(journal_t *journal) ...@@ -1562,15 +1562,6 @@ static inline int jbd2_journal_has_csum_v2or3(journal_t *journal)
return journal->j_chksum_driver != NULL; return journal->j_chksum_driver != NULL;
} }
/*
* Return the minimum number of blocks which must be free in the journal
* before a new transaction may be started. Must be called under j_state_lock.
*/
static inline int jbd2_space_needed(journal_t *journal)
{
return journal->j_max_transaction_buffers;
}
/* /*
* Return number of free blocks in the log. Must be called under j_state_lock. * Return number of free blocks in the log. Must be called under j_state_lock.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment