Add Jan Kara's jbd2 cleanup patches
[ext4-patch-queue.git] / remove-unnecessary-arguments-of-jbd2_journal_write_revoke_records
blobc50b6e49b04ecf5a1b58873ce1371e033f097247
1 jbd2: remove unnecessary arguments of jbd2_journal_write_revoke_records
3 From: Jan Kara <jack@suse.cz>
5 jbd2_journal_write_revoke_records() takes journal pointer and write_op,
6 although journal can be obtained from the passed transaction and
7 write_op is always WRITE_SYNC. Remove these superfluous arguments.
9 Signed-off-by: Jan Kara <jack@suse.cz>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 ---
12  fs/jbd2/commit.c     |  3 +--
13  fs/jbd2/revoke.c     | 33 +++++++++++++++------------------
14  include/linux/jbd2.h |  6 ++----
15  3 files changed, 18 insertions(+), 24 deletions(-)
17 diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
18 index 36345fefa3ff..ae4402d15d46 100644
19 --- a/fs/jbd2/commit.c
20 +++ b/fs/jbd2/commit.c
21 @@ -554,8 +554,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
22                 jbd2_journal_abort(journal, err);
24         blk_start_plug(&plug);
25 -       jbd2_journal_write_revoke_records(journal, commit_transaction,
26 -                                         &log_bufs, WRITE_SYNC);
27 +       jbd2_journal_write_revoke_records(commit_transaction, &log_bufs);
29         jbd_debug(3, "JBD2: commit phase 2b\n");
31 diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
32 index 705ae577882b..c839332be56b 100644
33 --- a/fs/jbd2/revoke.c
34 +++ b/fs/jbd2/revoke.c
35 @@ -122,11 +122,11 @@ struct jbd2_revoke_table_s
38  #ifdef __KERNEL__
39 -static void write_one_revoke_record(journal_t *, transaction_t *,
40 +static void write_one_revoke_record(transaction_t *,
41                                     struct list_head *,
42                                     struct buffer_head **, int *,
43 -                                   struct jbd2_revoke_record_s *, int);
44 -static void flush_descriptor(journal_t *, struct buffer_head *, int, int);
45 +                                   struct jbd2_revoke_record_s *);
46 +static void flush_descriptor(journal_t *, struct buffer_head *, int);
47  #endif
49  /* Utility functions to maintain the revoke table */
50 @@ -519,11 +519,10 @@ void jbd2_journal_switch_revoke_table(journal_t *journal)
51   * Write revoke records to the journal for all entries in the current
52   * revoke hash, deleting the entries as we go.
53   */
54 -void jbd2_journal_write_revoke_records(journal_t *journal,
55 -                                      transaction_t *transaction,
56 -                                      struct list_head *log_bufs,
57 -                                      int write_op)
58 +void jbd2_journal_write_revoke_records(transaction_t *transaction,
59 +                                      struct list_head *log_bufs)
60  {
61 +       journal_t *journal = transaction->t_journal;
62         struct buffer_head *descriptor;
63         struct jbd2_revoke_record_s *record;
64         struct jbd2_revoke_table_s *revoke;
65 @@ -544,16 +543,15 @@ void jbd2_journal_write_revoke_records(journal_t *journal,
66                 while (!list_empty(hash_list)) {
67                         record = (struct jbd2_revoke_record_s *)
68                                 hash_list->next;
69 -                       write_one_revoke_record(journal, transaction, log_bufs,
70 -                                               &descriptor, &offset,
71 -                                               record, write_op);
72 +                       write_one_revoke_record(transaction, log_bufs,
73 +                                               &descriptor, &offset, record);
74                         count++;
75                         list_del(&record->hash);
76                         kmem_cache_free(jbd2_revoke_record_cache, record);
77                 }
78         }
79         if (descriptor)
80 -               flush_descriptor(journal, descriptor, offset, write_op);
81 +               flush_descriptor(journal, descriptor, offset);
82         jbd_debug(1, "Wrote %d revoke records\n", count);
83  }
85 @@ -562,14 +560,13 @@ void jbd2_journal_write_revoke_records(journal_t *journal,
86   * block if the old one is full or if we have not already created one.
87   */
89 -static void write_one_revoke_record(journal_t *journal,
90 -                                   transaction_t *transaction,
91 +static void write_one_revoke_record(transaction_t *transaction,
92                                     struct list_head *log_bufs,
93                                     struct buffer_head **descriptorp,
94                                     int *offsetp,
95 -                                   struct jbd2_revoke_record_s *record,
96 -                                   int write_op)
97 +                                   struct jbd2_revoke_record_s *record)
98  {
99 +       journal_t *journal = transaction->t_journal;
100         int csum_size = 0;
101         struct buffer_head *descriptor;
102         int sz, offset;
103 @@ -597,7 +594,7 @@ static void write_one_revoke_record(journal_t *journal,
104         /* Make sure we have a descriptor with space left for the record */
105         if (descriptor) {
106                 if (offset + sz > journal->j_blocksize - csum_size) {
107 -                       flush_descriptor(journal, descriptor, offset, write_op);
108 +                       flush_descriptor(journal, descriptor, offset);
109                         descriptor = NULL;
110                 }
111         }
112 @@ -654,7 +651,7 @@ static void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh)
114  static void flush_descriptor(journal_t *journal,
115                              struct buffer_head *descriptor,
116 -                            int offset, int write_op)
117 +                            int offset)
119         jbd2_journal_revoke_header_t *header;
121 @@ -670,7 +667,7 @@ static void flush_descriptor(journal_t *journal,
122         set_buffer_jwrite(descriptor);
123         BUFFER_TRACE(descriptor, "write");
124         set_buffer_dirty(descriptor);
125 -       write_dirty_buffer(descriptor, write_op);
126 +       write_dirty_buffer(descriptor, WRITE_SYNC);
128  #endif
130 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
131 index 65407f6c9120..5716d9554e77 100644
132 --- a/include/linux/jbd2.h
133 +++ b/include/linux/jbd2.h
134 @@ -1327,10 +1327,8 @@ extern int          jbd2_journal_init_revoke_caches(void);
135  extern void       jbd2_journal_destroy_revoke(journal_t *);
136  extern int        jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
137  extern int        jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
138 -extern void       jbd2_journal_write_revoke_records(journal_t *journal,
139 -                                                    transaction_t *transaction,
140 -                                                    struct list_head *log_bufs,
141 -                                                    int write_op);
142 +extern void       jbd2_journal_write_revoke_records(transaction_t *transaction,
143 +                                                    struct list_head *log_bufs);
145  /* Recovery revoke support */
146  extern int     jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
147 -- 
148 2.6.2