1 jbd2: simplify calling convention around __jbd2_journal_clean_checkpoint_list
3 From: Jan Kara <jack@suse.cz>
5 __jbd2_journal_clean_checkpoint_list() returns number of buffers it
6 freed but noone was using the value so just stop doing that. This
7 also allows for simplifying the calling convention for
8 journal_clean_once_cp_list().
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 fs/jbd2/checkpoint.c | 56 ++++++++++++++++++++++++--------------------------------
14 include/linux/jbd2.h | 2 +-
15 2 files changed, 25 insertions(+), 33 deletions(-)
17 diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
18 index 3ab4c5e..988b32e 100644
19 --- a/fs/jbd2/checkpoint.c
20 +++ b/fs/jbd2/checkpoint.c
21 @@ -421,16 +421,15 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
24 * Called with j_list_lock held.
25 - * Returns number of buffers reaped (for debug)
26 + * Returns 1 if we freed the transaction, 0 otherwise.
29 -static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
30 +static int journal_clean_one_cp_list(struct journal_head *jh)
32 struct journal_head *last_jh;
33 struct journal_head *next_jh = jh;
42 @@ -441,11 +440,9 @@ static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
43 ret = __try_to_free_cp_buf(jh);
55 * This function only frees up some memory
56 * if possible so we dont have an obligation
57 @@ -465,53 +462,48 @@ static int journal_clean_one_cp_list(struct journal_head *jh, int *released)
58 * Find all the written-back checkpoint buffers in the journal and release them.
60 * Called with j_list_lock held.
61 - * Returns number of buffers reaped (for debug)
64 -int __jbd2_journal_clean_checkpoint_list(journal_t *journal)
65 +void __jbd2_journal_clean_checkpoint_list(journal_t *journal)
67 transaction_t *transaction, *last_transaction, *next_transaction;
72 transaction = journal->j_checkpoint_transactions;
77 last_transaction = transaction->t_cpprev;
78 next_transaction = transaction;
80 transaction = next_transaction;
81 next_transaction = transaction->t_cpnext;
82 - ret = journal_clean_one_cp_list(transaction->
83 - t_checkpoint_list, &released);
84 + ret = journal_clean_one_cp_list(transaction->t_checkpoint_list);
86 * This function only frees up some memory if possible so we
87 * dont have an obligation to finish processing. Bail out if
88 * preemption requested:
90 - if (need_resched()) {
102 * It is essential that we are as careful as in the case of
103 * t_checkpoint_list with removing the buffer from the list as
104 * we can possibly see not yet submitted buffers on io_list
106 - ret += journal_clean_one_cp_list(transaction->
107 - t_checkpoint_io_list, &released);
109 - if (need_resched() || !ret)
111 + ret = journal_clean_one_cp_list(transaction->
112 + t_checkpoint_io_list);
113 + if (need_resched())
116 + * Stop scanning if we couldn't free the transaction. This
117 + * avoids pointless scanning of transactions which still
118 + * weren't checkpointed.
122 } while (transaction != last_transaction);
128 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
129 index 0dae71e..704b9a5 100644
130 --- a/include/linux/jbd2.h
131 +++ b/include/linux/jbd2.h
132 @@ -1042,7 +1042,7 @@ void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
133 extern void jbd2_journal_commit_transaction(journal_t *);
135 /* Checkpoint list management */
136 -int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
137 +void __jbd2_journal_clean_checkpoint_list(journal_t *journal);
138 int __jbd2_journal_remove_checkpoint(struct journal_head *);
139 void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);