Commit 4aa99c71 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o
Browse files

jbd2: make jbd2_journal_get_max_txn_bufs() internal



There's no reason to have jbd2_journal_get_max_txn_bufs() public
function. Currently all users are internal and can use
journal->j_max_transaction_buffers instead. This saves some unnecessary
recomputations of the limit as a bonus which becomes important as this
function gets more complex in the following patch.

CC: stable@vger.kernel.org
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20240624170127.3253-1-jack@suse.cz


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 0bab8db4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -766,7 +766,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
		if (first_block < journal->j_tail)
			freed += journal->j_last - journal->j_first;
		/* Update tail only if we free significant amount of space */
		if (freed < jbd2_journal_get_max_txn_bufs(journal))
		if (freed < journal->j_max_transaction_buffers)
			update_tail = 0;
	}
	J_ASSERT(commit_transaction->t_state == T_COMMIT);
+5 −0
Original line number Diff line number Diff line
@@ -1674,6 +1674,11 @@ journal_t *jbd2_journal_init_inode(struct inode *inode)
	return journal;
}

static int jbd2_journal_get_max_txn_bufs(journal_t *journal)
{
	return (journal->j_total_len - journal->j_fc_wbufsize) / 4;
}

/*
 * Given a journal_t structure, initialise the various fields for
 * startup of a new journaling session.  We use this both when creating
+0 −5
Original line number Diff line number Diff line
@@ -1660,11 +1660,6 @@ int jbd2_wait_inode_data(journal_t *journal, struct jbd2_inode *jinode);
int jbd2_fc_wait_bufs(journal_t *journal, int num_blks);
int jbd2_fc_release_bufs(journal_t *journal);

static inline int jbd2_journal_get_max_txn_bufs(journal_t *journal)
{
	return (journal->j_total_len - journal->j_fc_wbufsize) / 4;
}

/*
 * is_journal_abort
 *