diff options
author | Mingming Cao <cmm@us.ibm.com> | 2006-10-11 04:20:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-11 14:14:15 -0400 |
commit | f7f4bccb729844a0fa873e224e3a6f7eeed095bb (patch) | |
tree | b5b8ce65b5c17b4a7d45e43a3530f2cc977fb894 /fs | |
parent | 470decc613ab2048b619a01028072d932d9086ee (diff) |
[PATCH] jbd2: rename jbd2 symbols to avoid duplication of jbd symbols
Mingming Cao originally did this work, and Shaggy reproduced it using some
scripts from her.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jbd2/Makefile | 4 | ||||
-rw-r--r-- | fs/jbd2/checkpoint.c | 54 | ||||
-rw-r--r-- | fs/jbd2/commit.c | 122 | ||||
-rw-r--r-- | fs/jbd2/journal.c | 454 | ||||
-rw-r--r-- | fs/jbd2/recovery.c | 46 | ||||
-rw-r--r-- | fs/jbd2/revoke.c | 146 | ||||
-rw-r--r-- | fs/jbd2/transaction.c | 244 |
7 files changed, 535 insertions, 535 deletions
diff --git a/fs/jbd2/Makefile b/fs/jbd2/Makefile index 54aca4868a36..802a3413872a 100644 --- a/fs/jbd2/Makefile +++ b/fs/jbd2/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for the linux journaling routines. | 2 | # Makefile for the linux journaling routines. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_JBD) += jbd.o | 5 | obj-$(CONFIG_JBD2) += jbd2.o |
6 | 6 | ||
7 | jbd-objs := transaction.o commit.o recovery.o checkpoint.o revoke.o journal.o | 7 | jbd2-objs := transaction.o commit.o recovery.o checkpoint.o revoke.o journal.o |
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index 0208cc7ac5d0..68039fa9a566 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/jbd.h> | 22 | #include <linux/jbd2.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | 25 | ||
@@ -95,9 +95,9 @@ static int __try_to_free_cp_buf(struct journal_head *jh) | |||
95 | 95 | ||
96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { | 96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { |
97 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 97 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
98 | ret = __journal_remove_checkpoint(jh) + 1; | 98 | ret = __jbd2_journal_remove_checkpoint(jh) + 1; |
99 | jbd_unlock_bh_state(bh); | 99 | jbd_unlock_bh_state(bh); |
100 | journal_remove_journal_head(bh); | 100 | jbd2_journal_remove_journal_head(bh); |
101 | BUFFER_TRACE(bh, "release"); | 101 | BUFFER_TRACE(bh, "release"); |
102 | __brelse(bh); | 102 | __brelse(bh); |
103 | } else { | 103 | } else { |
@@ -107,19 +107,19 @@ static int __try_to_free_cp_buf(struct journal_head *jh) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * __log_wait_for_space: wait until there is space in the journal. | 110 | * __jbd2_log_wait_for_space: wait until there is space in the journal. |
111 | * | 111 | * |
112 | * Called under j-state_lock *only*. It will be unlocked if we have to wait | 112 | * Called under j-state_lock *only*. It will be unlocked if we have to wait |
113 | * for a checkpoint to free up some space in the log. | 113 | * for a checkpoint to free up some space in the log. |
114 | */ | 114 | */ |
115 | void __log_wait_for_space(journal_t *journal) | 115 | void __jbd2_log_wait_for_space(journal_t *journal) |
116 | { | 116 | { |
117 | int nblocks; | 117 | int nblocks; |
118 | assert_spin_locked(&journal->j_state_lock); | 118 | assert_spin_locked(&journal->j_state_lock); |
119 | 119 | ||
120 | nblocks = jbd_space_needed(journal); | 120 | nblocks = jbd_space_needed(journal); |
121 | while (__log_space_left(journal) < nblocks) { | 121 | while (__jbd2_log_space_left(journal) < nblocks) { |
122 | if (journal->j_flags & JFS_ABORT) | 122 | if (journal->j_flags & JBD2_ABORT) |
123 | return; | 123 | return; |
124 | spin_unlock(&journal->j_state_lock); | 124 | spin_unlock(&journal->j_state_lock); |
125 | mutex_lock(&journal->j_checkpoint_mutex); | 125 | mutex_lock(&journal->j_checkpoint_mutex); |
@@ -130,9 +130,9 @@ void __log_wait_for_space(journal_t *journal) | |||
130 | */ | 130 | */ |
131 | spin_lock(&journal->j_state_lock); | 131 | spin_lock(&journal->j_state_lock); |
132 | nblocks = jbd_space_needed(journal); | 132 | nblocks = jbd_space_needed(journal); |
133 | if (__log_space_left(journal) < nblocks) { | 133 | if (__jbd2_log_space_left(journal) < nblocks) { |
134 | spin_unlock(&journal->j_state_lock); | 134 | spin_unlock(&journal->j_state_lock); |
135 | log_do_checkpoint(journal); | 135 | jbd2_log_do_checkpoint(journal); |
136 | spin_lock(&journal->j_state_lock); | 136 | spin_lock(&journal->j_state_lock); |
137 | } | 137 | } |
138 | mutex_unlock(&journal->j_checkpoint_mutex); | 138 | mutex_unlock(&journal->j_checkpoint_mutex); |
@@ -198,9 +198,9 @@ restart: | |||
198 | * Now in whatever state the buffer currently is, we know that | 198 | * Now in whatever state the buffer currently is, we know that |
199 | * it has been written out and so we can drop it from the list | 199 | * it has been written out and so we can drop it from the list |
200 | */ | 200 | */ |
201 | released = __journal_remove_checkpoint(jh); | 201 | released = __jbd2_journal_remove_checkpoint(jh); |
202 | jbd_unlock_bh_state(bh); | 202 | jbd_unlock_bh_state(bh); |
203 | journal_remove_journal_head(bh); | 203 | jbd2_journal_remove_journal_head(bh); |
204 | __brelse(bh); | 204 | __brelse(bh); |
205 | } | 205 | } |
206 | } | 206 | } |
@@ -252,16 +252,16 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
252 | 252 | ||
253 | spin_unlock(&journal->j_list_lock); | 253 | spin_unlock(&journal->j_list_lock); |
254 | jbd_unlock_bh_state(bh); | 254 | jbd_unlock_bh_state(bh); |
255 | log_start_commit(journal, tid); | 255 | jbd2_log_start_commit(journal, tid); |
256 | log_wait_commit(journal, tid); | 256 | jbd2_log_wait_commit(journal, tid); |
257 | ret = 1; | 257 | ret = 1; |
258 | } else if (!buffer_dirty(bh)) { | 258 | } else if (!buffer_dirty(bh)) { |
259 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); | 259 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); |
260 | BUFFER_TRACE(bh, "remove from checkpoint"); | 260 | BUFFER_TRACE(bh, "remove from checkpoint"); |
261 | __journal_remove_checkpoint(jh); | 261 | __jbd2_journal_remove_checkpoint(jh); |
262 | spin_unlock(&journal->j_list_lock); | 262 | spin_unlock(&journal->j_list_lock); |
263 | jbd_unlock_bh_state(bh); | 263 | jbd_unlock_bh_state(bh); |
264 | journal_remove_journal_head(bh); | 264 | jbd2_journal_remove_journal_head(bh); |
265 | __brelse(bh); | 265 | __brelse(bh); |
266 | ret = 1; | 266 | ret = 1; |
267 | } else { | 267 | } else { |
@@ -296,7 +296,7 @@ static int __process_buffer(journal_t *journal, struct journal_head *jh, | |||
296 | * | 296 | * |
297 | * The journal should be locked before calling this function. | 297 | * The journal should be locked before calling this function. |
298 | */ | 298 | */ |
299 | int log_do_checkpoint(journal_t *journal) | 299 | int jbd2_log_do_checkpoint(journal_t *journal) |
300 | { | 300 | { |
301 | transaction_t *transaction; | 301 | transaction_t *transaction; |
302 | tid_t this_tid; | 302 | tid_t this_tid; |
@@ -309,7 +309,7 @@ int log_do_checkpoint(journal_t *journal) | |||
309 | * don't need checkpointing, just eliminate them from the | 309 | * don't need checkpointing, just eliminate them from the |
310 | * journal straight away. | 310 | * journal straight away. |
311 | */ | 311 | */ |
312 | result = cleanup_journal_tail(journal); | 312 | result = jbd2_cleanup_journal_tail(journal); |
313 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); | 313 | jbd_debug(1, "cleanup_journal_tail returned %d\n", result); |
314 | if (result <= 0) | 314 | if (result <= 0) |
315 | return result; | 315 | return result; |
@@ -374,7 +374,7 @@ restart: | |||
374 | } | 374 | } |
375 | out: | 375 | out: |
376 | spin_unlock(&journal->j_list_lock); | 376 | spin_unlock(&journal->j_list_lock); |
377 | result = cleanup_journal_tail(journal); | 377 | result = jbd2_cleanup_journal_tail(journal); |
378 | if (result < 0) | 378 | if (result < 0) |
379 | return result; | 379 | return result; |
380 | return 0; | 380 | return 0; |
@@ -397,7 +397,7 @@ out: | |||
397 | * we have an abort error outstanding. | 397 | * we have an abort error outstanding. |
398 | */ | 398 | */ |
399 | 399 | ||
400 | int cleanup_journal_tail(journal_t *journal) | 400 | int jbd2_cleanup_journal_tail(journal_t *journal) |
401 | { | 401 | { |
402 | transaction_t * transaction; | 402 | transaction_t * transaction; |
403 | tid_t first_tid; | 403 | tid_t first_tid; |
@@ -452,8 +452,8 @@ int cleanup_journal_tail(journal_t *journal) | |||
452 | journal->j_tail_sequence = first_tid; | 452 | journal->j_tail_sequence = first_tid; |
453 | journal->j_tail = blocknr; | 453 | journal->j_tail = blocknr; |
454 | spin_unlock(&journal->j_state_lock); | 454 | spin_unlock(&journal->j_state_lock); |
455 | if (!(journal->j_flags & JFS_ABORT)) | 455 | if (!(journal->j_flags & JBD2_ABORT)) |
456 | journal_update_superblock(journal, 1); | 456 | jbd2_journal_update_superblock(journal, 1); |
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
@@ -518,7 +518,7 @@ static int journal_clean_one_cp_list(struct journal_head *jh, int *released) | |||
518 | * Returns number of buffers reaped (for debug) | 518 | * Returns number of buffers reaped (for debug) |
519 | */ | 519 | */ |
520 | 520 | ||
521 | int __journal_clean_checkpoint_list(journal_t *journal) | 521 | int __jbd2_journal_clean_checkpoint_list(journal_t *journal) |
522 | { | 522 | { |
523 | transaction_t *transaction, *last_transaction, *next_transaction; | 523 | transaction_t *transaction, *last_transaction, *next_transaction; |
524 | int ret = 0; | 524 | int ret = 0; |
@@ -578,7 +578,7 @@ out: | |||
578 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) | 578 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) |
579 | */ | 579 | */ |
580 | 580 | ||
581 | int __journal_remove_checkpoint(struct journal_head *jh) | 581 | int __jbd2_journal_remove_checkpoint(struct journal_head *jh) |
582 | { | 582 | { |
583 | transaction_t *transaction; | 583 | transaction_t *transaction; |
584 | journal_t *journal; | 584 | journal_t *journal; |
@@ -607,7 +607,7 @@ int __journal_remove_checkpoint(struct journal_head *jh) | |||
607 | * dropped! | 607 | * dropped! |
608 | * | 608 | * |
609 | * The locking here around j_committing_transaction is a bit sleazy. | 609 | * The locking here around j_committing_transaction is a bit sleazy. |
610 | * See the comment at the end of journal_commit_transaction(). | 610 | * See the comment at the end of jbd2_journal_commit_transaction(). |
611 | */ | 611 | */ |
612 | if (transaction == journal->j_committing_transaction) { | 612 | if (transaction == journal->j_committing_transaction) { |
613 | JBUFFER_TRACE(jh, "belongs to committing transaction"); | 613 | JBUFFER_TRACE(jh, "belongs to committing transaction"); |
@@ -617,7 +617,7 @@ int __journal_remove_checkpoint(struct journal_head *jh) | |||
617 | /* OK, that was the last buffer for the transaction: we can now | 617 | /* OK, that was the last buffer for the transaction: we can now |
618 | safely remove this transaction from the log */ | 618 | safely remove this transaction from the log */ |
619 | 619 | ||
620 | __journal_drop_transaction(journal, transaction); | 620 | __jbd2_journal_drop_transaction(journal, transaction); |
621 | 621 | ||
622 | /* Just in case anybody was waiting for more transactions to be | 622 | /* Just in case anybody was waiting for more transactions to be |
623 | checkpointed... */ | 623 | checkpointed... */ |
@@ -636,7 +636,7 @@ out: | |||
636 | * Called with the journal locked. | 636 | * Called with the journal locked. |
637 | * Called with j_list_lock held. | 637 | * Called with j_list_lock held. |
638 | */ | 638 | */ |
639 | void __journal_insert_checkpoint(struct journal_head *jh, | 639 | void __jbd2_journal_insert_checkpoint(struct journal_head *jh, |
640 | transaction_t *transaction) | 640 | transaction_t *transaction) |
641 | { | 641 | { |
642 | JBUFFER_TRACE(jh, "entry"); | 642 | JBUFFER_TRACE(jh, "entry"); |
@@ -666,7 +666,7 @@ void __journal_insert_checkpoint(struct journal_head *jh, | |||
666 | * Called with j_list_lock held. | 666 | * Called with j_list_lock held. |
667 | */ | 667 | */ |
668 | 668 | ||
669 | void __journal_drop_transaction(journal_t *journal, transaction_t *transaction) | 669 | void __jbd2_journal_drop_transaction(journal_t *journal, transaction_t *transaction) |
670 | { | 670 | { |
671 | assert_spin_locked(&journal->j_list_lock); | 671 | assert_spin_locked(&journal->j_list_lock); |
672 | if (transaction->t_cpnext) { | 672 | if (transaction->t_cpnext) { |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 10be51290a27..b1a4eafc1541 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/jbd/commit.c | 2 | * linux/fs/jbd2/commit.c |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 | 4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 |
5 | * | 5 | * |
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/time.h> | 16 | #include <linux/time.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/jbd.h> | 18 | #include <linux/jbd2.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
@@ -111,7 +111,7 @@ static int journal_write_commit_record(journal_t *journal, | |||
111 | if (is_journal_aborted(journal)) | 111 | if (is_journal_aborted(journal)) |
112 | return 0; | 112 | return 0; |
113 | 113 | ||
114 | descriptor = journal_get_descriptor_buffer(journal); | 114 | descriptor = jbd2_journal_get_descriptor_buffer(journal); |
115 | if (!descriptor) | 115 | if (!descriptor) |
116 | return 1; | 116 | return 1; |
117 | 117 | ||
@@ -120,14 +120,14 @@ static int journal_write_commit_record(journal_t *journal, | |||
120 | /* AKPM: buglet - add `i' to tmp! */ | 120 | /* AKPM: buglet - add `i' to tmp! */ |
121 | for (i = 0; i < bh->b_size; i += 512) { | 121 | for (i = 0; i < bh->b_size; i += 512) { |
122 | journal_header_t *tmp = (journal_header_t*)bh->b_data; | 122 | journal_header_t *tmp = (journal_header_t*)bh->b_data; |
123 | tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); | 123 | tmp->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
124 | tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK); | 124 | tmp->h_blocktype = cpu_to_be32(JBD2_COMMIT_BLOCK); |
125 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); | 125 | tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid); |
126 | } | 126 | } |
127 | 127 | ||
128 | JBUFFER_TRACE(descriptor, "write commit block"); | 128 | JBUFFER_TRACE(descriptor, "write commit block"); |
129 | set_buffer_dirty(bh); | 129 | set_buffer_dirty(bh); |
130 | if (journal->j_flags & JFS_BARRIER) { | 130 | if (journal->j_flags & JBD2_BARRIER) { |
131 | set_buffer_ordered(bh); | 131 | set_buffer_ordered(bh); |
132 | barrier_done = 1; | 132 | barrier_done = 1; |
133 | } | 133 | } |
@@ -145,7 +145,7 @@ static int journal_write_commit_record(journal_t *journal, | |||
145 | "disabling barriers\n", | 145 | "disabling barriers\n", |
146 | bdevname(journal->j_dev, b)); | 146 | bdevname(journal->j_dev, b)); |
147 | spin_lock(&journal->j_state_lock); | 147 | spin_lock(&journal->j_state_lock); |
148 | journal->j_flags &= ~JFS_BARRIER; | 148 | journal->j_flags &= ~JBD2_BARRIER; |
149 | spin_unlock(&journal->j_state_lock); | 149 | spin_unlock(&journal->j_state_lock); |
150 | 150 | ||
151 | /* And try again, without the barrier */ | 151 | /* And try again, without the barrier */ |
@@ -155,7 +155,7 @@ static int journal_write_commit_record(journal_t *journal, | |||
155 | ret = sync_dirty_buffer(bh); | 155 | ret = sync_dirty_buffer(bh); |
156 | } | 156 | } |
157 | put_bh(bh); /* One for getblk() */ | 157 | put_bh(bh); /* One for getblk() */ |
158 | journal_put_journal_head(descriptor); | 158 | jbd2_journal_put_journal_head(descriptor); |
159 | 159 | ||
160 | return (ret == -EIO); | 160 | return (ret == -EIO); |
161 | } | 161 | } |
@@ -239,7 +239,7 @@ write_out_data: | |||
239 | if (locked && test_clear_buffer_dirty(bh)) { | 239 | if (locked && test_clear_buffer_dirty(bh)) { |
240 | BUFFER_TRACE(bh, "needs writeout, adding to array"); | 240 | BUFFER_TRACE(bh, "needs writeout, adding to array"); |
241 | wbuf[bufs++] = bh; | 241 | wbuf[bufs++] = bh; |
242 | __journal_file_buffer(jh, commit_transaction, | 242 | __jbd2_journal_file_buffer(jh, commit_transaction, |
243 | BJ_Locked); | 243 | BJ_Locked); |
244 | jbd_unlock_bh_state(bh); | 244 | jbd_unlock_bh_state(bh); |
245 | if (bufs == journal->j_wbufsize) { | 245 | if (bufs == journal->j_wbufsize) { |
@@ -251,13 +251,13 @@ write_out_data: | |||
251 | } | 251 | } |
252 | else { | 252 | else { |
253 | BUFFER_TRACE(bh, "writeout complete: unfile"); | 253 | BUFFER_TRACE(bh, "writeout complete: unfile"); |
254 | __journal_unfile_buffer(jh); | 254 | __jbd2_journal_unfile_buffer(jh); |
255 | jbd_unlock_bh_state(bh); | 255 | jbd_unlock_bh_state(bh); |
256 | if (locked) | 256 | if (locked) |
257 | unlock_buffer(bh); | 257 | unlock_buffer(bh); |
258 | journal_remove_journal_head(bh); | 258 | jbd2_journal_remove_journal_head(bh); |
259 | /* Once for our safety reference, once for | 259 | /* Once for our safety reference, once for |
260 | * journal_remove_journal_head() */ | 260 | * jbd2_journal_remove_journal_head() */ |
261 | put_bh(bh); | 261 | put_bh(bh); |
262 | put_bh(bh); | 262 | put_bh(bh); |
263 | } | 263 | } |
@@ -272,12 +272,12 @@ write_out_data: | |||
272 | } | 272 | } |
273 | 273 | ||
274 | /* | 274 | /* |
275 | * journal_commit_transaction | 275 | * jbd2_journal_commit_transaction |
276 | * | 276 | * |
277 | * The primary function for committing a transaction to the log. This | 277 | * The primary function for committing a transaction to the log. This |
278 | * function is called by the journal thread to begin a complete commit. | 278 | * function is called by the journal thread to begin a complete commit. |
279 | */ | 279 | */ |
280 | void journal_commit_transaction(journal_t *journal) | 280 | void jbd2_journal_commit_transaction(journal_t *journal) |
281 | { | 281 | { |
282 | transaction_t *commit_transaction; | 282 | transaction_t *commit_transaction; |
283 | struct journal_head *jh, *new_jh, *descriptor; | 283 | struct journal_head *jh, *new_jh, *descriptor; |
@@ -305,10 +305,10 @@ void journal_commit_transaction(journal_t *journal) | |||
305 | spin_unlock(&journal->j_list_lock); | 305 | spin_unlock(&journal->j_list_lock); |
306 | #endif | 306 | #endif |
307 | 307 | ||
308 | /* Do we need to erase the effects of a prior journal_flush? */ | 308 | /* Do we need to erase the effects of a prior jbd2_journal_flush? */ |
309 | if (journal->j_flags & JFS_FLUSHED) { | 309 | if (journal->j_flags & JBD2_FLUSHED) { |
310 | jbd_debug(3, "super block updated\n"); | 310 | jbd_debug(3, "super block updated\n"); |
311 | journal_update_superblock(journal, 1); | 311 | jbd2_journal_update_superblock(journal, 1); |
312 | } else { | 312 | } else { |
313 | jbd_debug(3, "superblock not updated\n"); | 313 | jbd_debug(3, "superblock not updated\n"); |
314 | } | 314 | } |
@@ -350,7 +350,7 @@ void journal_commit_transaction(journal_t *journal) | |||
350 | * BJ_Reserved buffers. Note, it is _not_ permissible to assume | 350 | * BJ_Reserved buffers. Note, it is _not_ permissible to assume |
351 | * that there are no such buffers: if a large filesystem | 351 | * that there are no such buffers: if a large filesystem |
352 | * operation like a truncate needs to split itself over multiple | 352 | * operation like a truncate needs to split itself over multiple |
353 | * transactions, then it may try to do a journal_restart() while | 353 | * transactions, then it may try to do a jbd2_journal_restart() while |
354 | * there are still BJ_Reserved buffers outstanding. These must | 354 | * there are still BJ_Reserved buffers outstanding. These must |
355 | * be released cleanly from the current transaction. | 355 | * be released cleanly from the current transaction. |
356 | * | 356 | * |
@@ -358,25 +358,25 @@ void journal_commit_transaction(journal_t *journal) | |||
358 | * again before modifying the buffer in the new transaction, but | 358 | * again before modifying the buffer in the new transaction, but |
359 | * we do not require it to remember exactly which old buffers it | 359 | * we do not require it to remember exactly which old buffers it |
360 | * has reserved. This is consistent with the existing behaviour | 360 | * has reserved. This is consistent with the existing behaviour |
361 | * that multiple journal_get_write_access() calls to the same | 361 | * that multiple jbd2_journal_get_write_access() calls to the same |
362 | * buffer are perfectly permissable. | 362 | * buffer are perfectly permissable. |
363 | */ | 363 | */ |
364 | while (commit_transaction->t_reserved_list) { | 364 | while (commit_transaction->t_reserved_list) { |
365 | jh = commit_transaction->t_reserved_list; | 365 | jh = commit_transaction->t_reserved_list; |
366 | JBUFFER_TRACE(jh, "reserved, unused: refile"); | 366 | JBUFFER_TRACE(jh, "reserved, unused: refile"); |
367 | /* | 367 | /* |
368 | * A journal_get_undo_access()+journal_release_buffer() may | 368 | * A jbd2_journal_get_undo_access()+jbd2_journal_release_buffer() may |
369 | * leave undo-committed data. | 369 | * leave undo-committed data. |
370 | */ | 370 | */ |
371 | if (jh->b_committed_data) { | 371 | if (jh->b_committed_data) { |
372 | struct buffer_head *bh = jh2bh(jh); | 372 | struct buffer_head *bh = jh2bh(jh); |
373 | 373 | ||
374 | jbd_lock_bh_state(bh); | 374 | jbd_lock_bh_state(bh); |
375 | jbd_slab_free(jh->b_committed_data, bh->b_size); | 375 | jbd2_slab_free(jh->b_committed_data, bh->b_size); |
376 | jh->b_committed_data = NULL; | 376 | jh->b_committed_data = NULL; |
377 | jbd_unlock_bh_state(bh); | 377 | jbd_unlock_bh_state(bh); |
378 | } | 378 | } |
379 | journal_refile_buffer(journal, jh); | 379 | jbd2_journal_refile_buffer(journal, jh); |
380 | } | 380 | } |
381 | 381 | ||
382 | /* | 382 | /* |
@@ -385,7 +385,7 @@ void journal_commit_transaction(journal_t *journal) | |||
385 | * frees some memory | 385 | * frees some memory |
386 | */ | 386 | */ |
387 | spin_lock(&journal->j_list_lock); | 387 | spin_lock(&journal->j_list_lock); |
388 | __journal_clean_checkpoint_list(journal); | 388 | __jbd2_journal_clean_checkpoint_list(journal); |
389 | spin_unlock(&journal->j_list_lock); | 389 | spin_unlock(&journal->j_list_lock); |
390 | 390 | ||
391 | jbd_debug (3, "JBD: commit phase 1\n"); | 391 | jbd_debug (3, "JBD: commit phase 1\n"); |
@@ -393,7 +393,7 @@ void journal_commit_transaction(journal_t *journal) | |||
393 | /* | 393 | /* |
394 | * Switch to a new revoke table. | 394 | * Switch to a new revoke table. |
395 | */ | 395 | */ |
396 | journal_switch_revoke_table(journal); | 396 | jbd2_journal_switch_revoke_table(journal); |
397 | 397 | ||
398 | commit_transaction->t_state = T_FLUSH; | 398 | commit_transaction->t_state = T_FLUSH; |
399 | journal->j_committing_transaction = commit_transaction; | 399 | journal->j_committing_transaction = commit_transaction; |
@@ -450,9 +450,9 @@ void journal_commit_transaction(journal_t *journal) | |||
450 | continue; | 450 | continue; |
451 | } | 451 | } |
452 | if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) { | 452 | if (buffer_jbd(bh) && jh->b_jlist == BJ_Locked) { |
453 | __journal_unfile_buffer(jh); | 453 | __jbd2_journal_unfile_buffer(jh); |
454 | jbd_unlock_bh_state(bh); | 454 | jbd_unlock_bh_state(bh); |
455 | journal_remove_journal_head(bh); | 455 | jbd2_journal_remove_journal_head(bh); |
456 | put_bh(bh); | 456 | put_bh(bh); |
457 | } else { | 457 | } else { |
458 | jbd_unlock_bh_state(bh); | 458 | jbd_unlock_bh_state(bh); |
@@ -463,9 +463,9 @@ void journal_commit_transaction(journal_t *journal) | |||
463 | spin_unlock(&journal->j_list_lock); | 463 | spin_unlock(&journal->j_list_lock); |
464 | 464 | ||
465 | if (err) | 465 | if (err) |
466 | __journal_abort_hard(journal); | 466 | __jbd2_journal_abort_hard(journal); |
467 | 467 | ||
468 | journal_write_revoke_records(journal, commit_transaction); | 468 | jbd2_journal_write_revoke_records(journal, commit_transaction); |
469 | 469 | ||
470 | jbd_debug(3, "JBD: commit phase 2\n"); | 470 | jbd_debug(3, "JBD: commit phase 2\n"); |
471 | 471 | ||
@@ -499,7 +499,7 @@ void journal_commit_transaction(journal_t *journal) | |||
499 | 499 | ||
500 | if (is_journal_aborted(journal)) { | 500 | if (is_journal_aborted(journal)) { |
501 | JBUFFER_TRACE(jh, "journal is aborting: refile"); | 501 | JBUFFER_TRACE(jh, "journal is aborting: refile"); |
502 | journal_refile_buffer(journal, jh); | 502 | jbd2_journal_refile_buffer(journal, jh); |
503 | /* If that was the last one, we need to clean up | 503 | /* If that was the last one, we need to clean up |
504 | * any descriptor buffers which may have been | 504 | * any descriptor buffers which may have been |
505 | * already allocated, even if we are now | 505 | * already allocated, even if we are now |
@@ -519,9 +519,9 @@ void journal_commit_transaction(journal_t *journal) | |||
519 | 519 | ||
520 | jbd_debug(4, "JBD: get descriptor\n"); | 520 | jbd_debug(4, "JBD: get descriptor\n"); |
521 | 521 | ||
522 | descriptor = journal_get_descriptor_buffer(journal); | 522 | descriptor = jbd2_journal_get_descriptor_buffer(journal); |
523 | if (!descriptor) { | 523 | if (!descriptor) { |
524 | __journal_abort_hard(journal); | 524 | __jbd2_journal_abort_hard(journal); |
525 | continue; | 525 | continue; |
526 | } | 526 | } |
527 | 527 | ||
@@ -529,8 +529,8 @@ void journal_commit_transaction(journal_t *journal) | |||
529 | jbd_debug(4, "JBD: got buffer %llu (%p)\n", | 529 | jbd_debug(4, "JBD: got buffer %llu (%p)\n", |
530 | (unsigned long long)bh->b_blocknr, bh->b_data); | 530 | (unsigned long long)bh->b_blocknr, bh->b_data); |
531 | header = (journal_header_t *)&bh->b_data[0]; | 531 | header = (journal_header_t *)&bh->b_data[0]; |
532 | header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); | 532 | header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
533 | header->h_blocktype = cpu_to_be32(JFS_DESCRIPTOR_BLOCK); | 533 | header->h_blocktype = cpu_to_be32(JBD2_DESCRIPTOR_BLOCK); |
534 | header->h_sequence = cpu_to_be32(commit_transaction->t_tid); | 534 | header->h_sequence = cpu_to_be32(commit_transaction->t_tid); |
535 | 535 | ||
536 | tagp = &bh->b_data[sizeof(journal_header_t)]; | 536 | tagp = &bh->b_data[sizeof(journal_header_t)]; |
@@ -543,25 +543,25 @@ void journal_commit_transaction(journal_t *journal) | |||
543 | /* Record it so that we can wait for IO | 543 | /* Record it so that we can wait for IO |
544 | completion later */ | 544 | completion later */ |
545 | BUFFER_TRACE(bh, "ph3: file as descriptor"); | 545 | BUFFER_TRACE(bh, "ph3: file as descriptor"); |
546 | journal_file_buffer(descriptor, commit_transaction, | 546 | jbd2_journal_file_buffer(descriptor, commit_transaction, |
547 | BJ_LogCtl); | 547 | BJ_LogCtl); |
548 | } | 548 | } |
549 | 549 | ||
550 | /* Where is the buffer to be written? */ | 550 | /* Where is the buffer to be written? */ |
551 | 551 | ||
552 | err = journal_next_log_block(journal, &blocknr); | 552 | err = jbd2_journal_next_log_block(journal, &blocknr); |
553 | /* If the block mapping failed, just abandon the buffer | 553 | /* If the block mapping failed, just abandon the buffer |
554 | and repeat this loop: we'll fall into the | 554 | and repeat this loop: we'll fall into the |
555 | refile-on-abort condition above. */ | 555 | refile-on-abort condition above. */ |
556 | if (err) { | 556 | if (err) { |
557 | __journal_abort_hard(journal); | 557 | __jbd2_journal_abort_hard(journal); |
558 | continue; | 558 | continue; |
559 | } | 559 | } |
560 | 560 | ||
561 | /* | 561 | /* |
562 | * start_this_handle() uses t_outstanding_credits to determine | 562 | * start_this_handle() uses t_outstanding_credits to determine |
563 | * the free space in the log, but this counter is changed | 563 | * the free space in the log, but this counter is changed |
564 | * by journal_next_log_block() also. | 564 | * by jbd2_journal_next_log_block() also. |
565 | */ | 565 | */ |
566 | commit_transaction->t_outstanding_credits--; | 566 | commit_transaction->t_outstanding_credits--; |
567 | 567 | ||
@@ -576,13 +576,13 @@ void journal_commit_transaction(journal_t *journal) | |||
576 | 576 | ||
577 | set_bit(BH_JWrite, &jh2bh(jh)->b_state); | 577 | set_bit(BH_JWrite, &jh2bh(jh)->b_state); |
578 | /* | 578 | /* |
579 | * akpm: journal_write_metadata_buffer() sets | 579 | * akpm: jbd2_journal_write_metadata_buffer() sets |
580 | * new_bh->b_transaction to commit_transaction. | 580 | * new_bh->b_transaction to commit_transaction. |
581 | * We need to clean this up before we release new_bh | 581 | * We need to clean this up before we release new_bh |
582 | * (which is of type BJ_IO) | 582 | * (which is of type BJ_IO) |
583 | */ | 583 | */ |
584 | JBUFFER_TRACE(jh, "ph3: write metadata"); | 584 | JBUFFER_TRACE(jh, "ph3: write metadata"); |
585 | flags = journal_write_metadata_buffer(commit_transaction, | 585 | flags = jbd2_journal_write_metadata_buffer(commit_transaction, |
586 | jh, &new_jh, blocknr); | 586 | jh, &new_jh, blocknr); |
587 | set_bit(BH_JWrite, &jh2bh(new_jh)->b_state); | 587 | set_bit(BH_JWrite, &jh2bh(new_jh)->b_state); |
588 | wbuf[bufs++] = jh2bh(new_jh); | 588 | wbuf[bufs++] = jh2bh(new_jh); |
@@ -592,9 +592,9 @@ void journal_commit_transaction(journal_t *journal) | |||
592 | 592 | ||
593 | tag_flag = 0; | 593 | tag_flag = 0; |
594 | if (flags & 1) | 594 | if (flags & 1) |
595 | tag_flag |= JFS_FLAG_ESCAPE; | 595 | tag_flag |= JBD2_FLAG_ESCAPE; |
596 | if (!first_tag) | 596 | if (!first_tag) |
597 | tag_flag |= JFS_FLAG_SAME_UUID; | 597 | tag_flag |= JBD2_FLAG_SAME_UUID; |
598 | 598 | ||
599 | tag = (journal_block_tag_t *) tagp; | 599 | tag = (journal_block_tag_t *) tagp; |
600 | tag->t_blocknr = cpu_to_be32(jh2bh(jh)->b_blocknr); | 600 | tag->t_blocknr = cpu_to_be32(jh2bh(jh)->b_blocknr); |
@@ -622,7 +622,7 @@ void journal_commit_transaction(journal_t *journal) | |||
622 | submitting the IOs. "tag" still points to | 622 | submitting the IOs. "tag" still points to |
623 | the last tag we set up. */ | 623 | the last tag we set up. */ |
624 | 624 | ||
625 | tag->t_flags |= cpu_to_be32(JFS_FLAG_LAST_TAG); | 625 | tag->t_flags |= cpu_to_be32(JBD2_FLAG_LAST_TAG); |
626 | 626 | ||
627 | start_journal_io: | 627 | start_journal_io: |
628 | for (i = 0; i < bufs; i++) { | 628 | for (i = 0; i < bufs; i++) { |
@@ -678,14 +678,14 @@ wait_for_iobuf: | |||
678 | clear_buffer_jwrite(bh); | 678 | clear_buffer_jwrite(bh); |
679 | 679 | ||
680 | JBUFFER_TRACE(jh, "ph4: unfile after journal write"); | 680 | JBUFFER_TRACE(jh, "ph4: unfile after journal write"); |
681 | journal_unfile_buffer(journal, jh); | 681 | jbd2_journal_unfile_buffer(journal, jh); |
682 | 682 | ||
683 | /* | 683 | /* |
684 | * ->t_iobuf_list should contain only dummy buffer_heads | 684 | * ->t_iobuf_list should contain only dummy buffer_heads |
685 | * which were created by journal_write_metadata_buffer(). | 685 | * which were created by jbd2_journal_write_metadata_buffer(). |
686 | */ | 686 | */ |
687 | BUFFER_TRACE(bh, "dumping temporary bh"); | 687 | BUFFER_TRACE(bh, "dumping temporary bh"); |
688 | journal_put_journal_head(jh); | 688 | jbd2_journal_put_journal_head(jh); |
689 | __brelse(bh); | 689 | __brelse(bh); |
690 | J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0); | 690 | J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0); |
691 | free_buffer_head(bh); | 691 | free_buffer_head(bh); |
@@ -702,7 +702,7 @@ wait_for_iobuf: | |||
702 | we finally commit, we can do any checkpointing | 702 | we finally commit, we can do any checkpointing |
703 | required. */ | 703 | required. */ |
704 | JBUFFER_TRACE(jh, "file as BJ_Forget"); | 704 | JBUFFER_TRACE(jh, "file as BJ_Forget"); |
705 | journal_file_buffer(jh, commit_transaction, BJ_Forget); | 705 | jbd2_journal_file_buffer(jh, commit_transaction, BJ_Forget); |
706 | /* Wake up any transactions which were waiting for this | 706 | /* Wake up any transactions which were waiting for this |
707 | IO to complete */ | 707 | IO to complete */ |
708 | wake_up_bit(&bh->b_state, BH_Unshadow); | 708 | wake_up_bit(&bh->b_state, BH_Unshadow); |
@@ -733,8 +733,8 @@ wait_for_iobuf: | |||
733 | 733 | ||
734 | BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); | 734 | BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); |
735 | clear_buffer_jwrite(bh); | 735 | clear_buffer_jwrite(bh); |
736 | journal_unfile_buffer(journal, jh); | 736 | jbd2_journal_unfile_buffer(journal, jh); |
737 | journal_put_journal_head(jh); | 737 | jbd2_journal_put_journal_head(jh); |
738 | __brelse(bh); /* One for getblk */ | 738 | __brelse(bh); /* One for getblk */ |
739 | /* AKPM: bforget here */ | 739 | /* AKPM: bforget here */ |
740 | } | 740 | } |
@@ -745,7 +745,7 @@ wait_for_iobuf: | |||
745 | err = -EIO; | 745 | err = -EIO; |
746 | 746 | ||
747 | if (err) | 747 | if (err) |
748 | __journal_abort_hard(journal); | 748 | __jbd2_journal_abort_hard(journal); |
749 | 749 | ||
750 | /* End of a transaction! Finally, we can do checkpoint | 750 | /* End of a transaction! Finally, we can do checkpoint |
751 | processing: any buffers committed as a result of this | 751 | processing: any buffers committed as a result of this |
@@ -789,14 +789,14 @@ restart_loop: | |||
789 | * Otherwise, we can just throw away the frozen data now. | 789 | * Otherwise, we can just throw away the frozen data now. |
790 | */ | 790 | */ |
791 | if (jh->b_committed_data) { | 791 | if (jh->b_committed_data) { |
792 | jbd_slab_free(jh->b_committed_data, bh->b_size); | 792 | jbd2_slab_free(jh->b_committed_data, bh->b_size); |
793 | jh->b_committed_data = NULL; | 793 | jh->b_committed_data = NULL; |
794 | if (jh->b_frozen_data) { | 794 | if (jh->b_frozen_data) { |
795 | jh->b_committed_data = jh->b_frozen_data; | 795 | jh->b_committed_data = jh->b_frozen_data; |
796 | jh->b_frozen_data = NULL; | 796 | jh->b_frozen_data = NULL; |
797 | } | 797 | } |
798 | } else if (jh->b_frozen_data) { | 798 | } else if (jh->b_frozen_data) { |
799 | jbd_slab_free(jh->b_frozen_data, bh->b_size); | 799 | jbd2_slab_free(jh->b_frozen_data, bh->b_size); |
800 | jh->b_frozen_data = NULL; | 800 | jh->b_frozen_data = NULL; |
801 | } | 801 | } |
802 | 802 | ||
@@ -804,12 +804,12 @@ restart_loop: | |||
804 | cp_transaction = jh->b_cp_transaction; | 804 | cp_transaction = jh->b_cp_transaction; |
805 | if (cp_transaction) { | 805 | if (cp_transaction) { |
806 | JBUFFER_TRACE(jh, "remove from old cp transaction"); | 806 | JBUFFER_TRACE(jh, "remove from old cp transaction"); |
807 | __journal_remove_checkpoint(jh); | 807 | __jbd2_journal_remove_checkpoint(jh); |
808 | } | 808 | } |
809 | 809 | ||
810 | /* Only re-checkpoint the buffer_head if it is marked | 810 | /* Only re-checkpoint the buffer_head if it is marked |
811 | * dirty. If the buffer was added to the BJ_Forget list | 811 | * dirty. If the buffer was added to the BJ_Forget list |
812 | * by journal_forget, it may no longer be dirty and | 812 | * by jbd2_journal_forget, it may no longer be dirty and |
813 | * there's no point in keeping a checkpoint record for | 813 | * there's no point in keeping a checkpoint record for |
814 | * it. */ | 814 | * it. */ |
815 | 815 | ||
@@ -828,9 +828,9 @@ restart_loop: | |||
828 | 828 | ||
829 | if (buffer_jbddirty(bh)) { | 829 | if (buffer_jbddirty(bh)) { |
830 | JBUFFER_TRACE(jh, "add to new checkpointing trans"); | 830 | JBUFFER_TRACE(jh, "add to new checkpointing trans"); |
831 | __journal_insert_checkpoint(jh, commit_transaction); | 831 | __jbd2_journal_insert_checkpoint(jh, commit_transaction); |
832 | JBUFFER_TRACE(jh, "refile for checkpoint writeback"); | 832 | JBUFFER_TRACE(jh, "refile for checkpoint writeback"); |
833 | __journal_refile_buffer(jh); | 833 | __jbd2_journal_refile_buffer(jh); |
834 | jbd_unlock_bh_state(bh); | 834 | jbd_unlock_bh_state(bh); |
835 | } else { | 835 | } else { |
836 | J_ASSERT_BH(bh, !buffer_dirty(bh)); | 836 | J_ASSERT_BH(bh, !buffer_dirty(bh)); |
@@ -842,11 +842,11 @@ restart_loop: | |||
842 | * disk and before we process the buffer on BJ_Forget | 842 | * disk and before we process the buffer on BJ_Forget |
843 | * list. */ | 843 | * list. */ |
844 | JBUFFER_TRACE(jh, "refile or unfile freed buffer"); | 844 | JBUFFER_TRACE(jh, "refile or unfile freed buffer"); |
845 | __journal_refile_buffer(jh); | 845 | __jbd2_journal_refile_buffer(jh); |
846 | if (!jh->b_transaction) { | 846 | if (!jh->b_transaction) { |
847 | jbd_unlock_bh_state(bh); | 847 | jbd_unlock_bh_state(bh); |
848 | /* needs a brelse */ | 848 | /* needs a brelse */ |
849 | journal_remove_journal_head(bh); | 849 | jbd2_journal_remove_journal_head(bh); |
850 | release_buffer_page(bh); | 850 | release_buffer_page(bh); |
851 | } else | 851 | } else |
852 | jbd_unlock_bh_state(bh); | 852 | jbd_unlock_bh_state(bh); |
@@ -856,9 +856,9 @@ restart_loop: | |||
856 | spin_unlock(&journal->j_list_lock); | 856 | spin_unlock(&journal->j_list_lock); |
857 | /* | 857 | /* |
858 | * This is a bit sleazy. We borrow j_list_lock to protect | 858 | * This is a bit sleazy. We borrow j_list_lock to protect |
859 | * journal->j_committing_transaction in __journal_remove_checkpoint. | 859 | * journal->j_committing_transaction in __jbd2_journal_remove_checkpoint. |
860 | * Really, __journal_remove_checkpoint should be using j_state_lock but | 860 | * Really, __jbd2_journal_remove_checkpoint should be using j_state_lock but |
861 | * it's a bit hassle to hold that across __journal_remove_checkpoint | 861 | * it's a bit hassle to hold that across __jbd2_journal_remove_checkpoint |
862 | */ | 862 | */ |
863 | spin_lock(&journal->j_state_lock); | 863 | spin_lock(&journal->j_state_lock); |
864 | spin_lock(&journal->j_list_lock); | 864 | spin_lock(&journal->j_list_lock); |
@@ -885,7 +885,7 @@ restart_loop: | |||
885 | spin_unlock(&journal->j_state_lock); | 885 | spin_unlock(&journal->j_state_lock); |
886 | 886 | ||
887 | if (commit_transaction->t_checkpoint_list == NULL) { | 887 | if (commit_transaction->t_checkpoint_list == NULL) { |
888 | __journal_drop_transaction(journal, commit_transaction); | 888 | __jbd2_journal_drop_transaction(journal, commit_transaction); |
889 | } else { | 889 | } else { |
890 | if (journal->j_checkpoint_transactions == NULL) { | 890 | if (journal->j_checkpoint_transactions == NULL) { |
891 | journal->j_checkpoint_transactions = commit_transaction; | 891 | journal->j_checkpoint_transactions = commit_transaction; |
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index c518dd8fe60a..3fbbba20a516 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/jbd/journal.c | 2 | * linux/fs/jbd2/journal.c |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 | 4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 |
5 | * | 5 | * |
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/jbd.h> | 28 | #include <linux/jbd2.h> |
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
@@ -40,51 +40,51 @@ | |||
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | #include <asm/page.h> | 41 | #include <asm/page.h> |
42 | 42 | ||
43 | EXPORT_SYMBOL(journal_start); | 43 | EXPORT_SYMBOL(jbd2_journal_start); |
44 | EXPORT_SYMBOL(journal_restart); | 44 | EXPORT_SYMBOL(jbd2_journal_restart); |
45 | EXPORT_SYMBOL(journal_extend); | 45 | EXPORT_SYMBOL(jbd2_journal_extend); |
46 | EXPORT_SYMBOL(journal_stop); | 46 | EXPORT_SYMBOL(jbd2_journal_stop); |
47 | EXPORT_SYMBOL(journal_lock_updates); | 47 | EXPORT_SYMBOL(jbd2_journal_lock_updates); |
48 | EXPORT_SYMBOL(journal_unlock_updates); | 48 | EXPORT_SYMBOL(jbd2_journal_unlock_updates); |
49 | EXPORT_SYMBOL(journal_get_write_access); | 49 | EXPORT_SYMBOL(jbd2_journal_get_write_access); |
50 | EXPORT_SYMBOL(journal_get_create_access); | 50 | EXPORT_SYMBOL(jbd2_journal_get_create_access); |
51 | EXPORT_SYMBOL(journal_get_undo_access); | 51 | EXPORT_SYMBOL(jbd2_journal_get_undo_access); |
52 | EXPORT_SYMBOL(journal_dirty_data); | 52 | EXPORT_SYMBOL(jbd2_journal_dirty_data); |
53 | EXPORT_SYMBOL(journal_dirty_metadata); | 53 | EXPORT_SYMBOL(jbd2_journal_dirty_metadata); |
54 | EXPORT_SYMBOL(journal_release_buffer); | 54 | EXPORT_SYMBOL(jbd2_journal_release_buffer); |
55 | EXPORT_SYMBOL(journal_forget); | 55 | EXPORT_SYMBOL(jbd2_journal_forget); |
56 | #if 0 | 56 | #if 0 |
57 | EXPORT_SYMBOL(journal_sync_buffer); | 57 | EXPORT_SYMBOL(journal_sync_buffer); |
58 | #endif | 58 | #endif |
59 | EXPORT_SYMBOL(journal_flush); | 59 | EXPORT_SYMBOL(jbd2_journal_flush); |
60 | EXPORT_SYMBOL(journal_revoke); | 60 | EXPORT_SYMBOL(jbd2_journal_revoke); |
61 | 61 | ||
62 | EXPORT_SYMBOL(journal_init_dev); | 62 | EXPORT_SYMBOL(jbd2_journal_init_dev); |
63 | EXPORT_SYMBOL(journal_init_inode); | 63 | EXPORT_SYMBOL(jbd2_journal_init_inode); |
64 | EXPORT_SYMBOL(journal_update_format); | 64 | EXPORT_SYMBOL(jbd2_journal_update_format); |
65 | EXPORT_SYMBOL(journal_check_used_features); | 65 | EXPORT_SYMBOL(jbd2_journal_check_used_features); |
66 | EXPORT_SYMBOL(journal_check_available_features); | 66 | EXPORT_SYMBOL(jbd2_journal_check_available_features); |
67 | EXPORT_SYMBOL(journal_set_features); | 67 | EXPORT_SYMBOL(jbd2_journal_set_features); |
68 | EXPORT_SYMBOL(journal_create); | 68 | EXPORT_SYMBOL(jbd2_journal_create); |
69 | EXPORT_SYMBOL(journal_load); | 69 | EXPORT_SYMBOL(jbd2_journal_load); |
70 | EXPORT_SYMBOL(journal_destroy); | 70 | EXPORT_SYMBOL(jbd2_journal_destroy); |
71 | EXPORT_SYMBOL(journal_update_superblock); | 71 | EXPORT_SYMBOL(jbd2_journal_update_superblock); |
72 | EXPORT_SYMBOL(journal_abort); | 72 | EXPORT_SYMBOL(jbd2_journal_abort); |
73 | EXPORT_SYMBOL(journal_errno); | 73 | EXPORT_SYMBOL(jbd2_journal_errno); |
74 | EXPORT_SYMBOL(journal_ack_err); | 74 | EXPORT_SYMBOL(jbd2_journal_ack_err); |
75 | EXPORT_SYMBOL(journal_clear_err); | 75 | EXPORT_SYMBOL(jbd2_journal_clear_err); |
76 | EXPORT_SYMBOL(log_wait_commit); | 76 | EXPORT_SYMBOL(jbd2_log_wait_commit); |
77 | EXPORT_SYMBOL(journal_start_commit); | 77 | EXPORT_SYMBOL(jbd2_journal_start_commit); |
78 | EXPORT_SYMBOL(journal_force_commit_nested); | 78 | EXPORT_SYMBOL(jbd2_journal_force_commit_nested); |
79 | EXPORT_SYMBOL(journal_wipe); | 79 | EXPORT_SYMBOL(jbd2_journal_wipe); |
80 | EXPORT_SYMBOL(journal_blocks_per_page); | 80 | EXPORT_SYMBOL(jbd2_journal_blocks_per_page); |
81 | EXPORT_SYMBOL(journal_invalidatepage); | 81 | EXPORT_SYMBOL(jbd2_journal_invalidatepage); |
82 | EXPORT_SYMBOL(journal_try_to_free_buffers); | 82 | EXPORT_SYMBOL(jbd2_journal_try_to_free_buffers); |
83 | EXPORT_SYMBOL(journal_force_commit); | 83 | EXPORT_SYMBOL(jbd2_journal_force_commit); |
84 | 84 | ||
85 | static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); | 85 | static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); |
86 | static void __journal_abort_soft (journal_t *journal, int errno); | 86 | static void __journal_abort_soft (journal_t *journal, int errno); |
87 | static int journal_create_jbd_slab(size_t slab_size); | 87 | static int jbd2_journal_create_jbd_slab(size_t slab_size); |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Helper function used to manage commit timeouts | 90 | * Helper function used to manage commit timeouts |
@@ -98,7 +98,7 @@ static void commit_timeout(unsigned long __data) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /* | 100 | /* |
101 | * kjournald: The main thread function used to manage a logging device | 101 | * kjournald2: The main thread function used to manage a logging device |
102 | * journal. | 102 | * journal. |
103 | * | 103 | * |
104 | * This kernel thread is responsible for two things: | 104 | * This kernel thread is responsible for two things: |
@@ -113,7 +113,7 @@ static void commit_timeout(unsigned long __data) | |||
113 | * known as checkpointing, and this thread is responsible for that job. | 113 | * known as checkpointing, and this thread is responsible for that job. |
114 | */ | 114 | */ |
115 | 115 | ||
116 | static int kjournald(void *arg) | 116 | static int kjournald2(void *arg) |
117 | { | 117 | { |
118 | journal_t *journal = arg; | 118 | journal_t *journal = arg; |
119 | transaction_t *transaction; | 119 | transaction_t *transaction; |
@@ -129,7 +129,7 @@ static int kjournald(void *arg) | |||
129 | journal->j_task = current; | 129 | journal->j_task = current; |
130 | wake_up(&journal->j_wait_done_commit); | 130 | wake_up(&journal->j_wait_done_commit); |
131 | 131 | ||
132 | printk(KERN_INFO "kjournald starting. Commit interval %ld seconds\n", | 132 | printk(KERN_INFO "kjournald2 starting. Commit interval %ld seconds\n", |
133 | journal->j_commit_interval / HZ); | 133 | journal->j_commit_interval / HZ); |
134 | 134 | ||
135 | /* | 135 | /* |
@@ -138,7 +138,7 @@ static int kjournald(void *arg) | |||
138 | spin_lock(&journal->j_state_lock); | 138 | spin_lock(&journal->j_state_lock); |
139 | 139 | ||
140 | loop: | 140 | loop: |
141 | if (journal->j_flags & JFS_UNMOUNT) | 141 | if (journal->j_flags & JBD2_UNMOUNT) |
142 | goto end_loop; | 142 | goto end_loop; |
143 | 143 | ||
144 | jbd_debug(1, "commit_sequence=%d, commit_request=%d\n", | 144 | jbd_debug(1, "commit_sequence=%d, commit_request=%d\n", |
@@ -148,7 +148,7 @@ loop: | |||
148 | jbd_debug(1, "OK, requests differ\n"); | 148 | jbd_debug(1, "OK, requests differ\n"); |
149 | spin_unlock(&journal->j_state_lock); | 149 | spin_unlock(&journal->j_state_lock); |
150 | del_timer_sync(&journal->j_commit_timer); | 150 | del_timer_sync(&journal->j_commit_timer); |
151 | journal_commit_transaction(journal); | 151 | jbd2_journal_commit_transaction(journal); |
152 | spin_lock(&journal->j_state_lock); | 152 | spin_lock(&journal->j_state_lock); |
153 | goto loop; | 153 | goto loop; |
154 | } | 154 | } |
@@ -160,7 +160,7 @@ loop: | |||
160 | * good idea, because that depends on threads that may | 160 | * good idea, because that depends on threads that may |
161 | * be already stopped. | 161 | * be already stopped. |
162 | */ | 162 | */ |
163 | jbd_debug(1, "Now suspending kjournald\n"); | 163 | jbd_debug(1, "Now suspending kjournald2\n"); |
164 | spin_unlock(&journal->j_state_lock); | 164 | spin_unlock(&journal->j_state_lock); |
165 | refrigerator(); | 165 | refrigerator(); |
166 | spin_lock(&journal->j_state_lock); | 166 | spin_lock(&journal->j_state_lock); |
@@ -180,7 +180,7 @@ loop: | |||
180 | if (transaction && time_after_eq(jiffies, | 180 | if (transaction && time_after_eq(jiffies, |
181 | transaction->t_expires)) | 181 | transaction->t_expires)) |
182 | should_sleep = 0; | 182 | should_sleep = 0; |
183 | if (journal->j_flags & JFS_UNMOUNT) | 183 | if (journal->j_flags & JBD2_UNMOUNT) |
184 | should_sleep = 0; | 184 | should_sleep = 0; |
185 | if (should_sleep) { | 185 | if (should_sleep) { |
186 | spin_unlock(&journal->j_state_lock); | 186 | spin_unlock(&journal->j_state_lock); |
@@ -190,7 +190,7 @@ loop: | |||
190 | finish_wait(&journal->j_wait_commit, &wait); | 190 | finish_wait(&journal->j_wait_commit, &wait); |
191 | } | 191 | } |
192 | 192 | ||
193 | jbd_debug(1, "kjournald wakes\n"); | 193 | jbd_debug(1, "kjournald2 wakes\n"); |
194 | 194 | ||
195 | /* | 195 | /* |
196 | * Were we woken up by a commit wakeup event? | 196 | * Were we woken up by a commit wakeup event? |
@@ -211,16 +211,16 @@ end_loop: | |||
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | 213 | ||
214 | static void journal_start_thread(journal_t *journal) | 214 | static void jbd2_journal_start_thread(journal_t *journal) |
215 | { | 215 | { |
216 | kthread_run(kjournald, journal, "kjournald"); | 216 | kthread_run(kjournald2, journal, "kjournald2"); |
217 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); | 217 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); |
218 | } | 218 | } |
219 | 219 | ||
220 | static void journal_kill_thread(journal_t *journal) | 220 | static void journal_kill_thread(journal_t *journal) |
221 | { | 221 | { |
222 | spin_lock(&journal->j_state_lock); | 222 | spin_lock(&journal->j_state_lock); |
223 | journal->j_flags |= JFS_UNMOUNT; | 223 | journal->j_flags |= JBD2_UNMOUNT; |
224 | 224 | ||
225 | while (journal->j_task) { | 225 | while (journal->j_task) { |
226 | wake_up(&journal->j_wait_commit); | 226 | wake_up(&journal->j_wait_commit); |
@@ -232,7 +232,7 @@ static void journal_kill_thread(journal_t *journal) | |||
232 | } | 232 | } |
233 | 233 | ||
234 | /* | 234 | /* |
235 | * journal_write_metadata_buffer: write a metadata buffer to the journal. | 235 | * jbd2_journal_write_metadata_buffer: write a metadata buffer to the journal. |
236 | * | 236 | * |
237 | * Writes a metadata buffer to a given disk block. The actual IO is not | 237 | * Writes a metadata buffer to a given disk block. The actual IO is not |
238 | * performed but a new buffer_head is constructed which labels the data | 238 | * performed but a new buffer_head is constructed which labels the data |
@@ -240,7 +240,7 @@ static void journal_kill_thread(journal_t *journal) | |||
240 | * | 240 | * |
241 | * Any magic-number escaping which needs to be done will cause a | 241 | * Any magic-number escaping which needs to be done will cause a |
242 | * copy-out here. If the buffer happens to start with the | 242 | * copy-out here. If the buffer happens to start with the |
243 | * JFS_MAGIC_NUMBER, then we can't write it to the log directly: the | 243 | * JBD2_MAGIC_NUMBER, then we can't write it to the log directly: the |
244 | * magic number is only written to the log for descripter blocks. In | 244 | * magic number is only written to the log for descripter blocks. In |
245 | * this case, we copy the data and replace the first word with 0, and we | 245 | * this case, we copy the data and replace the first word with 0, and we |
246 | * return a result code which indicates that this buffer needs to be | 246 | * return a result code which indicates that this buffer needs to be |
@@ -268,7 +268,7 @@ static void journal_kill_thread(journal_t *journal) | |||
268 | * Bit 1 set == buffer copy-out performed (kfree the data after IO) | 268 | * Bit 1 set == buffer copy-out performed (kfree the data after IO) |
269 | */ | 269 | */ |
270 | 270 | ||
271 | int journal_write_metadata_buffer(transaction_t *transaction, | 271 | int jbd2_journal_write_metadata_buffer(transaction_t *transaction, |
272 | struct journal_head *jh_in, | 272 | struct journal_head *jh_in, |
273 | struct journal_head **jh_out, | 273 | struct journal_head **jh_out, |
274 | unsigned long blocknr) | 274 | unsigned long blocknr) |
@@ -316,7 +316,7 @@ repeat: | |||
316 | * Check for escaping | 316 | * Check for escaping |
317 | */ | 317 | */ |
318 | if (*((__be32 *)(mapped_data + new_offset)) == | 318 | if (*((__be32 *)(mapped_data + new_offset)) == |
319 | cpu_to_be32(JFS_MAGIC_NUMBER)) { | 319 | cpu_to_be32(JBD2_MAGIC_NUMBER)) { |
320 | need_copy_out = 1; | 320 | need_copy_out = 1; |
321 | do_escape = 1; | 321 | do_escape = 1; |
322 | } | 322 | } |
@@ -329,10 +329,10 @@ repeat: | |||
329 | char *tmp; | 329 | char *tmp; |
330 | 330 | ||
331 | jbd_unlock_bh_state(bh_in); | 331 | jbd_unlock_bh_state(bh_in); |
332 | tmp = jbd_slab_alloc(bh_in->b_size, GFP_NOFS); | 332 | tmp = jbd2_slab_alloc(bh_in->b_size, GFP_NOFS); |
333 | jbd_lock_bh_state(bh_in); | 333 | jbd_lock_bh_state(bh_in); |
334 | if (jh_in->b_frozen_data) { | 334 | if (jh_in->b_frozen_data) { |
335 | jbd_slab_free(tmp, bh_in->b_size); | 335 | jbd2_slab_free(tmp, bh_in->b_size); |
336 | goto repeat; | 336 | goto repeat; |
337 | } | 337 | } |
338 | 338 | ||
@@ -362,7 +362,7 @@ repeat: | |||
362 | atomic_set(&new_bh->b_count, 1); | 362 | atomic_set(&new_bh->b_count, 1); |
363 | jbd_unlock_bh_state(bh_in); | 363 | jbd_unlock_bh_state(bh_in); |
364 | 364 | ||
365 | new_jh = journal_add_journal_head(new_bh); /* This sleeps */ | 365 | new_jh = jbd2_journal_add_journal_head(new_bh); /* This sleeps */ |
366 | 366 | ||
367 | set_bh_page(new_bh, new_page, new_offset); | 367 | set_bh_page(new_bh, new_page, new_offset); |
368 | new_jh->b_transaction = NULL; | 368 | new_jh->b_transaction = NULL; |
@@ -380,9 +380,9 @@ repeat: | |||
380 | * copying is moved to the transaction's shadow queue. | 380 | * copying is moved to the transaction's shadow queue. |
381 | */ | 381 | */ |
382 | JBUFFER_TRACE(jh_in, "file as BJ_Shadow"); | 382 | JBUFFER_TRACE(jh_in, "file as BJ_Shadow"); |
383 | journal_file_buffer(jh_in, transaction, BJ_Shadow); | 383 | jbd2_journal_file_buffer(jh_in, transaction, BJ_Shadow); |
384 | JBUFFER_TRACE(new_jh, "file as BJ_IO"); | 384 | JBUFFER_TRACE(new_jh, "file as BJ_IO"); |
385 | journal_file_buffer(new_jh, transaction, BJ_IO); | 385 | jbd2_journal_file_buffer(new_jh, transaction, BJ_IO); |
386 | 386 | ||
387 | return do_escape | (done_copy_out << 1); | 387 | return do_escape | (done_copy_out << 1); |
388 | } | 388 | } |
@@ -393,14 +393,14 @@ repeat: | |||
393 | */ | 393 | */ |
394 | 394 | ||
395 | /* | 395 | /* |
396 | * __log_space_left: Return the number of free blocks left in the journal. | 396 | * __jbd2_log_space_left: Return the number of free blocks left in the journal. |
397 | * | 397 | * |
398 | * Called with the journal already locked. | 398 | * Called with the journal already locked. |
399 | * | 399 | * |
400 | * Called under j_state_lock | 400 | * Called under j_state_lock |
401 | */ | 401 | */ |
402 | 402 | ||
403 | int __log_space_left(journal_t *journal) | 403 | int __jbd2_log_space_left(journal_t *journal) |
404 | { | 404 | { |
405 | int left = journal->j_free; | 405 | int left = journal->j_free; |
406 | 406 | ||
@@ -424,7 +424,7 @@ int __log_space_left(journal_t *journal) | |||
424 | /* | 424 | /* |
425 | * Called under j_state_lock. Returns true if a transaction was started. | 425 | * Called under j_state_lock. Returns true if a transaction was started. |
426 | */ | 426 | */ |
427 | int __log_start_commit(journal_t *journal, tid_t target) | 427 | int __jbd2_log_start_commit(journal_t *journal, tid_t target) |
428 | { | 428 | { |
429 | /* | 429 | /* |
430 | * Are we already doing a recent enough commit? | 430 | * Are we already doing a recent enough commit? |
@@ -445,12 +445,12 @@ int __log_start_commit(journal_t *journal, tid_t target) | |||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | int log_start_commit(journal_t *journal, tid_t tid) | 448 | int jbd2_log_start_commit(journal_t *journal, tid_t tid) |
449 | { | 449 | { |
450 | int ret; | 450 | int ret; |
451 | 451 | ||
452 | spin_lock(&journal->j_state_lock); | 452 | spin_lock(&journal->j_state_lock); |
453 | ret = __log_start_commit(journal, tid); | 453 | ret = __jbd2_log_start_commit(journal, tid); |
454 | spin_unlock(&journal->j_state_lock); | 454 | spin_unlock(&journal->j_state_lock); |
455 | return ret; | 455 | return ret; |
456 | } | 456 | } |
@@ -465,7 +465,7 @@ int log_start_commit(journal_t *journal, tid_t tid) | |||
465 | * | 465 | * |
466 | * Returns true if a transaction was started. | 466 | * Returns true if a transaction was started. |
467 | */ | 467 | */ |
468 | int journal_force_commit_nested(journal_t *journal) | 468 | int jbd2_journal_force_commit_nested(journal_t *journal) |
469 | { | 469 | { |
470 | transaction_t *transaction = NULL; | 470 | transaction_t *transaction = NULL; |
471 | tid_t tid; | 471 | tid_t tid; |
@@ -473,7 +473,7 @@ int journal_force_commit_nested(journal_t *journal) | |||
473 | spin_lock(&journal->j_state_lock); | 473 | spin_lock(&journal->j_state_lock); |
474 | if (journal->j_running_transaction && !current->journal_info) { | 474 | if (journal->j_running_transaction && !current->journal_info) { |
475 | transaction = journal->j_running_transaction; | 475 | transaction = journal->j_running_transaction; |
476 | __log_start_commit(journal, transaction->t_tid); | 476 | __jbd2_log_start_commit(journal, transaction->t_tid); |
477 | } else if (journal->j_committing_transaction) | 477 | } else if (journal->j_committing_transaction) |
478 | transaction = journal->j_committing_transaction; | 478 | transaction = journal->j_committing_transaction; |
479 | 479 | ||
@@ -484,7 +484,7 @@ int journal_force_commit_nested(journal_t *journal) | |||
484 | 484 | ||
485 | tid = transaction->t_tid; | 485 | tid = transaction->t_tid; |
486 | spin_unlock(&journal->j_state_lock); | 486 | spin_unlock(&journal->j_state_lock); |
487 | log_wait_commit(journal, tid); | 487 | jbd2_log_wait_commit(journal, tid); |
488 | return 1; | 488 | return 1; |
489 | } | 489 | } |
490 | 490 | ||
@@ -492,7 +492,7 @@ int journal_force_commit_nested(journal_t *journal) | |||
492 | * Start a commit of the current running transaction (if any). Returns true | 492 | * Start a commit of the current running transaction (if any). Returns true |
493 | * if a transaction was started, and fills its tid in at *ptid | 493 | * if a transaction was started, and fills its tid in at *ptid |
494 | */ | 494 | */ |
495 | int journal_start_commit(journal_t *journal, tid_t *ptid) | 495 | int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid) |
496 | { | 496 | { |
497 | int ret = 0; | 497 | int ret = 0; |
498 | 498 | ||
@@ -500,7 +500,7 @@ int journal_start_commit(journal_t *journal, tid_t *ptid) | |||
500 | if (journal->j_running_transaction) { | 500 | if (journal->j_running_transaction) { |
501 | tid_t tid = journal->j_running_transaction->t_tid; | 501 | tid_t tid = journal->j_running_transaction->t_tid; |
502 | 502 | ||
503 | ret = __log_start_commit(journal, tid); | 503 | ret = __jbd2_log_start_commit(journal, tid); |
504 | if (ret && ptid) | 504 | if (ret && ptid) |
505 | *ptid = tid; | 505 | *ptid = tid; |
506 | } else if (journal->j_committing_transaction && ptid) { | 506 | } else if (journal->j_committing_transaction && ptid) { |
@@ -519,7 +519,7 @@ int journal_start_commit(journal_t *journal, tid_t *ptid) | |||
519 | * Wait for a specified commit to complete. | 519 | * Wait for a specified commit to complete. |
520 | * The caller may not hold the journal lock. | 520 | * The caller may not hold the journal lock. |
521 | */ | 521 | */ |
522 | int log_wait_commit(journal_t *journal, tid_t tid) | 522 | int jbd2_log_wait_commit(journal_t *journal, tid_t tid) |
523 | { | 523 | { |
524 | int err = 0; | 524 | int err = 0; |
525 | 525 | ||
@@ -555,7 +555,7 @@ int log_wait_commit(journal_t *journal, tid_t tid) | |||
555 | * Log buffer allocation routines: | 555 | * Log buffer allocation routines: |
556 | */ | 556 | */ |
557 | 557 | ||
558 | int journal_next_log_block(journal_t *journal, unsigned long *retp) | 558 | int jbd2_journal_next_log_block(journal_t *journal, unsigned long *retp) |
559 | { | 559 | { |
560 | unsigned long blocknr; | 560 | unsigned long blocknr; |
561 | 561 | ||
@@ -568,7 +568,7 @@ int journal_next_log_block(journal_t *journal, unsigned long *retp) | |||
568 | if (journal->j_head == journal->j_last) | 568 | if (journal->j_head == journal->j_last) |
569 | journal->j_head = journal->j_first; | 569 | journal->j_head = journal->j_first; |
570 | spin_unlock(&journal->j_state_lock); | 570 | spin_unlock(&journal->j_state_lock); |
571 | return journal_bmap(journal, blocknr, retp); | 571 | return jbd2_journal_bmap(journal, blocknr, retp); |
572 | } | 572 | } |
573 | 573 | ||
574 | /* | 574 | /* |
@@ -578,7 +578,7 @@ int journal_next_log_block(journal_t *journal, unsigned long *retp) | |||
578 | * this is a no-op. If needed, we can use j_blk_offset - everything is | 578 | * this is a no-op. If needed, we can use j_blk_offset - everything is |
579 | * ready. | 579 | * ready. |
580 | */ | 580 | */ |
581 | int journal_bmap(journal_t *journal, unsigned long blocknr, | 581 | int jbd2_journal_bmap(journal_t *journal, unsigned long blocknr, |
582 | unsigned long *retp) | 582 | unsigned long *retp) |
583 | { | 583 | { |
584 | int err = 0; | 584 | int err = 0; |
@@ -610,18 +610,18 @@ int journal_bmap(journal_t *journal, unsigned long blocknr, | |||
610 | * the journal without copying their contents, but for journal | 610 | * the journal without copying their contents, but for journal |
611 | * descriptor blocks we do need to generate bona fide buffers. | 611 | * descriptor blocks we do need to generate bona fide buffers. |
612 | * | 612 | * |
613 | * After the caller of journal_get_descriptor_buffer() has finished modifying | 613 | * After the caller of jbd2_journal_get_descriptor_buffer() has finished modifying |
614 | * the buffer's contents they really should run flush_dcache_page(bh->b_page). | 614 | * the buffer's contents they really should run flush_dcache_page(bh->b_page). |
615 | * But we don't bother doing that, so there will be coherency problems with | 615 | * But we don't bother doing that, so there will be coherency problems with |
616 | * mmaps of blockdevs which hold live JBD-controlled filesystems. | 616 | * mmaps of blockdevs which hold live JBD-controlled filesystems. |
617 | */ | 617 | */ |
618 | struct journal_head *journal_get_descriptor_buffer(journal_t *journal) | 618 | struct journal_head *jbd2_journal_get_descriptor_buffer(journal_t *journal) |
619 | { | 619 | { |
620 | struct buffer_head *bh; | 620 | struct buffer_head *bh; |
621 | unsigned long blocknr; | 621 | unsigned long blocknr; |
622 | int err; | 622 | int err; |
623 | 623 | ||
624 | err = journal_next_log_block(journal, &blocknr); | 624 | err = jbd2_journal_next_log_block(journal, &blocknr); |
625 | 625 | ||
626 | if (err) | 626 | if (err) |
627 | return NULL; | 627 | return NULL; |
@@ -632,7 +632,7 @@ struct journal_head *journal_get_descriptor_buffer(journal_t *journal) | |||
632 | set_buffer_uptodate(bh); | 632 | set_buffer_uptodate(bh); |
633 | unlock_buffer(bh); | 633 | unlock_buffer(bh); |
634 | BUFFER_TRACE(bh, "return this buffer"); | 634 | BUFFER_TRACE(bh, "return this buffer"); |
635 | return journal_add_journal_head(bh); | 635 | return jbd2_journal_add_journal_head(bh); |
636 | } | 636 | } |
637 | 637 | ||
638 | /* | 638 | /* |
@@ -669,10 +669,10 @@ static journal_t * journal_init_common (void) | |||
669 | journal->j_commit_interval = (HZ * JBD_DEFAULT_MAX_COMMIT_AGE); | 669 | journal->j_commit_interval = (HZ * JBD_DEFAULT_MAX_COMMIT_AGE); |
670 | 670 | ||
671 | /* The journal is marked for error until we succeed with recovery! */ | 671 | /* The journal is marked for error until we succeed with recovery! */ |
672 | journal->j_flags = JFS_ABORT; | 672 | journal->j_flags = JBD2_ABORT; |
673 | 673 | ||
674 | /* Set up a default-sized revoke table for the new mount. */ | 674 | /* Set up a default-sized revoke table for the new mount. */ |
675 | err = journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); | 675 | err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); |
676 | if (err) { | 676 | if (err) { |
677 | kfree(journal); | 677 | kfree(journal); |
678 | goto fail; | 678 | goto fail; |
@@ -682,7 +682,7 @@ fail: | |||
682 | return NULL; | 682 | return NULL; |
683 | } | 683 | } |
684 | 684 | ||
685 | /* journal_init_dev and journal_init_inode: | 685 | /* jbd2_journal_init_dev and jbd2_journal_init_inode: |
686 | * | 686 | * |
687 | * Create a journal structure assigned some fixed set of disk blocks to | 687 | * Create a journal structure assigned some fixed set of disk blocks to |
688 | * the journal. We don't actually touch those disk blocks yet, but we | 688 | * the journal. We don't actually touch those disk blocks yet, but we |
@@ -692,7 +692,7 @@ fail: | |||
692 | */ | 692 | */ |
693 | 693 | ||
694 | /** | 694 | /** |
695 | * journal_t * journal_init_dev() - creates an initialises a journal structure | 695 | * journal_t * jbd2_journal_init_dev() - creates an initialises a journal structure |
696 | * @bdev: Block device on which to create the journal | 696 | * @bdev: Block device on which to create the journal |
697 | * @fs_dev: Device which hold journalled filesystem for this journal. | 697 | * @fs_dev: Device which hold journalled filesystem for this journal. |
698 | * @start: Block nr Start of journal. | 698 | * @start: Block nr Start of journal. |
@@ -700,11 +700,11 @@ fail: | |||
700 | * @blocksize: blocksize of journalling device | 700 | * @blocksize: blocksize of journalling device |
701 | * @returns: a newly created journal_t * | 701 | * @returns: a newly created journal_t * |
702 | * | 702 | * |
703 | * journal_init_dev creates a journal which maps a fixed contiguous | 703 | * jbd2_journal_init_dev creates a journal which maps a fixed contiguous |
704 | * range of blocks on an arbitrary block device. | 704 | * range of blocks on an arbitrary block device. |
705 | * | 705 | * |
706 | */ | 706 | */ |
707 | journal_t * journal_init_dev(struct block_device *bdev, | 707 | journal_t * jbd2_journal_init_dev(struct block_device *bdev, |
708 | struct block_device *fs_dev, | 708 | struct block_device *fs_dev, |
709 | int start, int len, int blocksize) | 709 | int start, int len, int blocksize) |
710 | { | 710 | { |
@@ -740,14 +740,14 @@ journal_t * journal_init_dev(struct block_device *bdev, | |||
740 | } | 740 | } |
741 | 741 | ||
742 | /** | 742 | /** |
743 | * journal_t * journal_init_inode () - creates a journal which maps to a inode. | 743 | * journal_t * jbd2_journal_init_inode () - creates a journal which maps to a inode. |
744 | * @inode: An inode to create the journal in | 744 | * @inode: An inode to create the journal in |
745 | * | 745 | * |
746 | * journal_init_inode creates a journal which maps an on-disk inode as | 746 | * jbd2_journal_init_inode creates a journal which maps an on-disk inode as |
747 | * the journal. The inode must exist already, must support bmap() and | 747 | * the journal. The inode must exist already, must support bmap() and |
748 | * must have all data blocks preallocated. | 748 | * must have all data blocks preallocated. |
749 | */ | 749 | */ |
750 | journal_t * journal_init_inode (struct inode *inode) | 750 | journal_t * jbd2_journal_init_inode (struct inode *inode) |
751 | { | 751 | { |
752 | struct buffer_head *bh; | 752 | struct buffer_head *bh; |
753 | journal_t *journal = journal_init_common(); | 753 | journal_t *journal = journal_init_common(); |
@@ -780,7 +780,7 @@ journal_t * journal_init_inode (struct inode *inode) | |||
780 | return NULL; | 780 | return NULL; |
781 | } | 781 | } |
782 | 782 | ||
783 | err = journal_bmap(journal, 0, &blocknr); | 783 | err = jbd2_journal_bmap(journal, 0, &blocknr); |
784 | /* If that failed, give up */ | 784 | /* If that failed, give up */ |
785 | if (err) { | 785 | if (err) { |
786 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", | 786 | printk(KERN_ERR "%s: Cannnot locate journal superblock\n", |
@@ -838,27 +838,27 @@ static int journal_reset(journal_t *journal) | |||
838 | journal->j_max_transaction_buffers = journal->j_maxlen / 4; | 838 | journal->j_max_transaction_buffers = journal->j_maxlen / 4; |
839 | 839 | ||
840 | /* Add the dynamic fields and write it to disk. */ | 840 | /* Add the dynamic fields and write it to disk. */ |
841 | journal_update_superblock(journal, 1); | 841 | jbd2_journal_update_superblock(journal, 1); |
842 | journal_start_thread(journal); | 842 | jbd2_journal_start_thread(journal); |
843 | return 0; | 843 | return 0; |
844 | } | 844 | } |
845 | 845 | ||
846 | /** | 846 | /** |
847 | * int journal_create() - Initialise the new journal file | 847 | * int jbd2_journal_create() - Initialise the new journal file |
848 | * @journal: Journal to create. This structure must have been initialised | 848 | * @journal: Journal to create. This structure must have been initialised |
849 | * | 849 | * |
850 | * Given a journal_t structure which tells us which disk blocks we can | 850 | * Given a journal_t structure which tells us which disk blocks we can |
851 | * use, create a new journal superblock and initialise all of the | 851 | * use, create a new journal superblock and initialise all of the |
852 | * journal fields from scratch. | 852 | * journal fields from scratch. |
853 | **/ | 853 | **/ |
854 | int journal_create(journal_t *journal) | 854 | int jbd2_journal_create(journal_t *journal) |
855 | { | 855 | { |
856 | unsigned long blocknr; | 856 | unsigned long blocknr; |
857 | struct buffer_head *bh; | 857 | struct buffer_head *bh; |
858 | journal_superblock_t *sb; | 858 | journal_superblock_t *sb; |
859 | int i, err; | 859 | int i, err; |
860 | 860 | ||
861 | if (journal->j_maxlen < JFS_MIN_JOURNAL_BLOCKS) { | 861 | if (journal->j_maxlen < JBD2_MIN_JOURNAL_BLOCKS) { |
862 | printk (KERN_ERR "Journal length (%d blocks) too short.\n", | 862 | printk (KERN_ERR "Journal length (%d blocks) too short.\n", |
863 | journal->j_maxlen); | 863 | journal->j_maxlen); |
864 | journal_fail_superblock(journal); | 864 | journal_fail_superblock(journal); |
@@ -876,10 +876,10 @@ int journal_create(journal_t *journal) | |||
876 | } | 876 | } |
877 | 877 | ||
878 | /* Zero out the entire journal on disk. We cannot afford to | 878 | /* Zero out the entire journal on disk. We cannot afford to |
879 | have any blocks on disk beginning with JFS_MAGIC_NUMBER. */ | 879 | have any blocks on disk beginning with JBD2_MAGIC_NUMBER. */ |
880 | jbd_debug(1, "JBD: Zeroing out journal blocks...\n"); | 880 | jbd_debug(1, "JBD: Zeroing out journal blocks...\n"); |
881 | for (i = 0; i < journal->j_maxlen; i++) { | 881 | for (i = 0; i < journal->j_maxlen; i++) { |
882 | err = journal_bmap(journal, i, &blocknr); | 882 | err = jbd2_journal_bmap(journal, i, &blocknr); |
883 | if (err) | 883 | if (err) |
884 | return err; | 884 | return err; |
885 | bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); | 885 | bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); |
@@ -899,8 +899,8 @@ int journal_create(journal_t *journal) | |||
899 | /* OK, fill in the initial static fields in the new superblock */ | 899 | /* OK, fill in the initial static fields in the new superblock */ |
900 | sb = journal->j_superblock; | 900 | sb = journal->j_superblock; |
901 | 901 | ||
902 | sb->s_header.h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); | 902 | sb->s_header.h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
903 | sb->s_header.h_blocktype = cpu_to_be32(JFS_SUPERBLOCK_V2); | 903 | sb->s_header.h_blocktype = cpu_to_be32(JBD2_SUPERBLOCK_V2); |
904 | 904 | ||
905 | sb->s_blocksize = cpu_to_be32(journal->j_blocksize); | 905 | sb->s_blocksize = cpu_to_be32(journal->j_blocksize); |
906 | sb->s_maxlen = cpu_to_be32(journal->j_maxlen); | 906 | sb->s_maxlen = cpu_to_be32(journal->j_maxlen); |
@@ -908,21 +908,21 @@ int journal_create(journal_t *journal) | |||
908 | 908 | ||
909 | journal->j_transaction_sequence = 1; | 909 | journal->j_transaction_sequence = 1; |
910 | 910 | ||
911 | journal->j_flags &= ~JFS_ABORT; | 911 | journal->j_flags &= ~JBD2_ABORT; |
912 | journal->j_format_version = 2; | 912 | journal->j_format_version = 2; |
913 | 913 | ||
914 | return journal_reset(journal); | 914 | return journal_reset(journal); |
915 | } | 915 | } |
916 | 916 | ||
917 | /** | 917 | /** |
918 | * void journal_update_superblock() - Update journal sb on disk. | 918 | * void jbd2_journal_update_superblock() - Update journal sb on disk. |
919 | * @journal: The journal to update. | 919 | * @journal: The journal to update. |
920 | * @wait: Set to '0' if you don't want to wait for IO completion. | 920 | * @wait: Set to '0' if you don't want to wait for IO completion. |
921 | * | 921 | * |
922 | * Update a journal's dynamic superblock fields and write it to disk, | 922 | * Update a journal's dynamic superblock fields and write it to disk, |
923 | * optionally waiting for the IO to complete. | 923 | * optionally waiting for the IO to complete. |
924 | */ | 924 | */ |
925 | void journal_update_superblock(journal_t *journal, int wait) | 925 | void jbd2_journal_update_superblock(journal_t *journal, int wait) |
926 | { | 926 | { |
927 | journal_superblock_t *sb = journal->j_superblock; | 927 | journal_superblock_t *sb = journal->j_superblock; |
928 | struct buffer_head *bh = journal->j_sb_buffer; | 928 | struct buffer_head *bh = journal->j_sb_buffer; |
@@ -931,7 +931,7 @@ void journal_update_superblock(journal_t *journal, int wait) | |||
931 | * As a special case, if the on-disk copy is already marked as needing | 931 | * As a special case, if the on-disk copy is already marked as needing |
932 | * no recovery (s_start == 0) and there are no outstanding transactions | 932 | * no recovery (s_start == 0) and there are no outstanding transactions |
933 | * in the filesystem, then we can safely defer the superblock update | 933 | * in the filesystem, then we can safely defer the superblock update |
934 | * until the next commit by setting JFS_FLUSHED. This avoids | 934 | * until the next commit by setting JBD2_FLUSHED. This avoids |
935 | * attempting a write to a potential-readonly device. | 935 | * attempting a write to a potential-readonly device. |
936 | */ | 936 | */ |
937 | if (sb->s_start == 0 && journal->j_tail_sequence == | 937 | if (sb->s_start == 0 && journal->j_tail_sequence == |
@@ -966,9 +966,9 @@ out: | |||
966 | 966 | ||
967 | spin_lock(&journal->j_state_lock); | 967 | spin_lock(&journal->j_state_lock); |
968 | if (sb->s_start) | 968 | if (sb->s_start) |
969 | journal->j_flags &= ~JFS_FLUSHED; | 969 | journal->j_flags &= ~JBD2_FLUSHED; |
970 | else | 970 | else |
971 | journal->j_flags |= JFS_FLUSHED; | 971 | journal->j_flags |= JBD2_FLUSHED; |
972 | spin_unlock(&journal->j_state_lock); | 972 | spin_unlock(&journal->j_state_lock); |
973 | } | 973 | } |
974 | 974 | ||
@@ -1000,17 +1000,17 @@ static int journal_get_superblock(journal_t *journal) | |||
1000 | 1000 | ||
1001 | err = -EINVAL; | 1001 | err = -EINVAL; |
1002 | 1002 | ||
1003 | if (sb->s_header.h_magic != cpu_to_be32(JFS_MAGIC_NUMBER) || | 1003 | if (sb->s_header.h_magic != cpu_to_be32(JBD2_MAGIC_NUMBER) || |
1004 | sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) { | 1004 | sb->s_blocksize != cpu_to_be32(journal->j_blocksize)) { |
1005 | printk(KERN_WARNING "JBD: no valid journal superblock found\n"); | 1005 | printk(KERN_WARNING "JBD: no valid journal superblock found\n"); |
1006 | goto out; | 1006 | goto out; |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | switch(be32_to_cpu(sb->s_header.h_blocktype)) { | 1009 | switch(be32_to_cpu(sb->s_header.h_blocktype)) { |
1010 | case JFS_SUPERBLOCK_V1: | 1010 | case JBD2_SUPERBLOCK_V1: |
1011 | journal->j_format_version = 1; | 1011 | journal->j_format_version = 1; |
1012 | break; | 1012 | break; |
1013 | case JFS_SUPERBLOCK_V2: | 1013 | case JBD2_SUPERBLOCK_V2: |
1014 | journal->j_format_version = 2; | 1014 | journal->j_format_version = 2; |
1015 | break; | 1015 | break; |
1016 | default: | 1016 | default: |
@@ -1059,14 +1059,14 @@ static int load_superblock(journal_t *journal) | |||
1059 | 1059 | ||
1060 | 1060 | ||
1061 | /** | 1061 | /** |
1062 | * int journal_load() - Read journal from disk. | 1062 | * int jbd2_journal_load() - Read journal from disk. |
1063 | * @journal: Journal to act on. | 1063 | * @journal: Journal to act on. |
1064 | * | 1064 | * |
1065 | * Given a journal_t structure which tells us which disk blocks contain | 1065 | * Given a journal_t structure which tells us which disk blocks contain |
1066 | * a journal, read the journal from disk to initialise the in-memory | 1066 | * a journal, read the journal from disk to initialise the in-memory |
1067 | * structures. | 1067 | * structures. |
1068 | */ | 1068 | */ |
1069 | int journal_load(journal_t *journal) | 1069 | int jbd2_journal_load(journal_t *journal) |
1070 | { | 1070 | { |
1071 | int err; | 1071 | int err; |
1072 | journal_superblock_t *sb; | 1072 | journal_superblock_t *sb; |
@@ -1081,9 +1081,9 @@ int journal_load(journal_t *journal) | |||
1081 | 1081 | ||
1082 | if (journal->j_format_version >= 2) { | 1082 | if (journal->j_format_version >= 2) { |
1083 | if ((sb->s_feature_ro_compat & | 1083 | if ((sb->s_feature_ro_compat & |
1084 | ~cpu_to_be32(JFS_KNOWN_ROCOMPAT_FEATURES)) || | 1084 | ~cpu_to_be32(JBD2_KNOWN_ROCOMPAT_FEATURES)) || |
1085 | (sb->s_feature_incompat & | 1085 | (sb->s_feature_incompat & |
1086 | ~cpu_to_be32(JFS_KNOWN_INCOMPAT_FEATURES))) { | 1086 | ~cpu_to_be32(JBD2_KNOWN_INCOMPAT_FEATURES))) { |
1087 | printk (KERN_WARNING | 1087 | printk (KERN_WARNING |
1088 | "JBD: Unrecognised features on journal\n"); | 1088 | "JBD: Unrecognised features on journal\n"); |
1089 | return -EINVAL; | 1089 | return -EINVAL; |
@@ -1093,13 +1093,13 @@ int journal_load(journal_t *journal) | |||
1093 | /* | 1093 | /* |
1094 | * Create a slab for this blocksize | 1094 | * Create a slab for this blocksize |
1095 | */ | 1095 | */ |
1096 | err = journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize)); | 1096 | err = jbd2_journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize)); |
1097 | if (err) | 1097 | if (err) |
1098 | return err; | 1098 | return err; |
1099 | 1099 | ||
1100 | /* Let the recovery code check whether it needs to recover any | 1100 | /* Let the recovery code check whether it needs to recover any |
1101 | * data from the journal. */ | 1101 | * data from the journal. */ |
1102 | if (journal_recover(journal)) | 1102 | if (jbd2_journal_recover(journal)) |
1103 | goto recovery_error; | 1103 | goto recovery_error; |
1104 | 1104 | ||
1105 | /* OK, we've finished with the dynamic journal bits: | 1105 | /* OK, we've finished with the dynamic journal bits: |
@@ -1108,8 +1108,8 @@ int journal_load(journal_t *journal) | |||
1108 | if (journal_reset(journal)) | 1108 | if (journal_reset(journal)) |
1109 | goto recovery_error; | 1109 | goto recovery_error; |
1110 | 1110 | ||
1111 | journal->j_flags &= ~JFS_ABORT; | 1111 | journal->j_flags &= ~JBD2_ABORT; |
1112 | journal->j_flags |= JFS_LOADED; | 1112 | journal->j_flags |= JBD2_LOADED; |
1113 | return 0; | 1113 | return 0; |
1114 | 1114 | ||
1115 | recovery_error: | 1115 | recovery_error: |
@@ -1118,20 +1118,20 @@ recovery_error: | |||
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | /** | 1120 | /** |
1121 | * void journal_destroy() - Release a journal_t structure. | 1121 | * void jbd2_journal_destroy() - Release a journal_t structure. |
1122 | * @journal: Journal to act on. | 1122 | * @journal: Journal to act on. |
1123 | * | 1123 | * |
1124 | * Release a journal_t structure once it is no longer in use by the | 1124 | * Release a journal_t structure once it is no longer in use by the |
1125 | * journaled object. | 1125 | * journaled object. |
1126 | */ | 1126 | */ |
1127 | void journal_destroy(journal_t *journal) | 1127 | void jbd2_journal_destroy(journal_t *journal) |
1128 | { | 1128 | { |
1129 | /* Wait for the commit thread to wake up and die. */ | 1129 | /* Wait for the commit thread to wake up and die. */ |
1130 | journal_kill_thread(journal); | 1130 | journal_kill_thread(journal); |
1131 | 1131 | ||
1132 | /* Force a final log commit */ | 1132 | /* Force a final log commit */ |
1133 | if (journal->j_running_transaction) | 1133 | if (journal->j_running_transaction) |
1134 | journal_commit_transaction(journal); | 1134 | jbd2_journal_commit_transaction(journal); |
1135 | 1135 | ||
1136 | /* Force any old transactions to disk */ | 1136 | /* Force any old transactions to disk */ |
1137 | 1137 | ||
@@ -1139,7 +1139,7 @@ void journal_destroy(journal_t *journal) | |||
1139 | spin_lock(&journal->j_list_lock); | 1139 | spin_lock(&journal->j_list_lock); |
1140 | while (journal->j_checkpoint_transactions != NULL) { | 1140 | while (journal->j_checkpoint_transactions != NULL) { |
1141 | spin_unlock(&journal->j_list_lock); | 1141 | spin_unlock(&journal->j_list_lock); |
1142 | log_do_checkpoint(journal); | 1142 | jbd2_log_do_checkpoint(journal); |
1143 | spin_lock(&journal->j_list_lock); | 1143 | spin_lock(&journal->j_list_lock); |
1144 | } | 1144 | } |
1145 | 1145 | ||
@@ -1152,21 +1152,21 @@ void journal_destroy(journal_t *journal) | |||
1152 | journal->j_tail = 0; | 1152 | journal->j_tail = 0; |
1153 | journal->j_tail_sequence = ++journal->j_transaction_sequence; | 1153 | journal->j_tail_sequence = ++journal->j_transaction_sequence; |
1154 | if (journal->j_sb_buffer) { | 1154 | if (journal->j_sb_buffer) { |
1155 | journal_update_superblock(journal, 1); | 1155 | jbd2_journal_update_superblock(journal, 1); |
1156 | brelse(journal->j_sb_buffer); | 1156 | brelse(journal->j_sb_buffer); |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | if (journal->j_inode) | 1159 | if (journal->j_inode) |
1160 | iput(journal->j_inode); | 1160 | iput(journal->j_inode); |
1161 | if (journal->j_revoke) | 1161 | if (journal->j_revoke) |
1162 | journal_destroy_revoke(journal); | 1162 | jbd2_journal_destroy_revoke(journal); |
1163 | kfree(journal->j_wbuf); | 1163 | kfree(journal->j_wbuf); |
1164 | kfree(journal); | 1164 | kfree(journal); |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | 1167 | ||
1168 | /** | 1168 | /** |
1169 | *int journal_check_used_features () - Check if features specified are used. | 1169 | *int jbd2_journal_check_used_features () - Check if features specified are used. |
1170 | * @journal: Journal to check. | 1170 | * @journal: Journal to check. |
1171 | * @compat: bitmask of compatible features | 1171 | * @compat: bitmask of compatible features |
1172 | * @ro: bitmask of features that force read-only mount | 1172 | * @ro: bitmask of features that force read-only mount |
@@ -1176,7 +1176,7 @@ void journal_destroy(journal_t *journal) | |||
1176 | * features. Return true (non-zero) if it does. | 1176 | * features. Return true (non-zero) if it does. |
1177 | **/ | 1177 | **/ |
1178 | 1178 | ||
1179 | int journal_check_used_features (journal_t *journal, unsigned long compat, | 1179 | int jbd2_journal_check_used_features (journal_t *journal, unsigned long compat, |
1180 | unsigned long ro, unsigned long incompat) | 1180 | unsigned long ro, unsigned long incompat) |
1181 | { | 1181 | { |
1182 | journal_superblock_t *sb; | 1182 | journal_superblock_t *sb; |
@@ -1197,7 +1197,7 @@ int journal_check_used_features (journal_t *journal, unsigned long compat, | |||
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | /** | 1199 | /** |
1200 | * int journal_check_available_features() - Check feature set in journalling layer | 1200 | * int jbd2_journal_check_available_features() - Check feature set in journalling layer |
1201 | * @journal: Journal to check. | 1201 | * @journal: Journal to check. |
1202 | * @compat: bitmask of compatible features | 1202 | * @compat: bitmask of compatible features |
1203 | * @ro: bitmask of features that force read-only mount | 1203 | * @ro: bitmask of features that force read-only mount |
@@ -1207,7 +1207,7 @@ int journal_check_used_features (journal_t *journal, unsigned long compat, | |||
1207 | * all of a given set of features on this journal. Return true | 1207 | * all of a given set of features on this journal. Return true |
1208 | * (non-zero) if it can. */ | 1208 | * (non-zero) if it can. */ |
1209 | 1209 | ||
1210 | int journal_check_available_features (journal_t *journal, unsigned long compat, | 1210 | int jbd2_journal_check_available_features (journal_t *journal, unsigned long compat, |
1211 | unsigned long ro, unsigned long incompat) | 1211 | unsigned long ro, unsigned long incompat) |
1212 | { | 1212 | { |
1213 | journal_superblock_t *sb; | 1213 | journal_superblock_t *sb; |
@@ -1224,16 +1224,16 @@ int journal_check_available_features (journal_t *journal, unsigned long compat, | |||
1224 | if (journal->j_format_version != 2) | 1224 | if (journal->j_format_version != 2) |
1225 | return 0; | 1225 | return 0; |
1226 | 1226 | ||
1227 | if ((compat & JFS_KNOWN_COMPAT_FEATURES) == compat && | 1227 | if ((compat & JBD2_KNOWN_COMPAT_FEATURES) == compat && |
1228 | (ro & JFS_KNOWN_ROCOMPAT_FEATURES) == ro && | 1228 | (ro & JBD2_KNOWN_ROCOMPAT_FEATURES) == ro && |
1229 | (incompat & JFS_KNOWN_INCOMPAT_FEATURES) == incompat) | 1229 | (incompat & JBD2_KNOWN_INCOMPAT_FEATURES) == incompat) |
1230 | return 1; | 1230 | return 1; |
1231 | 1231 | ||
1232 | return 0; | 1232 | return 0; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | /** | 1235 | /** |
1236 | * int journal_set_features () - Mark a given journal feature in the superblock | 1236 | * int jbd2_journal_set_features () - Mark a given journal feature in the superblock |
1237 | * @journal: Journal to act on. | 1237 | * @journal: Journal to act on. |
1238 | * @compat: bitmask of compatible features | 1238 | * @compat: bitmask of compatible features |
1239 | * @ro: bitmask of features that force read-only mount | 1239 | * @ro: bitmask of features that force read-only mount |
@@ -1244,15 +1244,15 @@ int journal_check_available_features (journal_t *journal, unsigned long compat, | |||
1244 | * | 1244 | * |
1245 | */ | 1245 | */ |
1246 | 1246 | ||
1247 | int journal_set_features (journal_t *journal, unsigned long compat, | 1247 | int jbd2_journal_set_features (journal_t *journal, unsigned long compat, |
1248 | unsigned long ro, unsigned long incompat) | 1248 | unsigned long ro, unsigned long incompat) |
1249 | { | 1249 | { |
1250 | journal_superblock_t *sb; | 1250 | journal_superblock_t *sb; |
1251 | 1251 | ||
1252 | if (journal_check_used_features(journal, compat, ro, incompat)) | 1252 | if (jbd2_journal_check_used_features(journal, compat, ro, incompat)) |
1253 | return 1; | 1253 | return 1; |
1254 | 1254 | ||
1255 | if (!journal_check_available_features(journal, compat, ro, incompat)) | 1255 | if (!jbd2_journal_check_available_features(journal, compat, ro, incompat)) |
1256 | return 0; | 1256 | return 0; |
1257 | 1257 | ||
1258 | jbd_debug(1, "Setting new features 0x%lx/0x%lx/0x%lx\n", | 1258 | jbd_debug(1, "Setting new features 0x%lx/0x%lx/0x%lx\n", |
@@ -1269,13 +1269,13 @@ int journal_set_features (journal_t *journal, unsigned long compat, | |||
1269 | 1269 | ||
1270 | 1270 | ||
1271 | /** | 1271 | /** |
1272 | * int journal_update_format () - Update on-disk journal structure. | 1272 | * int jbd2_journal_update_format () - Update on-disk journal structure. |
1273 | * @journal: Journal to act on. | 1273 | * @journal: Journal to act on. |
1274 | * | 1274 | * |
1275 | * Given an initialised but unloaded journal struct, poke about in the | 1275 | * Given an initialised but unloaded journal struct, poke about in the |
1276 | * on-disk structure to update it to the most recent supported version. | 1276 | * on-disk structure to update it to the most recent supported version. |
1277 | */ | 1277 | */ |
1278 | int journal_update_format (journal_t *journal) | 1278 | int jbd2_journal_update_format (journal_t *journal) |
1279 | { | 1279 | { |
1280 | journal_superblock_t *sb; | 1280 | journal_superblock_t *sb; |
1281 | int err; | 1281 | int err; |
@@ -1287,9 +1287,9 @@ int journal_update_format (journal_t *journal) | |||
1287 | sb = journal->j_superblock; | 1287 | sb = journal->j_superblock; |
1288 | 1288 | ||
1289 | switch (be32_to_cpu(sb->s_header.h_blocktype)) { | 1289 | switch (be32_to_cpu(sb->s_header.h_blocktype)) { |
1290 | case JFS_SUPERBLOCK_V2: | 1290 | case JBD2_SUPERBLOCK_V2: |
1291 | return 0; | 1291 | return 0; |
1292 | case JFS_SUPERBLOCK_V1: | 1292 | case JBD2_SUPERBLOCK_V1: |
1293 | return journal_convert_superblock_v1(journal, sb); | 1293 | return journal_convert_superblock_v1(journal, sb); |
1294 | default: | 1294 | default: |
1295 | break; | 1295 | break; |
@@ -1312,7 +1312,7 @@ static int journal_convert_superblock_v1(journal_t *journal, | |||
1312 | memset(&sb->s_feature_compat, 0, blocksize-offset); | 1312 | memset(&sb->s_feature_compat, 0, blocksize-offset); |
1313 | 1313 | ||
1314 | sb->s_nr_users = cpu_to_be32(1); | 1314 | sb->s_nr_users = cpu_to_be32(1); |
1315 | sb->s_header.h_blocktype = cpu_to_be32(JFS_SUPERBLOCK_V2); | 1315 | sb->s_header.h_blocktype = cpu_to_be32(JBD2_SUPERBLOCK_V2); |
1316 | journal->j_format_version = 2; | 1316 | journal->j_format_version = 2; |
1317 | 1317 | ||
1318 | bh = journal->j_sb_buffer; | 1318 | bh = journal->j_sb_buffer; |
@@ -1324,7 +1324,7 @@ static int journal_convert_superblock_v1(journal_t *journal, | |||
1324 | 1324 | ||
1325 | 1325 | ||
1326 | /** | 1326 | /** |
1327 | * int journal_flush () - Flush journal | 1327 | * int jbd2_journal_flush () - Flush journal |
1328 | * @journal: Journal to act on. | 1328 | * @journal: Journal to act on. |
1329 | * | 1329 | * |
1330 | * Flush all data for a given journal to disk and empty the journal. | 1330 | * Flush all data for a given journal to disk and empty the journal. |
@@ -1332,7 +1332,7 @@ static int journal_convert_superblock_v1(journal_t *journal, | |||
1332 | * recovery does not need to happen on remount. | 1332 | * recovery does not need to happen on remount. |
1333 | */ | 1333 | */ |
1334 | 1334 | ||
1335 | int journal_flush(journal_t *journal) | 1335 | int jbd2_journal_flush(journal_t *journal) |
1336 | { | 1336 | { |
1337 | int err = 0; | 1337 | int err = 0; |
1338 | transaction_t *transaction = NULL; | 1338 | transaction_t *transaction = NULL; |
@@ -1343,7 +1343,7 @@ int journal_flush(journal_t *journal) | |||
1343 | /* Force everything buffered to the log... */ | 1343 | /* Force everything buffered to the log... */ |
1344 | if (journal->j_running_transaction) { | 1344 | if (journal->j_running_transaction) { |
1345 | transaction = journal->j_running_transaction; | 1345 | transaction = journal->j_running_transaction; |
1346 | __log_start_commit(journal, transaction->t_tid); | 1346 | __jbd2_log_start_commit(journal, transaction->t_tid); |
1347 | } else if (journal->j_committing_transaction) | 1347 | } else if (journal->j_committing_transaction) |
1348 | transaction = journal->j_committing_transaction; | 1348 | transaction = journal->j_committing_transaction; |
1349 | 1349 | ||
@@ -1352,7 +1352,7 @@ int journal_flush(journal_t *journal) | |||
1352 | tid_t tid = transaction->t_tid; | 1352 | tid_t tid = transaction->t_tid; |
1353 | 1353 | ||
1354 | spin_unlock(&journal->j_state_lock); | 1354 | spin_unlock(&journal->j_state_lock); |
1355 | log_wait_commit(journal, tid); | 1355 | jbd2_log_wait_commit(journal, tid); |
1356 | } else { | 1356 | } else { |
1357 | spin_unlock(&journal->j_state_lock); | 1357 | spin_unlock(&journal->j_state_lock); |
1358 | } | 1358 | } |
@@ -1361,11 +1361,11 @@ int journal_flush(journal_t *journal) | |||
1361 | spin_lock(&journal->j_list_lock); | 1361 | spin_lock(&journal->j_list_lock); |
1362 | while (!err && journal->j_checkpoint_transactions != NULL) { | 1362 | while (!err && journal->j_checkpoint_transactions != NULL) { |
1363 | spin_unlock(&journal->j_list_lock); | 1363 | spin_unlock(&journal->j_list_lock); |
1364 | err = log_do_checkpoint(journal); | 1364 | err = jbd2_log_do_checkpoint(journal); |
1365 | spin_lock(&journal->j_list_lock); | 1365 | spin_lock(&journal->j_list_lock); |
1366 | } | 1366 | } |
1367 | spin_unlock(&journal->j_list_lock); | 1367 | spin_unlock(&journal->j_list_lock); |
1368 | cleanup_journal_tail(journal); | 1368 | jbd2_cleanup_journal_tail(journal); |
1369 | 1369 | ||
1370 | /* Finally, mark the journal as really needing no recovery. | 1370 | /* Finally, mark the journal as really needing no recovery. |
1371 | * This sets s_start==0 in the underlying superblock, which is | 1371 | * This sets s_start==0 in the underlying superblock, which is |
@@ -1376,7 +1376,7 @@ int journal_flush(journal_t *journal) | |||
1376 | old_tail = journal->j_tail; | 1376 | old_tail = journal->j_tail; |
1377 | journal->j_tail = 0; | 1377 | journal->j_tail = 0; |
1378 | spin_unlock(&journal->j_state_lock); | 1378 | spin_unlock(&journal->j_state_lock); |
1379 | journal_update_superblock(journal, 1); | 1379 | jbd2_journal_update_superblock(journal, 1); |
1380 | spin_lock(&journal->j_state_lock); | 1380 | spin_lock(&journal->j_state_lock); |
1381 | journal->j_tail = old_tail; | 1381 | journal->j_tail = old_tail; |
1382 | 1382 | ||
@@ -1390,24 +1390,24 @@ int journal_flush(journal_t *journal) | |||
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | /** | 1392 | /** |
1393 | * int journal_wipe() - Wipe journal contents | 1393 | * int jbd2_journal_wipe() - Wipe journal contents |
1394 | * @journal: Journal to act on. | 1394 | * @journal: Journal to act on. |
1395 | * @write: flag (see below) | 1395 | * @write: flag (see below) |
1396 | * | 1396 | * |
1397 | * Wipe out all of the contents of a journal, safely. This will produce | 1397 | * Wipe out all of the contents of a journal, safely. This will produce |
1398 | * a warning if the journal contains any valid recovery information. | 1398 | * a warning if the journal contains any valid recovery information. |
1399 | * Must be called between journal_init_*() and journal_load(). | 1399 | * Must be called between journal_init_*() and jbd2_journal_load(). |
1400 | * | 1400 | * |
1401 | * If 'write' is non-zero, then we wipe out the journal on disk; otherwise | 1401 | * If 'write' is non-zero, then we wipe out the journal on disk; otherwise |
1402 | * we merely suppress recovery. | 1402 | * we merely suppress recovery. |
1403 | */ | 1403 | */ |
1404 | 1404 | ||
1405 | int journal_wipe(journal_t *journal, int write) | 1405 | int jbd2_journal_wipe(journal_t *journal, int write) |
1406 | { | 1406 | { |
1407 | journal_superblock_t *sb; | 1407 | journal_superblock_t *sb; |
1408 | int err = 0; | 1408 | int err = 0; |
1409 | 1409 | ||
1410 | J_ASSERT (!(journal->j_flags & JFS_LOADED)); | 1410 | J_ASSERT (!(journal->j_flags & JBD2_LOADED)); |
1411 | 1411 | ||
1412 | err = load_superblock(journal); | 1412 | err = load_superblock(journal); |
1413 | if (err) | 1413 | if (err) |
@@ -1421,9 +1421,9 @@ int journal_wipe(journal_t *journal, int write) | |||
1421 | printk (KERN_WARNING "JBD: %s recovery information on journal\n", | 1421 | printk (KERN_WARNING "JBD: %s recovery information on journal\n", |
1422 | write ? "Clearing" : "Ignoring"); | 1422 | write ? "Clearing" : "Ignoring"); |
1423 | 1423 | ||
1424 | err = journal_skip_recovery(journal); | 1424 | err = jbd2_journal_skip_recovery(journal); |
1425 | if (write) | 1425 | if (write) |
1426 | journal_update_superblock(journal, 1); | 1426 | jbd2_journal_update_superblock(journal, 1); |
1427 | 1427 | ||
1428 | no_recovery: | 1428 | no_recovery: |
1429 | return err; | 1429 | return err; |
@@ -1459,22 +1459,22 @@ static const char *journal_dev_name(journal_t *journal, char *buffer) | |||
1459 | * Aborts hard --- we mark the abort as occurred, but do _nothing_ else, | 1459 | * Aborts hard --- we mark the abort as occurred, but do _nothing_ else, |
1460 | * and don't attempt to make any other journal updates. | 1460 | * and don't attempt to make any other journal updates. |
1461 | */ | 1461 | */ |
1462 | void __journal_abort_hard(journal_t *journal) | 1462 | void __jbd2_journal_abort_hard(journal_t *journal) |
1463 | { | 1463 | { |
1464 | transaction_t *transaction; | 1464 | transaction_t *transaction; |
1465 | char b[BDEVNAME_SIZE]; | 1465 | char b[BDEVNAME_SIZE]; |
1466 | 1466 | ||
1467 | if (journal->j_flags & JFS_ABORT) | 1467 | if (journal->j_flags & JBD2_ABORT) |
1468 | return; | 1468 | return; |
1469 | 1469 | ||
1470 | printk(KERN_ERR "Aborting journal on device %s.\n", | 1470 | printk(KERN_ERR "Aborting journal on device %s.\n", |
1471 | journal_dev_name(journal, b)); | 1471 | journal_dev_name(journal, b)); |
1472 | 1472 | ||
1473 | spin_lock(&journal->j_state_lock); | 1473 | spin_lock(&journal->j_state_lock); |
1474 | journal->j_flags |= JFS_ABORT; | 1474 | journal->j_flags |= JBD2_ABORT; |
1475 | transaction = journal->j_running_transaction; | 1475 | transaction = journal->j_running_transaction; |
1476 | if (transaction) | 1476 | if (transaction) |
1477 | __log_start_commit(journal, transaction->t_tid); | 1477 | __jbd2_log_start_commit(journal, transaction->t_tid); |
1478 | spin_unlock(&journal->j_state_lock); | 1478 | spin_unlock(&journal->j_state_lock); |
1479 | } | 1479 | } |
1480 | 1480 | ||
@@ -1482,20 +1482,20 @@ void __journal_abort_hard(journal_t *journal) | |||
1482 | * but don't do any other IO. */ | 1482 | * but don't do any other IO. */ |
1483 | static void __journal_abort_soft (journal_t *journal, int errno) | 1483 | static void __journal_abort_soft (journal_t *journal, int errno) |
1484 | { | 1484 | { |
1485 | if (journal->j_flags & JFS_ABORT) | 1485 | if (journal->j_flags & JBD2_ABORT) |
1486 | return; | 1486 | return; |
1487 | 1487 | ||
1488 | if (!journal->j_errno) | 1488 | if (!journal->j_errno) |
1489 | journal->j_errno = errno; | 1489 | journal->j_errno = errno; |
1490 | 1490 | ||
1491 | __journal_abort_hard(journal); | 1491 | __jbd2_journal_abort_hard(journal); |
1492 | 1492 | ||
1493 | if (errno) | 1493 | if (errno) |
1494 | journal_update_superblock(journal, 1); | 1494 | jbd2_journal_update_superblock(journal, 1); |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | /** | 1497 | /** |
1498 | * void journal_abort () - Shutdown the journal immediately. | 1498 | * void jbd2_journal_abort () - Shutdown the journal immediately. |
1499 | * @journal: the journal to shutdown. | 1499 | * @journal: the journal to shutdown. |
1500 | * @errno: an error number to record in the journal indicating | 1500 | * @errno: an error number to record in the journal indicating |
1501 | * the reason for the shutdown. | 1501 | * the reason for the shutdown. |
@@ -1504,7 +1504,7 @@ static void __journal_abort_soft (journal_t *journal, int errno) | |||
1504 | * journal (not of a single transaction). This operation cannot be | 1504 | * journal (not of a single transaction). This operation cannot be |
1505 | * undone without closing and reopening the journal. | 1505 | * undone without closing and reopening the journal. |
1506 | * | 1506 | * |
1507 | * The journal_abort function is intended to support higher level error | 1507 | * The jbd2_journal_abort function is intended to support higher level error |
1508 | * recovery mechanisms such as the ext2/ext3 remount-readonly error | 1508 | * recovery mechanisms such as the ext2/ext3 remount-readonly error |
1509 | * mode. | 1509 | * mode. |
1510 | * | 1510 | * |
@@ -1520,13 +1520,13 @@ static void __journal_abort_soft (journal_t *journal, int errno) | |||
1520 | * | 1520 | * |
1521 | * Any attempt to get a new transaction handle on a journal which is in | 1521 | * Any attempt to get a new transaction handle on a journal which is in |
1522 | * ABORT state will just result in an -EROFS error return. A | 1522 | * ABORT state will just result in an -EROFS error return. A |
1523 | * journal_stop on an existing handle will return -EIO if we have | 1523 | * jbd2_journal_stop on an existing handle will return -EIO if we have |
1524 | * entered abort state during the update. | 1524 | * entered abort state during the update. |
1525 | * | 1525 | * |
1526 | * Recursive transactions are not disturbed by journal abort until the | 1526 | * Recursive transactions are not disturbed by journal abort until the |
1527 | * final journal_stop, which will receive the -EIO error. | 1527 | * final jbd2_journal_stop, which will receive the -EIO error. |
1528 | * | 1528 | * |
1529 | * Finally, the journal_abort call allows the caller to supply an errno | 1529 | * Finally, the jbd2_journal_abort call allows the caller to supply an errno |
1530 | * which will be recorded (if possible) in the journal superblock. This | 1530 | * which will be recorded (if possible) in the journal superblock. This |
1531 | * allows a client to record failure conditions in the middle of a | 1531 | * allows a client to record failure conditions in the middle of a |
1532 | * transaction without having to complete the transaction to record the | 1532 | * transaction without having to complete the transaction to record the |
@@ -1540,28 +1540,28 @@ static void __journal_abort_soft (journal_t *journal, int errno) | |||
1540 | * | 1540 | * |
1541 | */ | 1541 | */ |
1542 | 1542 | ||
1543 | void journal_abort(journal_t *journal, int errno) | 1543 | void jbd2_journal_abort(journal_t *journal, int errno) |
1544 | { | 1544 | { |
1545 | __journal_abort_soft(journal, errno); | 1545 | __journal_abort_soft(journal, errno); |
1546 | } | 1546 | } |
1547 | 1547 | ||
1548 | /** | 1548 | /** |
1549 | * int journal_errno () - returns the journal's error state. | 1549 | * int jbd2_journal_errno () - returns the journal's error state. |
1550 | * @journal: journal to examine. | 1550 | * @journal: journal to examine. |
1551 | * | 1551 | * |
1552 | * This is the errno numbet set with journal_abort(), the last | 1552 | * This is the errno numbet set with jbd2_journal_abort(), the last |
1553 | * time the journal was mounted - if the journal was stopped | 1553 | * time the journal was mounted - if the journal was stopped |
1554 | * without calling abort this will be 0. | 1554 | * without calling abort this will be 0. |
1555 | * | 1555 | * |
1556 | * If the journal has been aborted on this mount time -EROFS will | 1556 | * If the journal has been aborted on this mount time -EROFS will |
1557 | * be returned. | 1557 | * be returned. |
1558 | */ | 1558 | */ |
1559 | int journal_errno(journal_t *journal) | 1559 | int jbd2_journal_errno(journal_t *journal) |
1560 | { | 1560 | { |
1561 | int err; | 1561 | int err; |
1562 | 1562 | ||
1563 | spin_lock(&journal->j_state_lock); | 1563 | spin_lock(&journal->j_state_lock); |
1564 | if (journal->j_flags & JFS_ABORT) | 1564 | if (journal->j_flags & JBD2_ABORT) |
1565 | err = -EROFS; | 1565 | err = -EROFS; |
1566 | else | 1566 | else |
1567 | err = journal->j_errno; | 1567 | err = journal->j_errno; |
@@ -1570,18 +1570,18 @@ int journal_errno(journal_t *journal) | |||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | /** | 1572 | /** |
1573 | * int journal_clear_err () - clears the journal's error state | 1573 | * int jbd2_journal_clear_err () - clears the journal's error state |
1574 | * @journal: journal to act on. | 1574 | * @journal: journal to act on. |
1575 | * | 1575 | * |
1576 | * An error must be cleared or Acked to take a FS out of readonly | 1576 | * An error must be cleared or Acked to take a FS out of readonly |
1577 | * mode. | 1577 | * mode. |
1578 | */ | 1578 | */ |
1579 | int journal_clear_err(journal_t *journal) | 1579 | int jbd2_journal_clear_err(journal_t *journal) |
1580 | { | 1580 | { |
1581 | int err = 0; | 1581 | int err = 0; |
1582 | 1582 | ||
1583 | spin_lock(&journal->j_state_lock); | 1583 | spin_lock(&journal->j_state_lock); |
1584 | if (journal->j_flags & JFS_ABORT) | 1584 | if (journal->j_flags & JBD2_ABORT) |
1585 | err = -EROFS; | 1585 | err = -EROFS; |
1586 | else | 1586 | else |
1587 | journal->j_errno = 0; | 1587 | journal->j_errno = 0; |
@@ -1590,21 +1590,21 @@ int journal_clear_err(journal_t *journal) | |||
1590 | } | 1590 | } |
1591 | 1591 | ||
1592 | /** | 1592 | /** |
1593 | * void journal_ack_err() - Ack journal err. | 1593 | * void jbd2_journal_ack_err() - Ack journal err. |
1594 | * @journal: journal to act on. | 1594 | * @journal: journal to act on. |
1595 | * | 1595 | * |
1596 | * An error must be cleared or Acked to take a FS out of readonly | 1596 | * An error must be cleared or Acked to take a FS out of readonly |
1597 | * mode. | 1597 | * mode. |
1598 | */ | 1598 | */ |
1599 | void journal_ack_err(journal_t *journal) | 1599 | void jbd2_journal_ack_err(journal_t *journal) |
1600 | { | 1600 | { |
1601 | spin_lock(&journal->j_state_lock); | 1601 | spin_lock(&journal->j_state_lock); |
1602 | if (journal->j_errno) | 1602 | if (journal->j_errno) |
1603 | journal->j_flags |= JFS_ACK_ERR; | 1603 | journal->j_flags |= JBD2_ACK_ERR; |
1604 | spin_unlock(&journal->j_state_lock); | 1604 | spin_unlock(&journal->j_state_lock); |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | int journal_blocks_per_page(struct inode *inode) | 1607 | int jbd2_journal_blocks_per_page(struct inode *inode) |
1608 | { | 1608 | { |
1609 | return 1 << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); | 1609 | return 1 << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); |
1610 | } | 1610 | } |
@@ -1613,7 +1613,7 @@ int journal_blocks_per_page(struct inode *inode) | |||
1613 | * Simple support for retrying memory allocations. Introduced to help to | 1613 | * Simple support for retrying memory allocations. Introduced to help to |
1614 | * debug different VM deadlock avoidance strategies. | 1614 | * debug different VM deadlock avoidance strategies. |
1615 | */ | 1615 | */ |
1616 | void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry) | 1616 | void * __jbd2_kmalloc (const char *where, size_t size, gfp_t flags, int retry) |
1617 | { | 1617 | { |
1618 | return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0)); | 1618 | return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0)); |
1619 | } | 1619 | } |
@@ -1634,7 +1634,7 @@ static const char *jbd_slab_names[JBD_MAX_SLABS] = { | |||
1634 | "jbd_1k", "jbd_2k", "jbd_4k", NULL, "jbd_8k" | 1634 | "jbd_1k", "jbd_2k", "jbd_4k", NULL, "jbd_8k" |
1635 | }; | 1635 | }; |
1636 | 1636 | ||
1637 | static void journal_destroy_jbd_slabs(void) | 1637 | static void jbd2_journal_destroy_jbd_slabs(void) |
1638 | { | 1638 | { |
1639 | int i; | 1639 | int i; |
1640 | 1640 | ||
@@ -1645,7 +1645,7 @@ static void journal_destroy_jbd_slabs(void) | |||
1645 | } | 1645 | } |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | static int journal_create_jbd_slab(size_t slab_size) | 1648 | static int jbd2_journal_create_jbd_slab(size_t slab_size) |
1649 | { | 1649 | { |
1650 | int i = JBD_SLAB_INDEX(slab_size); | 1650 | int i = JBD_SLAB_INDEX(slab_size); |
1651 | 1651 | ||
@@ -1671,7 +1671,7 @@ static int journal_create_jbd_slab(size_t slab_size) | |||
1671 | return 0; | 1671 | return 0; |
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | void * jbd_slab_alloc(size_t size, gfp_t flags) | 1674 | void * jbd2_slab_alloc(size_t size, gfp_t flags) |
1675 | { | 1675 | { |
1676 | int idx; | 1676 | int idx; |
1677 | 1677 | ||
@@ -1680,7 +1680,7 @@ void * jbd_slab_alloc(size_t size, gfp_t flags) | |||
1680 | return kmem_cache_alloc(jbd_slab[idx], flags | __GFP_NOFAIL); | 1680 | return kmem_cache_alloc(jbd_slab[idx], flags | __GFP_NOFAIL); |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | void jbd_slab_free(void *ptr, size_t size) | 1683 | void jbd2_slab_free(void *ptr, size_t size) |
1684 | { | 1684 | { |
1685 | int idx; | 1685 | int idx; |
1686 | 1686 | ||
@@ -1692,35 +1692,35 @@ void jbd_slab_free(void *ptr, size_t size) | |||
1692 | /* | 1692 | /* |
1693 | * Journal_head storage management | 1693 | * Journal_head storage management |
1694 | */ | 1694 | */ |
1695 | static kmem_cache_t *journal_head_cache; | 1695 | static kmem_cache_t *jbd2_journal_head_cache; |
1696 | #ifdef CONFIG_JBD_DEBUG | 1696 | #ifdef CONFIG_JBD_DEBUG |
1697 | static atomic_t nr_journal_heads = ATOMIC_INIT(0); | 1697 | static atomic_t nr_journal_heads = ATOMIC_INIT(0); |
1698 | #endif | 1698 | #endif |
1699 | 1699 | ||
1700 | static int journal_init_journal_head_cache(void) | 1700 | static int journal_init_jbd2_journal_head_cache(void) |
1701 | { | 1701 | { |
1702 | int retval; | 1702 | int retval; |
1703 | 1703 | ||
1704 | J_ASSERT(journal_head_cache == 0); | 1704 | J_ASSERT(jbd2_journal_head_cache == 0); |
1705 | journal_head_cache = kmem_cache_create("journal_head", | 1705 | jbd2_journal_head_cache = kmem_cache_create("journal_head", |
1706 | sizeof(struct journal_head), | 1706 | sizeof(struct journal_head), |
1707 | 0, /* offset */ | 1707 | 0, /* offset */ |
1708 | 0, /* flags */ | 1708 | 0, /* flags */ |
1709 | NULL, /* ctor */ | 1709 | NULL, /* ctor */ |
1710 | NULL); /* dtor */ | 1710 | NULL); /* dtor */ |
1711 | retval = 0; | 1711 | retval = 0; |
1712 | if (journal_head_cache == 0) { | 1712 | if (jbd2_journal_head_cache == 0) { |
1713 | retval = -ENOMEM; | 1713 | retval = -ENOMEM; |
1714 | printk(KERN_EMERG "JBD: no memory for journal_head cache\n"); | 1714 | printk(KERN_EMERG "JBD: no memory for journal_head cache\n"); |
1715 | } | 1715 | } |
1716 | return retval; | 1716 | return retval; |
1717 | } | 1717 | } |
1718 | 1718 | ||
1719 | static void journal_destroy_journal_head_cache(void) | 1719 | static void jbd2_journal_destroy_jbd2_journal_head_cache(void) |
1720 | { | 1720 | { |
1721 | J_ASSERT(journal_head_cache != NULL); | 1721 | J_ASSERT(jbd2_journal_head_cache != NULL); |
1722 | kmem_cache_destroy(journal_head_cache); | 1722 | kmem_cache_destroy(jbd2_journal_head_cache); |
1723 | journal_head_cache = NULL; | 1723 | jbd2_journal_head_cache = NULL; |
1724 | } | 1724 | } |
1725 | 1725 | ||
1726 | /* | 1726 | /* |
@@ -1734,7 +1734,7 @@ static struct journal_head *journal_alloc_journal_head(void) | |||
1734 | #ifdef CONFIG_JBD_DEBUG | 1734 | #ifdef CONFIG_JBD_DEBUG |
1735 | atomic_inc(&nr_journal_heads); | 1735 | atomic_inc(&nr_journal_heads); |
1736 | #endif | 1736 | #endif |
1737 | ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); | 1737 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); |
1738 | if (ret == 0) { | 1738 | if (ret == 0) { |
1739 | jbd_debug(1, "out of memory for journal_head\n"); | 1739 | jbd_debug(1, "out of memory for journal_head\n"); |
1740 | if (time_after(jiffies, last_warning + 5*HZ)) { | 1740 | if (time_after(jiffies, last_warning + 5*HZ)) { |
@@ -1744,7 +1744,7 @@ static struct journal_head *journal_alloc_journal_head(void) | |||
1744 | } | 1744 | } |
1745 | while (ret == 0) { | 1745 | while (ret == 0) { |
1746 | yield(); | 1746 | yield(); |
1747 | ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); | 1747 | ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); |
1748 | } | 1748 | } |
1749 | } | 1749 | } |
1750 | return ret; | 1750 | return ret; |
@@ -1756,7 +1756,7 @@ static void journal_free_journal_head(struct journal_head *jh) | |||
1756 | atomic_dec(&nr_journal_heads); | 1756 | atomic_dec(&nr_journal_heads); |
1757 | memset(jh, JBD_POISON_FREE, sizeof(*jh)); | 1757 | memset(jh, JBD_POISON_FREE, sizeof(*jh)); |
1758 | #endif | 1758 | #endif |
1759 | kmem_cache_free(journal_head_cache, jh); | 1759 | kmem_cache_free(jbd2_journal_head_cache, jh); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | /* | 1762 | /* |
@@ -1775,22 +1775,22 @@ static void journal_free_journal_head(struct journal_head *jh) | |||
1775 | * | 1775 | * |
1776 | * A journal_head may be detached from its buffer_head when the journal_head's | 1776 | * A journal_head may be detached from its buffer_head when the journal_head's |
1777 | * b_transaction, b_cp_transaction and b_next_transaction pointers are NULL. | 1777 | * b_transaction, b_cp_transaction and b_next_transaction pointers are NULL. |
1778 | * Various places in JBD call journal_remove_journal_head() to indicate that the | 1778 | * Various places in JBD call jbd2_journal_remove_journal_head() to indicate that the |
1779 | * journal_head can be dropped if needed. | 1779 | * journal_head can be dropped if needed. |
1780 | * | 1780 | * |
1781 | * Various places in the kernel want to attach a journal_head to a buffer_head | 1781 | * Various places in the kernel want to attach a journal_head to a buffer_head |
1782 | * _before_ attaching the journal_head to a transaction. To protect the | 1782 | * _before_ attaching the journal_head to a transaction. To protect the |
1783 | * journal_head in this situation, journal_add_journal_head elevates the | 1783 | * journal_head in this situation, jbd2_journal_add_journal_head elevates the |
1784 | * journal_head's b_jcount refcount by one. The caller must call | 1784 | * journal_head's b_jcount refcount by one. The caller must call |
1785 | * journal_put_journal_head() to undo this. | 1785 | * jbd2_journal_put_journal_head() to undo this. |
1786 | * | 1786 | * |
1787 | * So the typical usage would be: | 1787 | * So the typical usage would be: |
1788 | * | 1788 | * |
1789 | * (Attach a journal_head if needed. Increments b_jcount) | 1789 | * (Attach a journal_head if needed. Increments b_jcount) |
1790 | * struct journal_head *jh = journal_add_journal_head(bh); | 1790 | * struct journal_head *jh = jbd2_journal_add_journal_head(bh); |
1791 | * ... | 1791 | * ... |
1792 | * jh->b_transaction = xxx; | 1792 | * jh->b_transaction = xxx; |
1793 | * journal_put_journal_head(jh); | 1793 | * jbd2_journal_put_journal_head(jh); |
1794 | * | 1794 | * |
1795 | * Now, the journal_head's b_jcount is zero, but it is safe from being released | 1795 | * Now, the journal_head's b_jcount is zero, but it is safe from being released |
1796 | * because it has a non-zero b_transaction. | 1796 | * because it has a non-zero b_transaction. |
@@ -1802,7 +1802,7 @@ static void journal_free_journal_head(struct journal_head *jh) | |||
1802 | * Doesn't need the journal lock. | 1802 | * Doesn't need the journal lock. |
1803 | * May sleep. | 1803 | * May sleep. |
1804 | */ | 1804 | */ |
1805 | struct journal_head *journal_add_journal_head(struct buffer_head *bh) | 1805 | struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh) |
1806 | { | 1806 | { |
1807 | struct journal_head *jh; | 1807 | struct journal_head *jh; |
1808 | struct journal_head *new_jh = NULL; | 1808 | struct journal_head *new_jh = NULL; |
@@ -1845,7 +1845,7 @@ repeat: | |||
1845 | * Grab a ref against this buffer_head's journal_head. If it ended up not | 1845 | * Grab a ref against this buffer_head's journal_head. If it ended up not |
1846 | * having a journal_head, return NULL | 1846 | * having a journal_head, return NULL |
1847 | */ | 1847 | */ |
1848 | struct journal_head *journal_grab_journal_head(struct buffer_head *bh) | 1848 | struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh) |
1849 | { | 1849 | { |
1850 | struct journal_head *jh = NULL; | 1850 | struct journal_head *jh = NULL; |
1851 | 1851 | ||
@@ -1877,13 +1877,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
1877 | printk(KERN_WARNING "%s: freeing " | 1877 | printk(KERN_WARNING "%s: freeing " |
1878 | "b_frozen_data\n", | 1878 | "b_frozen_data\n", |
1879 | __FUNCTION__); | 1879 | __FUNCTION__); |
1880 | jbd_slab_free(jh->b_frozen_data, bh->b_size); | 1880 | jbd2_slab_free(jh->b_frozen_data, bh->b_size); |
1881 | } | 1881 | } |
1882 | if (jh->b_committed_data) { | 1882 | if (jh->b_committed_data) { |
1883 | printk(KERN_WARNING "%s: freeing " | 1883 | printk(KERN_WARNING "%s: freeing " |
1884 | "b_committed_data\n", | 1884 | "b_committed_data\n", |
1885 | __FUNCTION__); | 1885 | __FUNCTION__); |
1886 | jbd_slab_free(jh->b_committed_data, bh->b_size); | 1886 | jbd2_slab_free(jh->b_committed_data, bh->b_size); |
1887 | } | 1887 | } |
1888 | bh->b_private = NULL; | 1888 | bh->b_private = NULL; |
1889 | jh->b_bh = NULL; /* debug, really */ | 1889 | jh->b_bh = NULL; /* debug, really */ |
@@ -1897,7 +1897,7 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | /* | 1899 | /* |
1900 | * journal_remove_journal_head(): if the buffer isn't attached to a transaction | 1900 | * jbd2_journal_remove_journal_head(): if the buffer isn't attached to a transaction |
1901 | * and has a zero b_jcount then remove and release its journal_head. If we did | 1901 | * and has a zero b_jcount then remove and release its journal_head. If we did |
1902 | * see that the buffer is not used by any transaction we also "logically" | 1902 | * see that the buffer is not used by any transaction we also "logically" |
1903 | * decrement ->b_count. | 1903 | * decrement ->b_count. |
@@ -1905,11 +1905,11 @@ static void __journal_remove_journal_head(struct buffer_head *bh) | |||
1905 | * We in fact take an additional increment on ->b_count as a convenience, | 1905 | * We in fact take an additional increment on ->b_count as a convenience, |
1906 | * because the caller usually wants to do additional things with the bh | 1906 | * because the caller usually wants to do additional things with the bh |
1907 | * after calling here. | 1907 | * after calling here. |
1908 | * The caller of journal_remove_journal_head() *must* run __brelse(bh) at some | 1908 | * The caller of jbd2_journal_remove_journal_head() *must* run __brelse(bh) at some |
1909 | * time. Once the caller has run __brelse(), the buffer is eligible for | 1909 | * time. Once the caller has run __brelse(), the buffer is eligible for |
1910 | * reaping by try_to_free_buffers(). | 1910 | * reaping by try_to_free_buffers(). |
1911 | */ | 1911 | */ |
1912 | void journal_remove_journal_head(struct buffer_head *bh) | 1912 | void jbd2_journal_remove_journal_head(struct buffer_head *bh) |
1913 | { | 1913 | { |
1914 | jbd_lock_bh_journal_head(bh); | 1914 | jbd_lock_bh_journal_head(bh); |
1915 | __journal_remove_journal_head(bh); | 1915 | __journal_remove_journal_head(bh); |
@@ -1920,7 +1920,7 @@ void journal_remove_journal_head(struct buffer_head *bh) | |||
1920 | * Drop a reference on the passed journal_head. If it fell to zero then try to | 1920 | * Drop a reference on the passed journal_head. If it fell to zero then try to |
1921 | * release the journal_head from the buffer_head. | 1921 | * release the journal_head from the buffer_head. |
1922 | */ | 1922 | */ |
1923 | void journal_put_journal_head(struct journal_head *jh) | 1923 | void jbd2_journal_put_journal_head(struct journal_head *jh) |
1924 | { | 1924 | { |
1925 | struct buffer_head *bh = jh2bh(jh); | 1925 | struct buffer_head *bh = jh2bh(jh); |
1926 | 1926 | ||
@@ -1938,8 +1938,8 @@ void journal_put_journal_head(struct journal_head *jh) | |||
1938 | * /proc tunables | 1938 | * /proc tunables |
1939 | */ | 1939 | */ |
1940 | #if defined(CONFIG_JBD_DEBUG) | 1940 | #if defined(CONFIG_JBD_DEBUG) |
1941 | int journal_enable_debug; | 1941 | int jbd2_journal_enable_debug; |
1942 | EXPORT_SYMBOL(journal_enable_debug); | 1942 | EXPORT_SYMBOL(jbd2_journal_enable_debug); |
1943 | #endif | 1943 | #endif |
1944 | 1944 | ||
1945 | #if defined(CONFIG_JBD_DEBUG) && defined(CONFIG_PROC_FS) | 1945 | #if defined(CONFIG_JBD_DEBUG) && defined(CONFIG_PROC_FS) |
@@ -1951,7 +1951,7 @@ static int read_jbd_debug(char *page, char **start, off_t off, | |||
1951 | { | 1951 | { |
1952 | int ret; | 1952 | int ret; |
1953 | 1953 | ||
1954 | ret = sprintf(page + off, "%d\n", journal_enable_debug); | 1954 | ret = sprintf(page + off, "%d\n", jbd2_journal_enable_debug); |
1955 | *eof = 1; | 1955 | *eof = 1; |
1956 | return ret; | 1956 | return ret; |
1957 | } | 1957 | } |
@@ -1966,11 +1966,11 @@ static int write_jbd_debug(struct file *file, const char __user *buffer, | |||
1966 | if (copy_from_user(buf, buffer, count)) | 1966 | if (copy_from_user(buf, buffer, count)) |
1967 | return -EFAULT; | 1967 | return -EFAULT; |
1968 | buf[ARRAY_SIZE(buf) - 1] = '\0'; | 1968 | buf[ARRAY_SIZE(buf) - 1] = '\0'; |
1969 | journal_enable_debug = simple_strtoul(buf, NULL, 10); | 1969 | jbd2_journal_enable_debug = simple_strtoul(buf, NULL, 10); |
1970 | return count; | 1970 | return count; |
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | #define JBD_PROC_NAME "sys/fs/jbd-debug" | 1973 | #define JBD_PROC_NAME "sys/fs/jbd2-debug" |
1974 | 1974 | ||
1975 | static void __init create_jbd_proc_entry(void) | 1975 | static void __init create_jbd_proc_entry(void) |
1976 | { | 1976 | { |
@@ -1982,7 +1982,7 @@ static void __init create_jbd_proc_entry(void) | |||
1982 | } | 1982 | } |
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | static void __exit remove_jbd_proc_entry(void) | 1985 | static void __exit jbd2_remove_jbd_proc_entry(void) |
1986 | { | 1986 | { |
1987 | if (proc_jbd_debug) | 1987 | if (proc_jbd_debug) |
1988 | remove_proc_entry(JBD_PROC_NAME, NULL); | 1988 | remove_proc_entry(JBD_PROC_NAME, NULL); |
@@ -1991,31 +1991,31 @@ static void __exit remove_jbd_proc_entry(void) | |||
1991 | #else | 1991 | #else |
1992 | 1992 | ||
1993 | #define create_jbd_proc_entry() do {} while (0) | 1993 | #define create_jbd_proc_entry() do {} while (0) |
1994 | #define remove_jbd_proc_entry() do {} while (0) | 1994 | #define jbd2_remove_jbd_proc_entry() do {} while (0) |
1995 | 1995 | ||
1996 | #endif | 1996 | #endif |
1997 | 1997 | ||
1998 | kmem_cache_t *jbd_handle_cache; | 1998 | kmem_cache_t *jbd2_handle_cache; |
1999 | 1999 | ||
2000 | static int __init journal_init_handle_cache(void) | 2000 | static int __init journal_init_handle_cache(void) |
2001 | { | 2001 | { |
2002 | jbd_handle_cache = kmem_cache_create("journal_handle", | 2002 | jbd2_handle_cache = kmem_cache_create("journal_handle", |
2003 | sizeof(handle_t), | 2003 | sizeof(handle_t), |
2004 | 0, /* offset */ | 2004 | 0, /* offset */ |
2005 | 0, /* flags */ | 2005 | 0, /* flags */ |
2006 | NULL, /* ctor */ | 2006 | NULL, /* ctor */ |
2007 | NULL); /* dtor */ | 2007 | NULL); /* dtor */ |
2008 | if (jbd_handle_cache == NULL) { | 2008 | if (jbd2_handle_cache == NULL) { |
2009 | printk(KERN_EMERG "JBD: failed to create handle cache\n"); | 2009 | printk(KERN_EMERG "JBD: failed to create handle cache\n"); |
2010 | return -ENOMEM; | 2010 | return -ENOMEM; |
2011 | } | 2011 | } |
2012 | return 0; | 2012 | return 0; |
2013 | } | 2013 | } |
2014 | 2014 | ||
2015 | static void journal_destroy_handle_cache(void) | 2015 | static void jbd2_journal_destroy_handle_cache(void) |
2016 | { | 2016 | { |
2017 | if (jbd_handle_cache) | 2017 | if (jbd2_handle_cache) |
2018 | kmem_cache_destroy(jbd_handle_cache); | 2018 | kmem_cache_destroy(jbd2_handle_cache); |
2019 | } | 2019 | } |
2020 | 2020 | ||
2021 | /* | 2021 | /* |
@@ -2026,20 +2026,20 @@ static int __init journal_init_caches(void) | |||
2026 | { | 2026 | { |
2027 | int ret; | 2027 | int ret; |
2028 | 2028 | ||
2029 | ret = journal_init_revoke_caches(); | 2029 | ret = jbd2_journal_init_revoke_caches(); |
2030 | if (ret == 0) | 2030 | if (ret == 0) |
2031 | ret = journal_init_journal_head_cache(); | 2031 | ret = journal_init_jbd2_journal_head_cache(); |
2032 | if (ret == 0) | 2032 | if (ret == 0) |
2033 | ret = journal_init_handle_cache(); | 2033 | ret = journal_init_handle_cache(); |
2034 | return ret; | 2034 | return ret; |
2035 | } | 2035 | } |
2036 | 2036 | ||
2037 | static void journal_destroy_caches(void) | 2037 | static void jbd2_journal_destroy_caches(void) |
2038 | { | 2038 | { |
2039 | journal_destroy_revoke_caches(); | 2039 | jbd2_journal_destroy_revoke_caches(); |
2040 | journal_destroy_journal_head_cache(); | 2040 | jbd2_journal_destroy_jbd2_journal_head_cache(); |
2041 | journal_destroy_handle_cache(); | 2041 | jbd2_journal_destroy_handle_cache(); |
2042 | journal_destroy_jbd_slabs(); | 2042 | jbd2_journal_destroy_jbd_slabs(); |
2043 | } | 2043 | } |
2044 | 2044 | ||
2045 | static int __init journal_init(void) | 2045 | static int __init journal_init(void) |
@@ -2050,7 +2050,7 @@ static int __init journal_init(void) | |||
2050 | 2050 | ||
2051 | ret = journal_init_caches(); | 2051 | ret = journal_init_caches(); |
2052 | if (ret != 0) | 2052 | if (ret != 0) |
2053 | journal_destroy_caches(); | 2053 | jbd2_journal_destroy_caches(); |
2054 | create_jbd_proc_entry(); | 2054 | create_jbd_proc_entry(); |
2055 | return ret; | 2055 | return ret; |
2056 | } | 2056 | } |
@@ -2062,8 +2062,8 @@ static void __exit journal_exit(void) | |||
2062 | if (n) | 2062 | if (n) |
2063 | printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); | 2063 | printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); |
2064 | #endif | 2064 | #endif |
2065 | remove_jbd_proc_entry(); | 2065 | jbd2_remove_jbd_proc_entry(); |
2066 | journal_destroy_caches(); | 2066 | jbd2_journal_destroy_caches(); |
2067 | } | 2067 | } |
2068 | 2068 | ||
2069 | MODULE_LICENSE("GPL"); | 2069 | MODULE_LICENSE("GPL"); |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 11563fe2a52b..b2012d112432 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #else | 18 | #else |
19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/jbd.h> | 21 | #include <linux/jbd2.h> |
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #endif | 24 | #endif |
@@ -86,7 +86,7 @@ static int do_readahead(journal_t *journal, unsigned int start) | |||
86 | nbufs = 0; | 86 | nbufs = 0; |
87 | 87 | ||
88 | for (next = start; next < max; next++) { | 88 | for (next = start; next < max; next++) { |
89 | err = journal_bmap(journal, next, &blocknr); | 89 | err = jbd2_journal_bmap(journal, next, &blocknr); |
90 | 90 | ||
91 | if (err) { | 91 | if (err) { |
92 | printk (KERN_ERR "JBD: bad block at offset %u\n", | 92 | printk (KERN_ERR "JBD: bad block at offset %u\n", |
@@ -142,7 +142,7 @@ static int jread(struct buffer_head **bhp, journal_t *journal, | |||
142 | return -EIO; | 142 | return -EIO; |
143 | } | 143 | } |
144 | 144 | ||
145 | err = journal_bmap(journal, offset, &blocknr); | 145 | err = jbd2_journal_bmap(journal, offset, &blocknr); |
146 | 146 | ||
147 | if (err) { | 147 | if (err) { |
148 | printk (KERN_ERR "JBD: bad block at offset %u\n", | 148 | printk (KERN_ERR "JBD: bad block at offset %u\n", |
@@ -191,10 +191,10 @@ static int count_tags(struct buffer_head *bh, int size) | |||
191 | 191 | ||
192 | nr++; | 192 | nr++; |
193 | tagp += sizeof(journal_block_tag_t); | 193 | tagp += sizeof(journal_block_tag_t); |
194 | if (!(tag->t_flags & cpu_to_be32(JFS_FLAG_SAME_UUID))) | 194 | if (!(tag->t_flags & cpu_to_be32(JBD2_FLAG_SAME_UUID))) |
195 | tagp += 16; | 195 | tagp += 16; |
196 | 196 | ||
197 | if (tag->t_flags & cpu_to_be32(JFS_FLAG_LAST_TAG)) | 197 | if (tag->t_flags & cpu_to_be32(JBD2_FLAG_LAST_TAG)) |
198 | break; | 198 | break; |
199 | } | 199 | } |
200 | 200 | ||
@@ -210,7 +210,7 @@ do { \ | |||
210 | } while (0) | 210 | } while (0) |
211 | 211 | ||
212 | /** | 212 | /** |
213 | * journal_recover - recovers a on-disk journal | 213 | * jbd2_journal_recover - recovers a on-disk journal |
214 | * @journal: the journal to recover | 214 | * @journal: the journal to recover |
215 | * | 215 | * |
216 | * The primary function for recovering the log contents when mounting a | 216 | * The primary function for recovering the log contents when mounting a |
@@ -221,7 +221,7 @@ do { \ | |||
221 | * blocks. In the third and final pass, we replay any un-revoked blocks | 221 | * blocks. In the third and final pass, we replay any un-revoked blocks |
222 | * in the log. | 222 | * in the log. |
223 | */ | 223 | */ |
224 | int journal_recover(journal_t *journal) | 224 | int jbd2_journal_recover(journal_t *journal) |
225 | { | 225 | { |
226 | int err; | 226 | int err; |
227 | journal_superblock_t * sb; | 227 | journal_superblock_t * sb; |
@@ -260,13 +260,13 @@ int journal_recover(journal_t *journal) | |||
260 | * any existing commit records in the log. */ | 260 | * any existing commit records in the log. */ |
261 | journal->j_transaction_sequence = ++info.end_transaction; | 261 | journal->j_transaction_sequence = ++info.end_transaction; |
262 | 262 | ||
263 | journal_clear_revoke(journal); | 263 | jbd2_journal_clear_revoke(journal); |
264 | sync_blockdev(journal->j_fs_dev); | 264 | sync_blockdev(journal->j_fs_dev); |
265 | return err; | 265 | return err; |
266 | } | 266 | } |
267 | 267 | ||
268 | /** | 268 | /** |
269 | * journal_skip_recovery - Start journal and wipe exiting records | 269 | * jbd2_journal_skip_recovery - Start journal and wipe exiting records |
270 | * @journal: journal to startup | 270 | * @journal: journal to startup |
271 | * | 271 | * |
272 | * Locate any valid recovery information from the journal and set up the | 272 | * Locate any valid recovery information from the journal and set up the |
@@ -278,7 +278,7 @@ int journal_recover(journal_t *journal) | |||
278 | * much recovery information is being erased, and to let us initialise | 278 | * much recovery information is being erased, and to let us initialise |
279 | * the journal transaction sequence numbers to the next unused ID. | 279 | * the journal transaction sequence numbers to the next unused ID. |
280 | */ | 280 | */ |
281 | int journal_skip_recovery(journal_t *journal) | 281 | int jbd2_journal_skip_recovery(journal_t *journal) |
282 | { | 282 | { |
283 | int err; | 283 | int err; |
284 | journal_superblock_t * sb; | 284 | journal_superblock_t * sb; |
@@ -387,7 +387,7 @@ static int do_one_pass(journal_t *journal, | |||
387 | 387 | ||
388 | tmp = (journal_header_t *)bh->b_data; | 388 | tmp = (journal_header_t *)bh->b_data; |
389 | 389 | ||
390 | if (tmp->h_magic != cpu_to_be32(JFS_MAGIC_NUMBER)) { | 390 | if (tmp->h_magic != cpu_to_be32(JBD2_MAGIC_NUMBER)) { |
391 | brelse(bh); | 391 | brelse(bh); |
392 | break; | 392 | break; |
393 | } | 393 | } |
@@ -407,7 +407,7 @@ static int do_one_pass(journal_t *journal, | |||
407 | * to do with it? That depends on the pass... */ | 407 | * to do with it? That depends on the pass... */ |
408 | 408 | ||
409 | switch(blocktype) { | 409 | switch(blocktype) { |
410 | case JFS_DESCRIPTOR_BLOCK: | 410 | case JBD2_DESCRIPTOR_BLOCK: |
411 | /* If it is a valid descriptor block, replay it | 411 | /* If it is a valid descriptor block, replay it |
412 | * in pass REPLAY; otherwise, just skip over the | 412 | * in pass REPLAY; otherwise, just skip over the |
413 | * blocks it describes. */ | 413 | * blocks it describes. */ |
@@ -451,7 +451,7 @@ static int do_one_pass(journal_t *journal, | |||
451 | /* If the block has been | 451 | /* If the block has been |
452 | * revoked, then we're all done | 452 | * revoked, then we're all done |
453 | * here. */ | 453 | * here. */ |
454 | if (journal_test_revoke | 454 | if (jbd2_journal_test_revoke |
455 | (journal, blocknr, | 455 | (journal, blocknr, |
456 | next_commit_ID)) { | 456 | next_commit_ID)) { |
457 | brelse(obh); | 457 | brelse(obh); |
@@ -477,9 +477,9 @@ static int do_one_pass(journal_t *journal, | |||
477 | lock_buffer(nbh); | 477 | lock_buffer(nbh); |
478 | memcpy(nbh->b_data, obh->b_data, | 478 | memcpy(nbh->b_data, obh->b_data, |
479 | journal->j_blocksize); | 479 | journal->j_blocksize); |
480 | if (flags & JFS_FLAG_ESCAPE) { | 480 | if (flags & JBD2_FLAG_ESCAPE) { |
481 | *((__be32 *)bh->b_data) = | 481 | *((__be32 *)bh->b_data) = |
482 | cpu_to_be32(JFS_MAGIC_NUMBER); | 482 | cpu_to_be32(JBD2_MAGIC_NUMBER); |
483 | } | 483 | } |
484 | 484 | ||
485 | BUFFER_TRACE(nbh, "marking dirty"); | 485 | BUFFER_TRACE(nbh, "marking dirty"); |
@@ -495,17 +495,17 @@ static int do_one_pass(journal_t *journal, | |||
495 | 495 | ||
496 | skip_write: | 496 | skip_write: |
497 | tagp += sizeof(journal_block_tag_t); | 497 | tagp += sizeof(journal_block_tag_t); |
498 | if (!(flags & JFS_FLAG_SAME_UUID)) | 498 | if (!(flags & JBD2_FLAG_SAME_UUID)) |
499 | tagp += 16; | 499 | tagp += 16; |
500 | 500 | ||
501 | if (flags & JFS_FLAG_LAST_TAG) | 501 | if (flags & JBD2_FLAG_LAST_TAG) |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | 504 | ||
505 | brelse(bh); | 505 | brelse(bh); |
506 | continue; | 506 | continue; |
507 | 507 | ||
508 | case JFS_COMMIT_BLOCK: | 508 | case JBD2_COMMIT_BLOCK: |
509 | /* Found an expected commit block: not much to | 509 | /* Found an expected commit block: not much to |
510 | * do other than move on to the next sequence | 510 | * do other than move on to the next sequence |
511 | * number. */ | 511 | * number. */ |
@@ -513,7 +513,7 @@ static int do_one_pass(journal_t *journal, | |||
513 | next_commit_ID++; | 513 | next_commit_ID++; |
514 | continue; | 514 | continue; |
515 | 515 | ||
516 | case JFS_REVOKE_BLOCK: | 516 | case JBD2_REVOKE_BLOCK: |
517 | /* If we aren't in the REVOKE pass, then we can | 517 | /* If we aren't in the REVOKE pass, then we can |
518 | * just skip over this block. */ | 518 | * just skip over this block. */ |
519 | if (pass != PASS_REVOKE) { | 519 | if (pass != PASS_REVOKE) { |
@@ -570,11 +570,11 @@ static int do_one_pass(journal_t *journal, | |||
570 | static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, | 570 | static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, |
571 | tid_t sequence, struct recovery_info *info) | 571 | tid_t sequence, struct recovery_info *info) |
572 | { | 572 | { |
573 | journal_revoke_header_t *header; | 573 | jbd2_journal_revoke_header_t *header; |
574 | int offset, max; | 574 | int offset, max; |
575 | 575 | ||
576 | header = (journal_revoke_header_t *) bh->b_data; | 576 | header = (jbd2_journal_revoke_header_t *) bh->b_data; |
577 | offset = sizeof(journal_revoke_header_t); | 577 | offset = sizeof(jbd2_journal_revoke_header_t); |
578 | max = be32_to_cpu(header->r_count); | 578 | max = be32_to_cpu(header->r_count); |
579 | 579 | ||
580 | while (offset < max) { | 580 | while (offset < max) { |
@@ -583,7 +583,7 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, | |||
583 | 583 | ||
584 | blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset))); | 584 | blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset))); |
585 | offset += 4; | 585 | offset += 4; |
586 | err = journal_set_revoke(journal, blocknr, sequence); | 586 | err = jbd2_journal_set_revoke(journal, blocknr, sequence); |
587 | if (err) | 587 | if (err) |
588 | return err; | 588 | return err; |
589 | ++info->nr_revokes; | 589 | ++info->nr_revokes; |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index c532429d8d9b..2fccddc7acad 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #else | 62 | #else |
63 | #include <linux/time.h> | 63 | #include <linux/time.h> |
64 | #include <linux/fs.h> | 64 | #include <linux/fs.h> |
65 | #include <linux/jbd.h> | 65 | #include <linux/jbd2.h> |
66 | #include <linux/errno.h> | 66 | #include <linux/errno.h> |
67 | #include <linux/slab.h> | 67 | #include <linux/slab.h> |
68 | #include <linux/list.h> | 68 | #include <linux/list.h> |
@@ -70,14 +70,14 @@ | |||
70 | #include <linux/init.h> | 70 | #include <linux/init.h> |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | static kmem_cache_t *revoke_record_cache; | 73 | static kmem_cache_t *jbd2_revoke_record_cache; |
74 | static kmem_cache_t *revoke_table_cache; | 74 | static kmem_cache_t *jbd2_revoke_table_cache; |
75 | 75 | ||
76 | /* Each revoke record represents one single revoked block. During | 76 | /* Each revoke record represents one single revoked block. During |
77 | journal replay, this involves recording the transaction ID of the | 77 | journal replay, this involves recording the transaction ID of the |
78 | last transaction to revoke this block. */ | 78 | last transaction to revoke this block. */ |
79 | 79 | ||
80 | struct jbd_revoke_record_s | 80 | struct jbd2_revoke_record_s |
81 | { | 81 | { |
82 | struct list_head hash; | 82 | struct list_head hash; |
83 | tid_t sequence; /* Used for recovery only */ | 83 | tid_t sequence; /* Used for recovery only */ |
@@ -86,7 +86,7 @@ struct jbd_revoke_record_s | |||
86 | 86 | ||
87 | 87 | ||
88 | /* The revoke table is just a simple hash table of revoke records. */ | 88 | /* The revoke table is just a simple hash table of revoke records. */ |
89 | struct jbd_revoke_table_s | 89 | struct jbd2_revoke_table_s |
90 | { | 90 | { |
91 | /* It is conceivable that we might want a larger hash table | 91 | /* It is conceivable that we might want a larger hash table |
92 | * for recovery. Must be a power of two. */ | 92 | * for recovery. Must be a power of two. */ |
@@ -99,7 +99,7 @@ struct jbd_revoke_table_s | |||
99 | #ifdef __KERNEL__ | 99 | #ifdef __KERNEL__ |
100 | static void write_one_revoke_record(journal_t *, transaction_t *, | 100 | static void write_one_revoke_record(journal_t *, transaction_t *, |
101 | struct journal_head **, int *, | 101 | struct journal_head **, int *, |
102 | struct jbd_revoke_record_s *); | 102 | struct jbd2_revoke_record_s *); |
103 | static void flush_descriptor(journal_t *, struct journal_head *, int); | 103 | static void flush_descriptor(journal_t *, struct journal_head *, int); |
104 | #endif | 104 | #endif |
105 | 105 | ||
@@ -108,7 +108,7 @@ static void flush_descriptor(journal_t *, struct journal_head *, int); | |||
108 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | 108 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ |
109 | static inline int hash(journal_t *journal, unsigned long block) | 109 | static inline int hash(journal_t *journal, unsigned long block) |
110 | { | 110 | { |
111 | struct jbd_revoke_table_s *table = journal->j_revoke; | 111 | struct jbd2_revoke_table_s *table = journal->j_revoke; |
112 | int hash_shift = table->hash_shift; | 112 | int hash_shift = table->hash_shift; |
113 | 113 | ||
114 | return ((block << (hash_shift - 6)) ^ | 114 | return ((block << (hash_shift - 6)) ^ |
@@ -120,10 +120,10 @@ static int insert_revoke_hash(journal_t *journal, unsigned long blocknr, | |||
120 | tid_t seq) | 120 | tid_t seq) |
121 | { | 121 | { |
122 | struct list_head *hash_list; | 122 | struct list_head *hash_list; |
123 | struct jbd_revoke_record_s *record; | 123 | struct jbd2_revoke_record_s *record; |
124 | 124 | ||
125 | repeat: | 125 | repeat: |
126 | record = kmem_cache_alloc(revoke_record_cache, GFP_NOFS); | 126 | record = kmem_cache_alloc(jbd2_revoke_record_cache, GFP_NOFS); |
127 | if (!record) | 127 | if (!record) |
128 | goto oom; | 128 | goto oom; |
129 | 129 | ||
@@ -145,57 +145,57 @@ oom: | |||
145 | 145 | ||
146 | /* Find a revoke record in the journal's hash table. */ | 146 | /* Find a revoke record in the journal's hash table. */ |
147 | 147 | ||
148 | static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal, | 148 | static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal, |
149 | unsigned long blocknr) | 149 | unsigned long blocknr) |
150 | { | 150 | { |
151 | struct list_head *hash_list; | 151 | struct list_head *hash_list; |
152 | struct jbd_revoke_record_s *record; | 152 | struct jbd2_revoke_record_s *record; |
153 | 153 | ||
154 | hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; | 154 | hash_list = &journal->j_revoke->hash_table[hash(journal, blocknr)]; |
155 | 155 | ||
156 | spin_lock(&journal->j_revoke_lock); | 156 | spin_lock(&journal->j_revoke_lock); |
157 | record = (struct jbd_revoke_record_s *) hash_list->next; | 157 | record = (struct jbd2_revoke_record_s *) hash_list->next; |
158 | while (&(record->hash) != hash_list) { | 158 | while (&(record->hash) != hash_list) { |
159 | if (record->blocknr == blocknr) { | 159 | if (record->blocknr == blocknr) { |
160 | spin_unlock(&journal->j_revoke_lock); | 160 | spin_unlock(&journal->j_revoke_lock); |
161 | return record; | 161 | return record; |
162 | } | 162 | } |
163 | record = (struct jbd_revoke_record_s *) record->hash.next; | 163 | record = (struct jbd2_revoke_record_s *) record->hash.next; |
164 | } | 164 | } |
165 | spin_unlock(&journal->j_revoke_lock); | 165 | spin_unlock(&journal->j_revoke_lock); |
166 | return NULL; | 166 | return NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | int __init journal_init_revoke_caches(void) | 169 | int __init jbd2_journal_init_revoke_caches(void) |
170 | { | 170 | { |
171 | revoke_record_cache = kmem_cache_create("revoke_record", | 171 | jbd2_revoke_record_cache = kmem_cache_create("revoke_record", |
172 | sizeof(struct jbd_revoke_record_s), | 172 | sizeof(struct jbd2_revoke_record_s), |
173 | 0, SLAB_HWCACHE_ALIGN, NULL, NULL); | 173 | 0, SLAB_HWCACHE_ALIGN, NULL, NULL); |
174 | if (revoke_record_cache == 0) | 174 | if (jbd2_revoke_record_cache == 0) |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
176 | 176 | ||
177 | revoke_table_cache = kmem_cache_create("revoke_table", | 177 | jbd2_revoke_table_cache = kmem_cache_create("revoke_table", |
178 | sizeof(struct jbd_revoke_table_s), | 178 | sizeof(struct jbd2_revoke_table_s), |
179 | 0, 0, NULL, NULL); | 179 | 0, 0, NULL, NULL); |
180 | if (revoke_table_cache == 0) { | 180 | if (jbd2_revoke_table_cache == 0) { |
181 | kmem_cache_destroy(revoke_record_cache); | 181 | kmem_cache_destroy(jbd2_revoke_record_cache); |
182 | revoke_record_cache = NULL; | 182 | jbd2_revoke_record_cache = NULL; |
183 | return -ENOMEM; | 183 | return -ENOMEM; |
184 | } | 184 | } |
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | void journal_destroy_revoke_caches(void) | 188 | void jbd2_journal_destroy_revoke_caches(void) |
189 | { | 189 | { |
190 | kmem_cache_destroy(revoke_record_cache); | 190 | kmem_cache_destroy(jbd2_revoke_record_cache); |
191 | revoke_record_cache = NULL; | 191 | jbd2_revoke_record_cache = NULL; |
192 | kmem_cache_destroy(revoke_table_cache); | 192 | kmem_cache_destroy(jbd2_revoke_table_cache); |
193 | revoke_table_cache = NULL; | 193 | jbd2_revoke_table_cache = NULL; |
194 | } | 194 | } |
195 | 195 | ||
196 | /* Initialise the revoke table for a given journal to a given size. */ | 196 | /* Initialise the revoke table for a given journal to a given size. */ |
197 | 197 | ||
198 | int journal_init_revoke(journal_t *journal, int hash_size) | 198 | int jbd2_journal_init_revoke(journal_t *journal, int hash_size) |
199 | { | 199 | { |
200 | int shift, tmp; | 200 | int shift, tmp; |
201 | 201 | ||
@@ -206,7 +206,7 @@ int journal_init_revoke(journal_t *journal, int hash_size) | |||
206 | while((tmp >>= 1UL) != 0UL) | 206 | while((tmp >>= 1UL) != 0UL) |
207 | shift++; | 207 | shift++; |
208 | 208 | ||
209 | journal->j_revoke_table[0] = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); | 209 | journal->j_revoke_table[0] = kmem_cache_alloc(jbd2_revoke_table_cache, GFP_KERNEL); |
210 | if (!journal->j_revoke_table[0]) | 210 | if (!journal->j_revoke_table[0]) |
211 | return -ENOMEM; | 211 | return -ENOMEM; |
212 | journal->j_revoke = journal->j_revoke_table[0]; | 212 | journal->j_revoke = journal->j_revoke_table[0]; |
@@ -221,7 +221,7 @@ int journal_init_revoke(journal_t *journal, int hash_size) | |||
221 | journal->j_revoke->hash_table = | 221 | journal->j_revoke->hash_table = |
222 | kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL); | 222 | kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL); |
223 | if (!journal->j_revoke->hash_table) { | 223 | if (!journal->j_revoke->hash_table) { |
224 | kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]); | 224 | kmem_cache_free(jbd2_revoke_table_cache, journal->j_revoke_table[0]); |
225 | journal->j_revoke = NULL; | 225 | journal->j_revoke = NULL; |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
227 | } | 227 | } |
@@ -229,10 +229,10 @@ int journal_init_revoke(journal_t *journal, int hash_size) | |||
229 | for (tmp = 0; tmp < hash_size; tmp++) | 229 | for (tmp = 0; tmp < hash_size; tmp++) |
230 | INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); | 230 | INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); |
231 | 231 | ||
232 | journal->j_revoke_table[1] = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); | 232 | journal->j_revoke_table[1] = kmem_cache_alloc(jbd2_revoke_table_cache, GFP_KERNEL); |
233 | if (!journal->j_revoke_table[1]) { | 233 | if (!journal->j_revoke_table[1]) { |
234 | kfree(journal->j_revoke_table[0]->hash_table); | 234 | kfree(journal->j_revoke_table[0]->hash_table); |
235 | kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]); | 235 | kmem_cache_free(jbd2_revoke_table_cache, journal->j_revoke_table[0]); |
236 | return -ENOMEM; | 236 | return -ENOMEM; |
237 | } | 237 | } |
238 | 238 | ||
@@ -249,8 +249,8 @@ int journal_init_revoke(journal_t *journal, int hash_size) | |||
249 | kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL); | 249 | kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL); |
250 | if (!journal->j_revoke->hash_table) { | 250 | if (!journal->j_revoke->hash_table) { |
251 | kfree(journal->j_revoke_table[0]->hash_table); | 251 | kfree(journal->j_revoke_table[0]->hash_table); |
252 | kmem_cache_free(revoke_table_cache, journal->j_revoke_table[0]); | 252 | kmem_cache_free(jbd2_revoke_table_cache, journal->j_revoke_table[0]); |
253 | kmem_cache_free(revoke_table_cache, journal->j_revoke_table[1]); | 253 | kmem_cache_free(jbd2_revoke_table_cache, journal->j_revoke_table[1]); |
254 | journal->j_revoke = NULL; | 254 | journal->j_revoke = NULL; |
255 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | } | 256 | } |
@@ -265,9 +265,9 @@ int journal_init_revoke(journal_t *journal, int hash_size) | |||
265 | 265 | ||
266 | /* Destoy a journal's revoke table. The table must already be empty! */ | 266 | /* Destoy a journal's revoke table. The table must already be empty! */ |
267 | 267 | ||
268 | void journal_destroy_revoke(journal_t *journal) | 268 | void jbd2_journal_destroy_revoke(journal_t *journal) |
269 | { | 269 | { |
270 | struct jbd_revoke_table_s *table; | 270 | struct jbd2_revoke_table_s *table; |
271 | struct list_head *hash_list; | 271 | struct list_head *hash_list; |
272 | int i; | 272 | int i; |
273 | 273 | ||
@@ -281,7 +281,7 @@ void journal_destroy_revoke(journal_t *journal) | |||
281 | } | 281 | } |
282 | 282 | ||
283 | kfree(table->hash_table); | 283 | kfree(table->hash_table); |
284 | kmem_cache_free(revoke_table_cache, table); | 284 | kmem_cache_free(jbd2_revoke_table_cache, table); |
285 | journal->j_revoke = NULL; | 285 | journal->j_revoke = NULL; |
286 | 286 | ||
287 | table = journal->j_revoke_table[1]; | 287 | table = journal->j_revoke_table[1]; |
@@ -294,7 +294,7 @@ void journal_destroy_revoke(journal_t *journal) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | kfree(table->hash_table); | 296 | kfree(table->hash_table); |
297 | kmem_cache_free(revoke_table_cache, table); | 297 | kmem_cache_free(jbd2_revoke_table_cache, table); |
298 | journal->j_revoke = NULL; | 298 | journal->j_revoke = NULL; |
299 | } | 299 | } |
300 | 300 | ||
@@ -302,7 +302,7 @@ void journal_destroy_revoke(journal_t *journal) | |||
302 | #ifdef __KERNEL__ | 302 | #ifdef __KERNEL__ |
303 | 303 | ||
304 | /* | 304 | /* |
305 | * journal_revoke: revoke a given buffer_head from the journal. This | 305 | * jbd2_journal_revoke: revoke a given buffer_head from the journal. This |
306 | * prevents the block from being replayed during recovery if we take a | 306 | * prevents the block from being replayed during recovery if we take a |
307 | * crash after this current transaction commits. Any subsequent | 307 | * crash after this current transaction commits. Any subsequent |
308 | * metadata writes of the buffer in this transaction cancel the | 308 | * metadata writes of the buffer in this transaction cancel the |
@@ -314,18 +314,18 @@ void journal_destroy_revoke(journal_t *journal) | |||
314 | * revoke before clearing the block bitmap when we are deleting | 314 | * revoke before clearing the block bitmap when we are deleting |
315 | * metadata. | 315 | * metadata. |
316 | * | 316 | * |
317 | * Revoke performs a journal_forget on any buffer_head passed in as a | 317 | * Revoke performs a jbd2_journal_forget on any buffer_head passed in as a |
318 | * parameter, but does _not_ forget the buffer_head if the bh was only | 318 | * parameter, but does _not_ forget the buffer_head if the bh was only |
319 | * found implicitly. | 319 | * found implicitly. |
320 | * | 320 | * |
321 | * bh_in may not be a journalled buffer - it may have come off | 321 | * bh_in may not be a journalled buffer - it may have come off |
322 | * the hash tables without an attached journal_head. | 322 | * the hash tables without an attached journal_head. |
323 | * | 323 | * |
324 | * If bh_in is non-zero, journal_revoke() will decrement its b_count | 324 | * If bh_in is non-zero, jbd2_journal_revoke() will decrement its b_count |
325 | * by one. | 325 | * by one. |
326 | */ | 326 | */ |
327 | 327 | ||
328 | int journal_revoke(handle_t *handle, unsigned long blocknr, | 328 | int jbd2_journal_revoke(handle_t *handle, unsigned long blocknr, |
329 | struct buffer_head *bh_in) | 329 | struct buffer_head *bh_in) |
330 | { | 330 | { |
331 | struct buffer_head *bh = NULL; | 331 | struct buffer_head *bh = NULL; |
@@ -338,7 +338,7 @@ int journal_revoke(handle_t *handle, unsigned long blocknr, | |||
338 | BUFFER_TRACE(bh_in, "enter"); | 338 | BUFFER_TRACE(bh_in, "enter"); |
339 | 339 | ||
340 | journal = handle->h_transaction->t_journal; | 340 | journal = handle->h_transaction->t_journal; |
341 | if (!journal_set_features(journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)){ | 341 | if (!jbd2_journal_set_features(journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)){ |
342 | J_ASSERT (!"Cannot set revoke feature!"); | 342 | J_ASSERT (!"Cannot set revoke feature!"); |
343 | return -EINVAL; | 343 | return -EINVAL; |
344 | } | 344 | } |
@@ -386,8 +386,8 @@ int journal_revoke(handle_t *handle, unsigned long blocknr, | |||
386 | set_buffer_revoked(bh); | 386 | set_buffer_revoked(bh); |
387 | set_buffer_revokevalid(bh); | 387 | set_buffer_revokevalid(bh); |
388 | if (bh_in) { | 388 | if (bh_in) { |
389 | BUFFER_TRACE(bh_in, "call journal_forget"); | 389 | BUFFER_TRACE(bh_in, "call jbd2_journal_forget"); |
390 | journal_forget(handle, bh_in); | 390 | jbd2_journal_forget(handle, bh_in); |
391 | } else { | 391 | } else { |
392 | BUFFER_TRACE(bh, "call brelse"); | 392 | BUFFER_TRACE(bh, "call brelse"); |
393 | __brelse(bh); | 393 | __brelse(bh); |
@@ -403,7 +403,7 @@ int journal_revoke(handle_t *handle, unsigned long blocknr, | |||
403 | 403 | ||
404 | /* | 404 | /* |
405 | * Cancel an outstanding revoke. For use only internally by the | 405 | * Cancel an outstanding revoke. For use only internally by the |
406 | * journaling code (called from journal_get_write_access). | 406 | * journaling code (called from jbd2_journal_get_write_access). |
407 | * | 407 | * |
408 | * We trust buffer_revoked() on the buffer if the buffer is already | 408 | * We trust buffer_revoked() on the buffer if the buffer is already |
409 | * being journaled: if there is no revoke pending on the buffer, then we | 409 | * being journaled: if there is no revoke pending on the buffer, then we |
@@ -418,9 +418,9 @@ int journal_revoke(handle_t *handle, unsigned long blocknr, | |||
418 | * | 418 | * |
419 | * The caller must have the journal locked. | 419 | * The caller must have the journal locked. |
420 | */ | 420 | */ |
421 | int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | 421 | int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh) |
422 | { | 422 | { |
423 | struct jbd_revoke_record_s *record; | 423 | struct jbd2_revoke_record_s *record; |
424 | journal_t *journal = handle->h_transaction->t_journal; | 424 | journal_t *journal = handle->h_transaction->t_journal; |
425 | int need_cancel; | 425 | int need_cancel; |
426 | int did_revoke = 0; /* akpm: debug */ | 426 | int did_revoke = 0; /* akpm: debug */ |
@@ -447,7 +447,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | |||
447 | spin_lock(&journal->j_revoke_lock); | 447 | spin_lock(&journal->j_revoke_lock); |
448 | list_del(&record->hash); | 448 | list_del(&record->hash); |
449 | spin_unlock(&journal->j_revoke_lock); | 449 | spin_unlock(&journal->j_revoke_lock); |
450 | kmem_cache_free(revoke_record_cache, record); | 450 | kmem_cache_free(jbd2_revoke_record_cache, record); |
451 | did_revoke = 1; | 451 | did_revoke = 1; |
452 | } | 452 | } |
453 | } | 453 | } |
@@ -478,7 +478,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | |||
478 | * we do not want to suspend any processing until all revokes are | 478 | * we do not want to suspend any processing until all revokes are |
479 | * written -bzzz | 479 | * written -bzzz |
480 | */ | 480 | */ |
481 | void journal_switch_revoke_table(journal_t *journal) | 481 | void jbd2_journal_switch_revoke_table(journal_t *journal) |
482 | { | 482 | { |
483 | int i; | 483 | int i; |
484 | 484 | ||
@@ -498,12 +498,12 @@ void journal_switch_revoke_table(journal_t *journal) | |||
498 | * Called with the journal lock held. | 498 | * Called with the journal lock held. |
499 | */ | 499 | */ |
500 | 500 | ||
501 | void journal_write_revoke_records(journal_t *journal, | 501 | void jbd2_journal_write_revoke_records(journal_t *journal, |
502 | transaction_t *transaction) | 502 | transaction_t *transaction) |
503 | { | 503 | { |
504 | struct journal_head *descriptor; | 504 | struct journal_head *descriptor; |
505 | struct jbd_revoke_record_s *record; | 505 | struct jbd2_revoke_record_s *record; |
506 | struct jbd_revoke_table_s *revoke; | 506 | struct jbd2_revoke_table_s *revoke; |
507 | struct list_head *hash_list; | 507 | struct list_head *hash_list; |
508 | int i, offset, count; | 508 | int i, offset, count; |
509 | 509 | ||
@@ -519,14 +519,14 @@ void journal_write_revoke_records(journal_t *journal, | |||
519 | hash_list = &revoke->hash_table[i]; | 519 | hash_list = &revoke->hash_table[i]; |
520 | 520 | ||
521 | while (!list_empty(hash_list)) { | 521 | while (!list_empty(hash_list)) { |
522 | record = (struct jbd_revoke_record_s *) | 522 | record = (struct jbd2_revoke_record_s *) |
523 | hash_list->next; | 523 | hash_list->next; |
524 | write_one_revoke_record(journal, transaction, | 524 | write_one_revoke_record(journal, transaction, |
525 | &descriptor, &offset, | 525 | &descriptor, &offset, |
526 | record); | 526 | record); |
527 | count++; | 527 | count++; |
528 | list_del(&record->hash); | 528 | list_del(&record->hash); |
529 | kmem_cache_free(revoke_record_cache, record); | 529 | kmem_cache_free(jbd2_revoke_record_cache, record); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | if (descriptor) | 532 | if (descriptor) |
@@ -543,7 +543,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
543 | transaction_t *transaction, | 543 | transaction_t *transaction, |
544 | struct journal_head **descriptorp, | 544 | struct journal_head **descriptorp, |
545 | int *offsetp, | 545 | int *offsetp, |
546 | struct jbd_revoke_record_s *record) | 546 | struct jbd2_revoke_record_s *record) |
547 | { | 547 | { |
548 | struct journal_head *descriptor; | 548 | struct journal_head *descriptor; |
549 | int offset; | 549 | int offset; |
@@ -551,7 +551,7 @@ static void write_one_revoke_record(journal_t *journal, | |||
551 | 551 | ||
552 | /* If we are already aborting, this all becomes a noop. We | 552 | /* If we are already aborting, this all becomes a noop. We |
553 | still need to go round the loop in | 553 | still need to go round the loop in |
554 | journal_write_revoke_records in order to free all of the | 554 | jbd2_journal_write_revoke_records in order to free all of the |
555 | revoke records: only the IO to the journal is omitted. */ | 555 | revoke records: only the IO to the journal is omitted. */ |
556 | if (is_journal_aborted(journal)) | 556 | if (is_journal_aborted(journal)) |
557 | return; | 557 | return; |
@@ -568,19 +568,19 @@ static void write_one_revoke_record(journal_t *journal, | |||
568 | } | 568 | } |
569 | 569 | ||
570 | if (!descriptor) { | 570 | if (!descriptor) { |
571 | descriptor = journal_get_descriptor_buffer(journal); | 571 | descriptor = jbd2_journal_get_descriptor_buffer(journal); |
572 | if (!descriptor) | 572 | if (!descriptor) |
573 | return; | 573 | return; |
574 | header = (journal_header_t *) &jh2bh(descriptor)->b_data[0]; | 574 | header = (journal_header_t *) &jh2bh(descriptor)->b_data[0]; |
575 | header->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER); | 575 | header->h_magic = cpu_to_be32(JBD2_MAGIC_NUMBER); |
576 | header->h_blocktype = cpu_to_be32(JFS_REVOKE_BLOCK); | 576 | header->h_blocktype = cpu_to_be32(JBD2_REVOKE_BLOCK); |
577 | header->h_sequence = cpu_to_be32(transaction->t_tid); | 577 | header->h_sequence = cpu_to_be32(transaction->t_tid); |
578 | 578 | ||
579 | /* Record it so that we can wait for IO completion later */ | 579 | /* Record it so that we can wait for IO completion later */ |
580 | JBUFFER_TRACE(descriptor, "file as BJ_LogCtl"); | 580 | JBUFFER_TRACE(descriptor, "file as BJ_LogCtl"); |
581 | journal_file_buffer(descriptor, transaction, BJ_LogCtl); | 581 | jbd2_journal_file_buffer(descriptor, transaction, BJ_LogCtl); |
582 | 582 | ||
583 | offset = sizeof(journal_revoke_header_t); | 583 | offset = sizeof(jbd2_journal_revoke_header_t); |
584 | *descriptorp = descriptor; | 584 | *descriptorp = descriptor; |
585 | } | 585 | } |
586 | 586 | ||
@@ -601,7 +601,7 @@ static void flush_descriptor(journal_t *journal, | |||
601 | struct journal_head *descriptor, | 601 | struct journal_head *descriptor, |
602 | int offset) | 602 | int offset) |
603 | { | 603 | { |
604 | journal_revoke_header_t *header; | 604 | jbd2_journal_revoke_header_t *header; |
605 | struct buffer_head *bh = jh2bh(descriptor); | 605 | struct buffer_head *bh = jh2bh(descriptor); |
606 | 606 | ||
607 | if (is_journal_aborted(journal)) { | 607 | if (is_journal_aborted(journal)) { |
@@ -609,7 +609,7 @@ static void flush_descriptor(journal_t *journal, | |||
609 | return; | 609 | return; |
610 | } | 610 | } |
611 | 611 | ||
612 | header = (journal_revoke_header_t *) jh2bh(descriptor)->b_data; | 612 | header = (jbd2_journal_revoke_header_t *) jh2bh(descriptor)->b_data; |
613 | header->r_count = cpu_to_be32(offset); | 613 | header->r_count = cpu_to_be32(offset); |
614 | set_buffer_jwrite(bh); | 614 | set_buffer_jwrite(bh); |
615 | BUFFER_TRACE(bh, "write"); | 615 | BUFFER_TRACE(bh, "write"); |
@@ -640,11 +640,11 @@ static void flush_descriptor(journal_t *journal, | |||
640 | * single block. | 640 | * single block. |
641 | */ | 641 | */ |
642 | 642 | ||
643 | int journal_set_revoke(journal_t *journal, | 643 | int jbd2_journal_set_revoke(journal_t *journal, |
644 | unsigned long blocknr, | 644 | unsigned long blocknr, |
645 | tid_t sequence) | 645 | tid_t sequence) |
646 | { | 646 | { |
647 | struct jbd_revoke_record_s *record; | 647 | struct jbd2_revoke_record_s *record; |
648 | 648 | ||
649 | record = find_revoke_record(journal, blocknr); | 649 | record = find_revoke_record(journal, blocknr); |
650 | if (record) { | 650 | if (record) { |
@@ -664,11 +664,11 @@ int journal_set_revoke(journal_t *journal, | |||
664 | * ones, but later transactions still need replayed. | 664 | * ones, but later transactions still need replayed. |
665 | */ | 665 | */ |
666 | 666 | ||
667 | int journal_test_revoke(journal_t *journal, | 667 | int jbd2_journal_test_revoke(journal_t *journal, |
668 | unsigned long blocknr, | 668 | unsigned long blocknr, |
669 | tid_t sequence) | 669 | tid_t sequence) |
670 | { | 670 | { |
671 | struct jbd_revoke_record_s *record; | 671 | struct jbd2_revoke_record_s *record; |
672 | 672 | ||
673 | record = find_revoke_record(journal, blocknr); | 673 | record = find_revoke_record(journal, blocknr); |
674 | if (!record) | 674 | if (!record) |
@@ -683,21 +683,21 @@ int journal_test_revoke(journal_t *journal, | |||
683 | * that it can be reused by the running filesystem. | 683 | * that it can be reused by the running filesystem. |
684 | */ | 684 | */ |
685 | 685 | ||
686 | void journal_clear_revoke(journal_t *journal) | 686 | void jbd2_journal_clear_revoke(journal_t *journal) |
687 | { | 687 | { |
688 | int i; | 688 | int i; |
689 | struct list_head *hash_list; | 689 | struct list_head *hash_list; |
690 | struct jbd_revoke_record_s *record; | 690 | struct jbd2_revoke_record_s *record; |
691 | struct jbd_revoke_table_s *revoke; | 691 | struct jbd2_revoke_table_s *revoke; |
692 | 692 | ||
693 | revoke = journal->j_revoke; | 693 | revoke = journal->j_revoke; |
694 | 694 | ||
695 | for (i = 0; i < revoke->hash_size; i++) { | 695 | for (i = 0; i < revoke->hash_size; i++) { |
696 | hash_list = &revoke->hash_table[i]; | 696 | hash_list = &revoke->hash_table[i]; |
697 | while (!list_empty(hash_list)) { | 697 | while (!list_empty(hash_list)) { |
698 | record = (struct jbd_revoke_record_s*) hash_list->next; | 698 | record = (struct jbd2_revoke_record_s*) hash_list->next; |
699 | list_del(&record->hash); | 699 | list_del(&record->hash); |
700 | kmem_cache_free(revoke_record_cache, record); | 700 | kmem_cache_free(jbd2_revoke_record_cache, record); |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } | 703 | } |
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index e1b3c8af4d17..149957bef907 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/time.h> | 20 | #include <linux/time.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/jbd.h> | 22 | #include <linux/jbd2.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * get_transaction: obtain a new transaction_t object. | 31 | * jbd2_get_transaction: obtain a new transaction_t object. |
32 | * | 32 | * |
33 | * Simply allocate and initialise a new transaction. Create it in | 33 | * Simply allocate and initialise a new transaction. Create it in |
34 | * RUNNING state and add it to the current journal (which should not | 34 | * RUNNING state and add it to the current journal (which should not |
@@ -44,7 +44,7 @@ | |||
44 | */ | 44 | */ |
45 | 45 | ||
46 | static transaction_t * | 46 | static transaction_t * |
47 | get_transaction(journal_t *journal, transaction_t *transaction) | 47 | jbd2_get_transaction(journal_t *journal, transaction_t *transaction) |
48 | { | 48 | { |
49 | transaction->t_journal = journal; | 49 | transaction->t_journal = journal; |
50 | transaction->t_state = T_RUNNING; | 50 | transaction->t_state = T_RUNNING; |
@@ -115,7 +115,7 @@ repeat: | |||
115 | spin_lock(&journal->j_state_lock); | 115 | spin_lock(&journal->j_state_lock); |
116 | repeat_locked: | 116 | repeat_locked: |
117 | if (is_journal_aborted(journal) || | 117 | if (is_journal_aborted(journal) || |
118 | (journal->j_errno != 0 && !(journal->j_flags & JFS_ACK_ERR))) { | 118 | (journal->j_errno != 0 && !(journal->j_flags & JBD2_ACK_ERR))) { |
119 | spin_unlock(&journal->j_state_lock); | 119 | spin_unlock(&journal->j_state_lock); |
120 | ret = -EROFS; | 120 | ret = -EROFS; |
121 | goto out; | 121 | goto out; |
@@ -134,7 +134,7 @@ repeat_locked: | |||
134 | spin_unlock(&journal->j_state_lock); | 134 | spin_unlock(&journal->j_state_lock); |
135 | goto alloc_transaction; | 135 | goto alloc_transaction; |
136 | } | 136 | } |
137 | get_transaction(journal, new_transaction); | 137 | jbd2_get_transaction(journal, new_transaction); |
138 | new_transaction = NULL; | 138 | new_transaction = NULL; |
139 | } | 139 | } |
140 | 140 | ||
@@ -175,7 +175,7 @@ repeat_locked: | |||
175 | spin_unlock(&transaction->t_handle_lock); | 175 | spin_unlock(&transaction->t_handle_lock); |
176 | prepare_to_wait(&journal->j_wait_transaction_locked, &wait, | 176 | prepare_to_wait(&journal->j_wait_transaction_locked, &wait, |
177 | TASK_UNINTERRUPTIBLE); | 177 | TASK_UNINTERRUPTIBLE); |
178 | __log_start_commit(journal, transaction->t_tid); | 178 | __jbd2_log_start_commit(journal, transaction->t_tid); |
179 | spin_unlock(&journal->j_state_lock); | 179 | spin_unlock(&journal->j_state_lock); |
180 | schedule(); | 180 | schedule(); |
181 | finish_wait(&journal->j_wait_transaction_locked, &wait); | 181 | finish_wait(&journal->j_wait_transaction_locked, &wait); |
@@ -205,12 +205,12 @@ repeat_locked: | |||
205 | * committing_transaction->t_outstanding_credits plus "enough" for | 205 | * committing_transaction->t_outstanding_credits plus "enough" for |
206 | * the log control blocks. | 206 | * the log control blocks. |
207 | * Also, this test is inconsitent with the matching one in | 207 | * Also, this test is inconsitent with the matching one in |
208 | * journal_extend(). | 208 | * jbd2_journal_extend(). |
209 | */ | 209 | */ |
210 | if (__log_space_left(journal) < jbd_space_needed(journal)) { | 210 | if (__jbd2_log_space_left(journal) < jbd_space_needed(journal)) { |
211 | jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); | 211 | jbd_debug(2, "Handle %p waiting for checkpoint...\n", handle); |
212 | spin_unlock(&transaction->t_handle_lock); | 212 | spin_unlock(&transaction->t_handle_lock); |
213 | __log_wait_for_space(journal); | 213 | __jbd2_log_wait_for_space(journal); |
214 | goto repeat_locked; | 214 | goto repeat_locked; |
215 | } | 215 | } |
216 | 216 | ||
@@ -223,7 +223,7 @@ repeat_locked: | |||
223 | transaction->t_handle_count++; | 223 | transaction->t_handle_count++; |
224 | jbd_debug(4, "Handle %p given %d credits (total %d, free %d)\n", | 224 | jbd_debug(4, "Handle %p given %d credits (total %d, free %d)\n", |
225 | handle, nblocks, transaction->t_outstanding_credits, | 225 | handle, nblocks, transaction->t_outstanding_credits, |
226 | __log_space_left(journal)); | 226 | __jbd2_log_space_left(journal)); |
227 | spin_unlock(&transaction->t_handle_lock); | 227 | spin_unlock(&transaction->t_handle_lock); |
228 | spin_unlock(&journal->j_state_lock); | 228 | spin_unlock(&journal->j_state_lock); |
229 | out: | 229 | out: |
@@ -246,7 +246,7 @@ static handle_t *new_handle(int nblocks) | |||
246 | } | 246 | } |
247 | 247 | ||
248 | /** | 248 | /** |
249 | * handle_t *journal_start() - Obtain a new handle. | 249 | * handle_t *jbd2_journal_start() - Obtain a new handle. |
250 | * @journal: Journal to start transaction on. | 250 | * @journal: Journal to start transaction on. |
251 | * @nblocks: number of block buffer we might modify | 251 | * @nblocks: number of block buffer we might modify |
252 | * | 252 | * |
@@ -259,7 +259,7 @@ static handle_t *new_handle(int nblocks) | |||
259 | * | 259 | * |
260 | * Return a pointer to a newly allocated handle, or NULL on failure | 260 | * Return a pointer to a newly allocated handle, or NULL on failure |
261 | */ | 261 | */ |
262 | handle_t *journal_start(journal_t *journal, int nblocks) | 262 | handle_t *jbd2_journal_start(journal_t *journal, int nblocks) |
263 | { | 263 | { |
264 | handle_t *handle = journal_current_handle(); | 264 | handle_t *handle = journal_current_handle(); |
265 | int err; | 265 | int err; |
@@ -289,7 +289,7 @@ handle_t *journal_start(journal_t *journal, int nblocks) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * int journal_extend() - extend buffer credits. | 292 | * int jbd2_journal_extend() - extend buffer credits. |
293 | * @handle: handle to 'extend' | 293 | * @handle: handle to 'extend' |
294 | * @nblocks: nr blocks to try to extend by. | 294 | * @nblocks: nr blocks to try to extend by. |
295 | * | 295 | * |
@@ -298,7 +298,7 @@ handle_t *journal_start(journal_t *journal, int nblocks) | |||
298 | * a credit for a number of buffer modications in advance, but can | 298 | * a credit for a number of buffer modications in advance, but can |
299 | * extend its credit if it needs more. | 299 | * extend its credit if it needs more. |
300 | * | 300 | * |
301 | * journal_extend tries to give the running handle more buffer credits. | 301 | * jbd2_journal_extend tries to give the running handle more buffer credits. |
302 | * It does not guarantee that allocation - this is a best-effort only. | 302 | * It does not guarantee that allocation - this is a best-effort only. |
303 | * The calling process MUST be able to deal cleanly with a failure to | 303 | * The calling process MUST be able to deal cleanly with a failure to |
304 | * extend here. | 304 | * extend here. |
@@ -308,7 +308,7 @@ handle_t *journal_start(journal_t *journal, int nblocks) | |||
308 | * return code < 0 implies an error | 308 | * return code < 0 implies an error |
309 | * return code > 0 implies normal transaction-full status. | 309 | * return code > 0 implies normal transaction-full status. |
310 | */ | 310 | */ |
311 | int journal_extend(handle_t *handle, int nblocks) | 311 | int jbd2_journal_extend(handle_t *handle, int nblocks) |
312 | { | 312 | { |
313 | transaction_t *transaction = handle->h_transaction; | 313 | transaction_t *transaction = handle->h_transaction; |
314 | journal_t *journal = transaction->t_journal; | 314 | journal_t *journal = transaction->t_journal; |
@@ -339,7 +339,7 @@ int journal_extend(handle_t *handle, int nblocks) | |||
339 | goto unlock; | 339 | goto unlock; |
340 | } | 340 | } |
341 | 341 | ||
342 | if (wanted > __log_space_left(journal)) { | 342 | if (wanted > __jbd2_log_space_left(journal)) { |
343 | jbd_debug(3, "denied handle %p %d blocks: " | 343 | jbd_debug(3, "denied handle %p %d blocks: " |
344 | "insufficient log space\n", handle, nblocks); | 344 | "insufficient log space\n", handle, nblocks); |
345 | goto unlock; | 345 | goto unlock; |
@@ -360,21 +360,21 @@ out: | |||
360 | 360 | ||
361 | 361 | ||
362 | /** | 362 | /** |
363 | * int journal_restart() - restart a handle . | 363 | * int jbd2_journal_restart() - restart a handle . |
364 | * @handle: handle to restart | 364 | * @handle: handle to restart |
365 | * @nblocks: nr credits requested | 365 | * @nblocks: nr credits requested |
366 | * | 366 | * |
367 | * Restart a handle for a multi-transaction filesystem | 367 | * Restart a handle for a multi-transaction filesystem |
368 | * operation. | 368 | * operation. |
369 | * | 369 | * |
370 | * If the journal_extend() call above fails to grant new buffer credits | 370 | * If the jbd2_journal_extend() call above fails to grant new buffer credits |
371 | * to a running handle, a call to journal_restart will commit the | 371 | * to a running handle, a call to jbd2_journal_restart will commit the |
372 | * handle's transaction so far and reattach the handle to a new | 372 | * handle's transaction so far and reattach the handle to a new |
373 | * transaction capabable of guaranteeing the requested number of | 373 | * transaction capabable of guaranteeing the requested number of |
374 | * credits. | 374 | * credits. |
375 | */ | 375 | */ |
376 | 376 | ||
377 | int journal_restart(handle_t *handle, int nblocks) | 377 | int jbd2_journal_restart(handle_t *handle, int nblocks) |
378 | { | 378 | { |
379 | transaction_t *transaction = handle->h_transaction; | 379 | transaction_t *transaction = handle->h_transaction; |
380 | journal_t *journal = transaction->t_journal; | 380 | journal_t *journal = transaction->t_journal; |
@@ -402,7 +402,7 @@ int journal_restart(handle_t *handle, int nblocks) | |||
402 | spin_unlock(&transaction->t_handle_lock); | 402 | spin_unlock(&transaction->t_handle_lock); |
403 | 403 | ||
404 | jbd_debug(2, "restarting handle %p\n", handle); | 404 | jbd_debug(2, "restarting handle %p\n", handle); |
405 | __log_start_commit(journal, transaction->t_tid); | 405 | __jbd2_log_start_commit(journal, transaction->t_tid); |
406 | spin_unlock(&journal->j_state_lock); | 406 | spin_unlock(&journal->j_state_lock); |
407 | 407 | ||
408 | handle->h_buffer_credits = nblocks; | 408 | handle->h_buffer_credits = nblocks; |
@@ -412,7 +412,7 @@ int journal_restart(handle_t *handle, int nblocks) | |||
412 | 412 | ||
413 | 413 | ||
414 | /** | 414 | /** |
415 | * void journal_lock_updates () - establish a transaction barrier. | 415 | * void jbd2_journal_lock_updates () - establish a transaction barrier. |
416 | * @journal: Journal to establish a barrier on. | 416 | * @journal: Journal to establish a barrier on. |
417 | * | 417 | * |
418 | * This locks out any further updates from being started, and blocks | 418 | * This locks out any further updates from being started, and blocks |
@@ -421,7 +421,7 @@ int journal_restart(handle_t *handle, int nblocks) | |||
421 | * | 421 | * |
422 | * The journal lock should not be held on entry. | 422 | * The journal lock should not be held on entry. |
423 | */ | 423 | */ |
424 | void journal_lock_updates(journal_t *journal) | 424 | void jbd2_journal_lock_updates(journal_t *journal) |
425 | { | 425 | { |
426 | DEFINE_WAIT(wait); | 426 | DEFINE_WAIT(wait); |
427 | 427 | ||
@@ -452,7 +452,7 @@ void journal_lock_updates(journal_t *journal) | |||
452 | 452 | ||
453 | /* | 453 | /* |
454 | * We have now established a barrier against other normal updates, but | 454 | * We have now established a barrier against other normal updates, but |
455 | * we also need to barrier against other journal_lock_updates() calls | 455 | * we also need to barrier against other jbd2_journal_lock_updates() calls |
456 | * to make sure that we serialise special journal-locked operations | 456 | * to make sure that we serialise special journal-locked operations |
457 | * too. | 457 | * too. |
458 | */ | 458 | */ |
@@ -460,14 +460,14 @@ void journal_lock_updates(journal_t *journal) | |||
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * void journal_unlock_updates (journal_t* journal) - release barrier | 463 | * void jbd2_journal_unlock_updates (journal_t* journal) - release barrier |
464 | * @journal: Journal to release the barrier on. | 464 | * @journal: Journal to release the barrier on. |
465 | * | 465 | * |
466 | * Release a transaction barrier obtained with journal_lock_updates(). | 466 | * Release a transaction barrier obtained with jbd2_journal_lock_updates(). |
467 | * | 467 | * |
468 | * Should be called without the journal lock held. | 468 | * Should be called without the journal lock held. |
469 | */ | 469 | */ |
470 | void journal_unlock_updates (journal_t *journal) | 470 | void jbd2_journal_unlock_updates (journal_t *journal) |
471 | { | 471 | { |
472 | J_ASSERT(journal->j_barrier_count != 0); | 472 | J_ASSERT(journal->j_barrier_count != 0); |
473 | 473 | ||
@@ -667,7 +667,7 @@ repeat: | |||
667 | JBUFFER_TRACE(jh, "allocate memory for buffer"); | 667 | JBUFFER_TRACE(jh, "allocate memory for buffer"); |
668 | jbd_unlock_bh_state(bh); | 668 | jbd_unlock_bh_state(bh); |
669 | frozen_buffer = | 669 | frozen_buffer = |
670 | jbd_slab_alloc(jh2bh(jh)->b_size, | 670 | jbd2_slab_alloc(jh2bh(jh)->b_size, |
671 | GFP_NOFS); | 671 | GFP_NOFS); |
672 | if (!frozen_buffer) { | 672 | if (!frozen_buffer) { |
673 | printk(KERN_EMERG | 673 | printk(KERN_EMERG |
@@ -699,7 +699,7 @@ repeat: | |||
699 | jh->b_transaction = transaction; | 699 | jh->b_transaction = transaction; |
700 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | 700 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); |
701 | spin_lock(&journal->j_list_lock); | 701 | spin_lock(&journal->j_list_lock); |
702 | __journal_file_buffer(jh, transaction, BJ_Reserved); | 702 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); |
703 | spin_unlock(&journal->j_list_lock); | 703 | spin_unlock(&journal->j_list_lock); |
704 | } | 704 | } |
705 | 705 | ||
@@ -723,18 +723,18 @@ done: | |||
723 | * If we are about to journal a buffer, then any revoke pending on it is | 723 | * If we are about to journal a buffer, then any revoke pending on it is |
724 | * no longer valid | 724 | * no longer valid |
725 | */ | 725 | */ |
726 | journal_cancel_revoke(handle, jh); | 726 | jbd2_journal_cancel_revoke(handle, jh); |
727 | 727 | ||
728 | out: | 728 | out: |
729 | if (unlikely(frozen_buffer)) /* It's usually NULL */ | 729 | if (unlikely(frozen_buffer)) /* It's usually NULL */ |
730 | jbd_slab_free(frozen_buffer, bh->b_size); | 730 | jbd2_slab_free(frozen_buffer, bh->b_size); |
731 | 731 | ||
732 | JBUFFER_TRACE(jh, "exit"); | 732 | JBUFFER_TRACE(jh, "exit"); |
733 | return error; | 733 | return error; |
734 | } | 734 | } |
735 | 735 | ||
736 | /** | 736 | /** |
737 | * int journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. | 737 | * int jbd2_journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. |
738 | * @handle: transaction to add buffer modifications to | 738 | * @handle: transaction to add buffer modifications to |
739 | * @bh: bh to be used for metadata writes | 739 | * @bh: bh to be used for metadata writes |
740 | * @credits: variable that will receive credits for the buffer | 740 | * @credits: variable that will receive credits for the buffer |
@@ -745,16 +745,16 @@ out: | |||
745 | * because we're write()ing a buffer which is also part of a shared mapping. | 745 | * because we're write()ing a buffer which is also part of a shared mapping. |
746 | */ | 746 | */ |
747 | 747 | ||
748 | int journal_get_write_access(handle_t *handle, struct buffer_head *bh) | 748 | int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh) |
749 | { | 749 | { |
750 | struct journal_head *jh = journal_add_journal_head(bh); | 750 | struct journal_head *jh = jbd2_journal_add_journal_head(bh); |
751 | int rc; | 751 | int rc; |
752 | 752 | ||
753 | /* We do not want to get caught playing with fields which the | 753 | /* We do not want to get caught playing with fields which the |
754 | * log thread also manipulates. Make sure that the buffer | 754 | * log thread also manipulates. Make sure that the buffer |
755 | * completes any outstanding IO before proceeding. */ | 755 | * completes any outstanding IO before proceeding. */ |
756 | rc = do_get_write_access(handle, jh, 0); | 756 | rc = do_get_write_access(handle, jh, 0); |
757 | journal_put_journal_head(jh); | 757 | jbd2_journal_put_journal_head(jh); |
758 | return rc; | 758 | return rc; |
759 | } | 759 | } |
760 | 760 | ||
@@ -772,17 +772,17 @@ int journal_get_write_access(handle_t *handle, struct buffer_head *bh) | |||
772 | * unlocked buffer beforehand. */ | 772 | * unlocked buffer beforehand. */ |
773 | 773 | ||
774 | /** | 774 | /** |
775 | * int journal_get_create_access () - notify intent to use newly created bh | 775 | * int jbd2_journal_get_create_access () - notify intent to use newly created bh |
776 | * @handle: transaction to new buffer to | 776 | * @handle: transaction to new buffer to |
777 | * @bh: new buffer. | 777 | * @bh: new buffer. |
778 | * | 778 | * |
779 | * Call this if you create a new bh. | 779 | * Call this if you create a new bh. |
780 | */ | 780 | */ |
781 | int journal_get_create_access(handle_t *handle, struct buffer_head *bh) | 781 | int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh) |
782 | { | 782 | { |
783 | transaction_t *transaction = handle->h_transaction; | 783 | transaction_t *transaction = handle->h_transaction; |
784 | journal_t *journal = transaction->t_journal; | 784 | journal_t *journal = transaction->t_journal; |
785 | struct journal_head *jh = journal_add_journal_head(bh); | 785 | struct journal_head *jh = jbd2_journal_add_journal_head(bh); |
786 | int err; | 786 | int err; |
787 | 787 | ||
788 | jbd_debug(5, "journal_head %p\n", jh); | 788 | jbd_debug(5, "journal_head %p\n", jh); |
@@ -812,7 +812,7 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
812 | if (jh->b_transaction == NULL) { | 812 | if (jh->b_transaction == NULL) { |
813 | jh->b_transaction = transaction; | 813 | jh->b_transaction = transaction; |
814 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); | 814 | JBUFFER_TRACE(jh, "file as BJ_Reserved"); |
815 | __journal_file_buffer(jh, transaction, BJ_Reserved); | 815 | __jbd2_journal_file_buffer(jh, transaction, BJ_Reserved); |
816 | } else if (jh->b_transaction == journal->j_committing_transaction) { | 816 | } else if (jh->b_transaction == journal->j_committing_transaction) { |
817 | JBUFFER_TRACE(jh, "set next transaction"); | 817 | JBUFFER_TRACE(jh, "set next transaction"); |
818 | jh->b_next_transaction = transaction; | 818 | jh->b_next_transaction = transaction; |
@@ -828,14 +828,14 @@ int journal_get_create_access(handle_t *handle, struct buffer_head *bh) | |||
828 | * which hits an assertion error. | 828 | * which hits an assertion error. |
829 | */ | 829 | */ |
830 | JBUFFER_TRACE(jh, "cancelling revoke"); | 830 | JBUFFER_TRACE(jh, "cancelling revoke"); |
831 | journal_cancel_revoke(handle, jh); | 831 | jbd2_journal_cancel_revoke(handle, jh); |
832 | journal_put_journal_head(jh); | 832 | jbd2_journal_put_journal_head(jh); |
833 | out: | 833 | out: |
834 | return err; | 834 | return err; |
835 | } | 835 | } |
836 | 836 | ||
837 | /** | 837 | /** |
838 | * int journal_get_undo_access() - Notify intent to modify metadata with | 838 | * int jbd2_journal_get_undo_access() - Notify intent to modify metadata with |
839 | * non-rewindable consequences | 839 | * non-rewindable consequences |
840 | * @handle: transaction | 840 | * @handle: transaction |
841 | * @bh: buffer to undo | 841 | * @bh: buffer to undo |
@@ -848,7 +848,7 @@ out: | |||
848 | * since if we overwrote that space we would make the delete | 848 | * since if we overwrote that space we would make the delete |
849 | * un-rewindable in case of a crash. | 849 | * un-rewindable in case of a crash. |
850 | * | 850 | * |
851 | * To deal with that, journal_get_undo_access requests write access to a | 851 | * To deal with that, jbd2_journal_get_undo_access requests write access to a |
852 | * buffer for parts of non-rewindable operations such as delete | 852 | * buffer for parts of non-rewindable operations such as delete |
853 | * operations on the bitmaps. The journaling code must keep a copy of | 853 | * operations on the bitmaps. The journaling code must keep a copy of |
854 | * the buffer's contents prior to the undo_access call until such time | 854 | * the buffer's contents prior to the undo_access call until such time |
@@ -861,10 +861,10 @@ out: | |||
861 | * | 861 | * |
862 | * Returns error number or 0 on success. | 862 | * Returns error number or 0 on success. |
863 | */ | 863 | */ |
864 | int journal_get_undo_access(handle_t *handle, struct buffer_head *bh) | 864 | int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh) |
865 | { | 865 | { |
866 | int err; | 866 | int err; |
867 | struct journal_head *jh = journal_add_journal_head(bh); | 867 | struct journal_head *jh = jbd2_journal_add_journal_head(bh); |
868 | char *committed_data = NULL; | 868 | char *committed_data = NULL; |
869 | 869 | ||
870 | JBUFFER_TRACE(jh, "entry"); | 870 | JBUFFER_TRACE(jh, "entry"); |
@@ -880,7 +880,7 @@ int journal_get_undo_access(handle_t *handle, struct buffer_head *bh) | |||
880 | 880 | ||
881 | repeat: | 881 | repeat: |
882 | if (!jh->b_committed_data) { | 882 | if (!jh->b_committed_data) { |
883 | committed_data = jbd_slab_alloc(jh2bh(jh)->b_size, GFP_NOFS); | 883 | committed_data = jbd2_slab_alloc(jh2bh(jh)->b_size, GFP_NOFS); |
884 | if (!committed_data) { | 884 | if (!committed_data) { |
885 | printk(KERN_EMERG "%s: No memory for committed data\n", | 885 | printk(KERN_EMERG "%s: No memory for committed data\n", |
886 | __FUNCTION__); | 886 | __FUNCTION__); |
@@ -905,14 +905,14 @@ repeat: | |||
905 | } | 905 | } |
906 | jbd_unlock_bh_state(bh); | 906 | jbd_unlock_bh_state(bh); |
907 | out: | 907 | out: |
908 | journal_put_journal_head(jh); | 908 | jbd2_journal_put_journal_head(jh); |
909 | if (unlikely(committed_data)) | 909 | if (unlikely(committed_data)) |
910 | jbd_slab_free(committed_data, bh->b_size); | 910 | jbd2_slab_free(committed_data, bh->b_size); |
911 | return err; | 911 | return err; |
912 | } | 912 | } |
913 | 913 | ||
914 | /** | 914 | /** |
915 | * int journal_dirty_data() - mark a buffer as containing dirty data which | 915 | * int jbd2_journal_dirty_data() - mark a buffer as containing dirty data which |
916 | * needs to be flushed before we can commit the | 916 | * needs to be flushed before we can commit the |
917 | * current transaction. | 917 | * current transaction. |
918 | * @handle: transaction | 918 | * @handle: transaction |
@@ -923,10 +923,10 @@ out: | |||
923 | * | 923 | * |
924 | * Returns error number or 0 on success. | 924 | * Returns error number or 0 on success. |
925 | * | 925 | * |
926 | * journal_dirty_data() can be called via page_launder->ext3_writepage | 926 | * jbd2_journal_dirty_data() can be called via page_launder->ext3_writepage |
927 | * by kswapd. | 927 | * by kswapd. |
928 | */ | 928 | */ |
929 | int journal_dirty_data(handle_t *handle, struct buffer_head *bh) | 929 | int jbd2_journal_dirty_data(handle_t *handle, struct buffer_head *bh) |
930 | { | 930 | { |
931 | journal_t *journal = handle->h_transaction->t_journal; | 931 | journal_t *journal = handle->h_transaction->t_journal; |
932 | int need_brelse = 0; | 932 | int need_brelse = 0; |
@@ -935,7 +935,7 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh) | |||
935 | if (is_handle_aborted(handle)) | 935 | if (is_handle_aborted(handle)) |
936 | return 0; | 936 | return 0; |
937 | 937 | ||
938 | jh = journal_add_journal_head(bh); | 938 | jh = jbd2_journal_add_journal_head(bh); |
939 | JBUFFER_TRACE(jh, "entry"); | 939 | JBUFFER_TRACE(jh, "entry"); |
940 | 940 | ||
941 | /* | 941 | /* |
@@ -984,7 +984,7 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh) | |||
984 | * And while we're in that state, someone does a | 984 | * And while we're in that state, someone does a |
985 | * writepage() in an attempt to pageout the same area | 985 | * writepage() in an attempt to pageout the same area |
986 | * of the file via a shared mapping. At present that | 986 | * of the file via a shared mapping. At present that |
987 | * calls journal_dirty_data(), and we get right here. | 987 | * calls jbd2_journal_dirty_data(), and we get right here. |
988 | * It may be too late to journal the data. Simply | 988 | * It may be too late to journal the data. Simply |
989 | * falling through to the next test will suffice: the | 989 | * falling through to the next test will suffice: the |
990 | * data will be dirty and wil be checkpointed. The | 990 | * data will be dirty and wil be checkpointed. The |
@@ -1035,7 +1035,7 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh) | |||
1035 | /* journal_clean_data_list() may have got there first */ | 1035 | /* journal_clean_data_list() may have got there first */ |
1036 | if (jh->b_transaction != NULL) { | 1036 | if (jh->b_transaction != NULL) { |
1037 | JBUFFER_TRACE(jh, "unfile from commit"); | 1037 | JBUFFER_TRACE(jh, "unfile from commit"); |
1038 | __journal_temp_unlink_buffer(jh); | 1038 | __jbd2_journal_temp_unlink_buffer(jh); |
1039 | /* It still points to the committing | 1039 | /* It still points to the committing |
1040 | * transaction; move it to this one so | 1040 | * transaction; move it to this one so |
1041 | * that the refile assert checks are | 1041 | * that the refile assert checks are |
@@ -1054,15 +1054,15 @@ int journal_dirty_data(handle_t *handle, struct buffer_head *bh) | |||
1054 | if (jh->b_jlist != BJ_SyncData && jh->b_jlist != BJ_Locked) { | 1054 | if (jh->b_jlist != BJ_SyncData && jh->b_jlist != BJ_Locked) { |
1055 | JBUFFER_TRACE(jh, "not on correct data list: unfile"); | 1055 | JBUFFER_TRACE(jh, "not on correct data list: unfile"); |
1056 | J_ASSERT_JH(jh, jh->b_jlist != BJ_Shadow); | 1056 | J_ASSERT_JH(jh, jh->b_jlist != BJ_Shadow); |
1057 | __journal_temp_unlink_buffer(jh); | 1057 | __jbd2_journal_temp_unlink_buffer(jh); |
1058 | jh->b_transaction = handle->h_transaction; | 1058 | jh->b_transaction = handle->h_transaction; |
1059 | JBUFFER_TRACE(jh, "file as data"); | 1059 | JBUFFER_TRACE(jh, "file as data"); |
1060 | __journal_file_buffer(jh, handle->h_transaction, | 1060 | __jbd2_journal_file_buffer(jh, handle->h_transaction, |
1061 | BJ_SyncData); | 1061 | BJ_SyncData); |
1062 | } | 1062 | } |
1063 | } else { | 1063 | } else { |
1064 | JBUFFER_TRACE(jh, "not on a transaction"); | 1064 | JBUFFER_TRACE(jh, "not on a transaction"); |
1065 | __journal_file_buffer(jh, handle->h_transaction, BJ_SyncData); | 1065 | __jbd2_journal_file_buffer(jh, handle->h_transaction, BJ_SyncData); |
1066 | } | 1066 | } |
1067 | no_journal: | 1067 | no_journal: |
1068 | spin_unlock(&journal->j_list_lock); | 1068 | spin_unlock(&journal->j_list_lock); |
@@ -1072,12 +1072,12 @@ no_journal: | |||
1072 | __brelse(bh); | 1072 | __brelse(bh); |
1073 | } | 1073 | } |
1074 | JBUFFER_TRACE(jh, "exit"); | 1074 | JBUFFER_TRACE(jh, "exit"); |
1075 | journal_put_journal_head(jh); | 1075 | jbd2_journal_put_journal_head(jh); |
1076 | return 0; | 1076 | return 0; |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | /** | 1079 | /** |
1080 | * int journal_dirty_metadata() - mark a buffer as containing dirty metadata | 1080 | * int jbd2_journal_dirty_metadata() - mark a buffer as containing dirty metadata |
1081 | * @handle: transaction to add buffer to. | 1081 | * @handle: transaction to add buffer to. |
1082 | * @bh: buffer to mark | 1082 | * @bh: buffer to mark |
1083 | * | 1083 | * |
@@ -1095,7 +1095,7 @@ no_journal: | |||
1095 | * buffer: that only gets done when the old transaction finally | 1095 | * buffer: that only gets done when the old transaction finally |
1096 | * completes its commit. | 1096 | * completes its commit. |
1097 | */ | 1097 | */ |
1098 | int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | 1098 | int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) |
1099 | { | 1099 | { |
1100 | transaction_t *transaction = handle->h_transaction; | 1100 | transaction_t *transaction = handle->h_transaction; |
1101 | journal_t *journal = transaction->t_journal; | 1101 | journal_t *journal = transaction->t_journal; |
@@ -1156,7 +1156,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1156 | 1156 | ||
1157 | JBUFFER_TRACE(jh, "file as BJ_Metadata"); | 1157 | JBUFFER_TRACE(jh, "file as BJ_Metadata"); |
1158 | spin_lock(&journal->j_list_lock); | 1158 | spin_lock(&journal->j_list_lock); |
1159 | __journal_file_buffer(jh, handle->h_transaction, BJ_Metadata); | 1159 | __jbd2_journal_file_buffer(jh, handle->h_transaction, BJ_Metadata); |
1160 | spin_unlock(&journal->j_list_lock); | 1160 | spin_unlock(&journal->j_list_lock); |
1161 | out_unlock_bh: | 1161 | out_unlock_bh: |
1162 | jbd_unlock_bh_state(bh); | 1162 | jbd_unlock_bh_state(bh); |
@@ -1166,18 +1166,18 @@ out: | |||
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | /* | 1168 | /* |
1169 | * journal_release_buffer: undo a get_write_access without any buffer | 1169 | * jbd2_journal_release_buffer: undo a get_write_access without any buffer |
1170 | * updates, if the update decided in the end that it didn't need access. | 1170 | * updates, if the update decided in the end that it didn't need access. |
1171 | * | 1171 | * |
1172 | */ | 1172 | */ |
1173 | void | 1173 | void |
1174 | journal_release_buffer(handle_t *handle, struct buffer_head *bh) | 1174 | jbd2_journal_release_buffer(handle_t *handle, struct buffer_head *bh) |
1175 | { | 1175 | { |
1176 | BUFFER_TRACE(bh, "entry"); | 1176 | BUFFER_TRACE(bh, "entry"); |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | /** | 1179 | /** |
1180 | * void journal_forget() - bforget() for potentially-journaled buffers. | 1180 | * void jbd2_journal_forget() - bforget() for potentially-journaled buffers. |
1181 | * @handle: transaction handle | 1181 | * @handle: transaction handle |
1182 | * @bh: bh to 'forget' | 1182 | * @bh: bh to 'forget' |
1183 | * | 1183 | * |
@@ -1193,7 +1193,7 @@ journal_release_buffer(handle_t *handle, struct buffer_head *bh) | |||
1193 | * Allow this call even if the handle has aborted --- it may be part of | 1193 | * Allow this call even if the handle has aborted --- it may be part of |
1194 | * the caller's cleanup after an abort. | 1194 | * the caller's cleanup after an abort. |
1195 | */ | 1195 | */ |
1196 | int journal_forget (handle_t *handle, struct buffer_head *bh) | 1196 | int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh) |
1197 | { | 1197 | { |
1198 | transaction_t *transaction = handle->h_transaction; | 1198 | transaction_t *transaction = handle->h_transaction; |
1199 | journal_t *journal = transaction->t_journal; | 1199 | journal_t *journal = transaction->t_journal; |
@@ -1250,11 +1250,11 @@ int journal_forget (handle_t *handle, struct buffer_head *bh) | |||
1250 | */ | 1250 | */ |
1251 | 1251 | ||
1252 | if (jh->b_cp_transaction) { | 1252 | if (jh->b_cp_transaction) { |
1253 | __journal_temp_unlink_buffer(jh); | 1253 | __jbd2_journal_temp_unlink_buffer(jh); |
1254 | __journal_file_buffer(jh, transaction, BJ_Forget); | 1254 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); |
1255 | } else { | 1255 | } else { |
1256 | __journal_unfile_buffer(jh); | 1256 | __jbd2_journal_unfile_buffer(jh); |
1257 | journal_remove_journal_head(bh); | 1257 | jbd2_journal_remove_journal_head(bh); |
1258 | __brelse(bh); | 1258 | __brelse(bh); |
1259 | if (!buffer_jbd(bh)) { | 1259 | if (!buffer_jbd(bh)) { |
1260 | spin_unlock(&journal->j_list_lock); | 1260 | spin_unlock(&journal->j_list_lock); |
@@ -1292,7 +1292,7 @@ drop: | |||
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | /** | 1294 | /** |
1295 | * int journal_stop() - complete a transaction | 1295 | * int jbd2_journal_stop() - complete a transaction |
1296 | * @handle: tranaction to complete. | 1296 | * @handle: tranaction to complete. |
1297 | * | 1297 | * |
1298 | * All done for a particular handle. | 1298 | * All done for a particular handle. |
@@ -1302,12 +1302,12 @@ drop: | |||
1302 | * complication is that we need to start a commit operation if the | 1302 | * complication is that we need to start a commit operation if the |
1303 | * filesystem is marked for synchronous update. | 1303 | * filesystem is marked for synchronous update. |
1304 | * | 1304 | * |
1305 | * journal_stop itself will not usually return an error, but it may | 1305 | * jbd2_journal_stop itself will not usually return an error, but it may |
1306 | * do so in unusual circumstances. In particular, expect it to | 1306 | * do so in unusual circumstances. In particular, expect it to |
1307 | * return -EIO if a journal_abort has been executed since the | 1307 | * return -EIO if a jbd2_journal_abort has been executed since the |
1308 | * transaction began. | 1308 | * transaction began. |
1309 | */ | 1309 | */ |
1310 | int journal_stop(handle_t *handle) | 1310 | int jbd2_journal_stop(handle_t *handle) |
1311 | { | 1311 | { |
1312 | transaction_t *transaction = handle->h_transaction; | 1312 | transaction_t *transaction = handle->h_transaction; |
1313 | journal_t *journal = transaction->t_journal; | 1313 | journal_t *journal = transaction->t_journal; |
@@ -1383,15 +1383,15 @@ int journal_stop(handle_t *handle) | |||
1383 | jbd_debug(2, "transaction too old, requesting commit for " | 1383 | jbd_debug(2, "transaction too old, requesting commit for " |
1384 | "handle %p\n", handle); | 1384 | "handle %p\n", handle); |
1385 | /* This is non-blocking */ | 1385 | /* This is non-blocking */ |
1386 | __log_start_commit(journal, transaction->t_tid); | 1386 | __jbd2_log_start_commit(journal, transaction->t_tid); |
1387 | spin_unlock(&journal->j_state_lock); | 1387 | spin_unlock(&journal->j_state_lock); |
1388 | 1388 | ||
1389 | /* | 1389 | /* |
1390 | * Special case: JFS_SYNC synchronous updates require us | 1390 | * Special case: JBD2_SYNC synchronous updates require us |
1391 | * to wait for the commit to complete. | 1391 | * to wait for the commit to complete. |
1392 | */ | 1392 | */ |
1393 | if (handle->h_sync && !(current->flags & PF_MEMALLOC)) | 1393 | if (handle->h_sync && !(current->flags & PF_MEMALLOC)) |
1394 | err = log_wait_commit(journal, tid); | 1394 | err = jbd2_log_wait_commit(journal, tid); |
1395 | } else { | 1395 | } else { |
1396 | spin_unlock(&transaction->t_handle_lock); | 1396 | spin_unlock(&transaction->t_handle_lock); |
1397 | spin_unlock(&journal->j_state_lock); | 1397 | spin_unlock(&journal->j_state_lock); |
@@ -1401,24 +1401,24 @@ int journal_stop(handle_t *handle) | |||
1401 | return err; | 1401 | return err; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | /**int journal_force_commit() - force any uncommitted transactions | 1404 | /**int jbd2_journal_force_commit() - force any uncommitted transactions |
1405 | * @journal: journal to force | 1405 | * @journal: journal to force |
1406 | * | 1406 | * |
1407 | * For synchronous operations: force any uncommitted transactions | 1407 | * For synchronous operations: force any uncommitted transactions |
1408 | * to disk. May seem kludgy, but it reuses all the handle batching | 1408 | * to disk. May seem kludgy, but it reuses all the handle batching |
1409 | * code in a very simple manner. | 1409 | * code in a very simple manner. |
1410 | */ | 1410 | */ |
1411 | int journal_force_commit(journal_t *journal) | 1411 | int jbd2_journal_force_commit(journal_t *journal) |
1412 | { | 1412 | { |
1413 | handle_t *handle; | 1413 | handle_t *handle; |
1414 | int ret; | 1414 | int ret; |
1415 | 1415 | ||
1416 | handle = journal_start(journal, 1); | 1416 | handle = jbd2_journal_start(journal, 1); |
1417 | if (IS_ERR(handle)) { | 1417 | if (IS_ERR(handle)) { |
1418 | ret = PTR_ERR(handle); | 1418 | ret = PTR_ERR(handle); |
1419 | } else { | 1419 | } else { |
1420 | handle->h_sync = 1; | 1420 | handle->h_sync = 1; |
1421 | ret = journal_stop(handle); | 1421 | ret = jbd2_journal_stop(handle); |
1422 | } | 1422 | } |
1423 | return ret; | 1423 | return ret; |
1424 | } | 1424 | } |
@@ -1486,7 +1486,7 @@ __blist_del_buffer(struct journal_head **list, struct journal_head *jh) | |||
1486 | * | 1486 | * |
1487 | * Called under j_list_lock. The journal may not be locked. | 1487 | * Called under j_list_lock. The journal may not be locked. |
1488 | */ | 1488 | */ |
1489 | void __journal_temp_unlink_buffer(struct journal_head *jh) | 1489 | void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh) |
1490 | { | 1490 | { |
1491 | struct journal_head **list = NULL; | 1491 | struct journal_head **list = NULL; |
1492 | transaction_t *transaction; | 1492 | transaction_t *transaction; |
@@ -1538,23 +1538,23 @@ void __journal_temp_unlink_buffer(struct journal_head *jh) | |||
1538 | mark_buffer_dirty(bh); /* Expose it to the VM */ | 1538 | mark_buffer_dirty(bh); /* Expose it to the VM */ |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | void __journal_unfile_buffer(struct journal_head *jh) | 1541 | void __jbd2_journal_unfile_buffer(struct journal_head *jh) |
1542 | { | 1542 | { |
1543 | __journal_temp_unlink_buffer(jh); | 1543 | __jbd2_journal_temp_unlink_buffer(jh); |
1544 | jh->b_transaction = NULL; | 1544 | jh->b_transaction = NULL; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | void journal_unfile_buffer(journal_t *journal, struct journal_head *jh) | 1547 | void jbd2_journal_unfile_buffer(journal_t *journal, struct journal_head *jh) |
1548 | { | 1548 | { |
1549 | jbd_lock_bh_state(jh2bh(jh)); | 1549 | jbd_lock_bh_state(jh2bh(jh)); |
1550 | spin_lock(&journal->j_list_lock); | 1550 | spin_lock(&journal->j_list_lock); |
1551 | __journal_unfile_buffer(jh); | 1551 | __jbd2_journal_unfile_buffer(jh); |
1552 | spin_unlock(&journal->j_list_lock); | 1552 | spin_unlock(&journal->j_list_lock); |
1553 | jbd_unlock_bh_state(jh2bh(jh)); | 1553 | jbd_unlock_bh_state(jh2bh(jh)); |
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | /* | 1556 | /* |
1557 | * Called from journal_try_to_free_buffers(). | 1557 | * Called from jbd2_journal_try_to_free_buffers(). |
1558 | * | 1558 | * |
1559 | * Called under jbd_lock_bh_state(bh) | 1559 | * Called under jbd_lock_bh_state(bh) |
1560 | */ | 1560 | */ |
@@ -1576,16 +1576,16 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh) | |||
1576 | if (jh->b_jlist == BJ_SyncData || jh->b_jlist == BJ_Locked) { | 1576 | if (jh->b_jlist == BJ_SyncData || jh->b_jlist == BJ_Locked) { |
1577 | /* A written-back ordered data buffer */ | 1577 | /* A written-back ordered data buffer */ |
1578 | JBUFFER_TRACE(jh, "release data"); | 1578 | JBUFFER_TRACE(jh, "release data"); |
1579 | __journal_unfile_buffer(jh); | 1579 | __jbd2_journal_unfile_buffer(jh); |
1580 | journal_remove_journal_head(bh); | 1580 | jbd2_journal_remove_journal_head(bh); |
1581 | __brelse(bh); | 1581 | __brelse(bh); |
1582 | } | 1582 | } |
1583 | } else if (jh->b_cp_transaction != 0 && jh->b_transaction == 0) { | 1583 | } else if (jh->b_cp_transaction != 0 && jh->b_transaction == 0) { |
1584 | /* written-back checkpointed metadata buffer */ | 1584 | /* written-back checkpointed metadata buffer */ |
1585 | if (jh->b_jlist == BJ_None) { | 1585 | if (jh->b_jlist == BJ_None) { |
1586 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 1586 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
1587 | __journal_remove_checkpoint(jh); | 1587 | __jbd2_journal_remove_checkpoint(jh); |
1588 | journal_remove_journal_head(bh); | 1588 | jbd2_journal_remove_journal_head(bh); |
1589 | __brelse(bh); | 1589 | __brelse(bh); |
1590 | } | 1590 | } |
1591 | } | 1591 | } |
@@ -1596,7 +1596,7 @@ out: | |||
1596 | 1596 | ||
1597 | 1597 | ||
1598 | /** | 1598 | /** |
1599 | * int journal_try_to_free_buffers() - try to free page buffers. | 1599 | * int jbd2_journal_try_to_free_buffers() - try to free page buffers. |
1600 | * @journal: journal for operation | 1600 | * @journal: journal for operation |
1601 | * @page: to try and free | 1601 | * @page: to try and free |
1602 | * @unused_gfp_mask: unused | 1602 | * @unused_gfp_mask: unused |
@@ -1613,13 +1613,13 @@ out: | |||
1613 | * | 1613 | * |
1614 | * This complicates JBD locking somewhat. We aren't protected by the | 1614 | * This complicates JBD locking somewhat. We aren't protected by the |
1615 | * BKL here. We wish to remove the buffer from its committing or | 1615 | * BKL here. We wish to remove the buffer from its committing or |
1616 | * running transaction's ->t_datalist via __journal_unfile_buffer. | 1616 | * running transaction's ->t_datalist via __jbd2_journal_unfile_buffer. |
1617 | * | 1617 | * |
1618 | * This may *change* the value of transaction_t->t_datalist, so anyone | 1618 | * This may *change* the value of transaction_t->t_datalist, so anyone |
1619 | * who looks at t_datalist needs to lock against this function. | 1619 | * who looks at t_datalist needs to lock against this function. |
1620 | * | 1620 | * |
1621 | * Even worse, someone may be doing a journal_dirty_data on this | 1621 | * Even worse, someone may be doing a jbd2_journal_dirty_data on this |
1622 | * buffer. So we need to lock against that. journal_dirty_data() | 1622 | * buffer. So we need to lock against that. jbd2_journal_dirty_data() |
1623 | * will come out of the lock with the buffer dirty, which makes it | 1623 | * will come out of the lock with the buffer dirty, which makes it |
1624 | * ineligible for release here. | 1624 | * ineligible for release here. |
1625 | * | 1625 | * |
@@ -1629,7 +1629,7 @@ out: | |||
1629 | * cannot happen because we never reallocate freed data as metadata | 1629 | * cannot happen because we never reallocate freed data as metadata |
1630 | * while the data is part of a transaction. Yes? | 1630 | * while the data is part of a transaction. Yes? |
1631 | */ | 1631 | */ |
1632 | int journal_try_to_free_buffers(journal_t *journal, | 1632 | int jbd2_journal_try_to_free_buffers(journal_t *journal, |
1633 | struct page *page, gfp_t unused_gfp_mask) | 1633 | struct page *page, gfp_t unused_gfp_mask) |
1634 | { | 1634 | { |
1635 | struct buffer_head *head; | 1635 | struct buffer_head *head; |
@@ -1646,15 +1646,15 @@ int journal_try_to_free_buffers(journal_t *journal, | |||
1646 | /* | 1646 | /* |
1647 | * We take our own ref against the journal_head here to avoid | 1647 | * We take our own ref against the journal_head here to avoid |
1648 | * having to add tons of locking around each instance of | 1648 | * having to add tons of locking around each instance of |
1649 | * journal_remove_journal_head() and journal_put_journal_head(). | 1649 | * jbd2_journal_remove_journal_head() and jbd2_journal_put_journal_head(). |
1650 | */ | 1650 | */ |
1651 | jh = journal_grab_journal_head(bh); | 1651 | jh = jbd2_journal_grab_journal_head(bh); |
1652 | if (!jh) | 1652 | if (!jh) |
1653 | continue; | 1653 | continue; |
1654 | 1654 | ||
1655 | jbd_lock_bh_state(bh); | 1655 | jbd_lock_bh_state(bh); |
1656 | __journal_try_to_free_buffer(journal, bh); | 1656 | __journal_try_to_free_buffer(journal, bh); |
1657 | journal_put_journal_head(jh); | 1657 | jbd2_journal_put_journal_head(jh); |
1658 | jbd_unlock_bh_state(bh); | 1658 | jbd_unlock_bh_state(bh); |
1659 | if (buffer_jbd(bh)) | 1659 | if (buffer_jbd(bh)) |
1660 | goto busy; | 1660 | goto busy; |
@@ -1681,23 +1681,23 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction) | |||
1681 | int may_free = 1; | 1681 | int may_free = 1; |
1682 | struct buffer_head *bh = jh2bh(jh); | 1682 | struct buffer_head *bh = jh2bh(jh); |
1683 | 1683 | ||
1684 | __journal_unfile_buffer(jh); | 1684 | __jbd2_journal_unfile_buffer(jh); |
1685 | 1685 | ||
1686 | if (jh->b_cp_transaction) { | 1686 | if (jh->b_cp_transaction) { |
1687 | JBUFFER_TRACE(jh, "on running+cp transaction"); | 1687 | JBUFFER_TRACE(jh, "on running+cp transaction"); |
1688 | __journal_file_buffer(jh, transaction, BJ_Forget); | 1688 | __jbd2_journal_file_buffer(jh, transaction, BJ_Forget); |
1689 | clear_buffer_jbddirty(bh); | 1689 | clear_buffer_jbddirty(bh); |
1690 | may_free = 0; | 1690 | may_free = 0; |
1691 | } else { | 1691 | } else { |
1692 | JBUFFER_TRACE(jh, "on running transaction"); | 1692 | JBUFFER_TRACE(jh, "on running transaction"); |
1693 | journal_remove_journal_head(bh); | 1693 | jbd2_journal_remove_journal_head(bh); |
1694 | __brelse(bh); | 1694 | __brelse(bh); |
1695 | } | 1695 | } |
1696 | return may_free; | 1696 | return may_free; |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | /* | 1699 | /* |
1700 | * journal_invalidatepage | 1700 | * jbd2_journal_invalidatepage |
1701 | * | 1701 | * |
1702 | * This code is tricky. It has a number of cases to deal with. | 1702 | * This code is tricky. It has a number of cases to deal with. |
1703 | * | 1703 | * |
@@ -1765,7 +1765,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | |||
1765 | jbd_lock_bh_state(bh); | 1765 | jbd_lock_bh_state(bh); |
1766 | spin_lock(&journal->j_list_lock); | 1766 | spin_lock(&journal->j_list_lock); |
1767 | 1767 | ||
1768 | jh = journal_grab_journal_head(bh); | 1768 | jh = jbd2_journal_grab_journal_head(bh); |
1769 | if (!jh) | 1769 | if (!jh) |
1770 | goto zap_buffer_no_jh; | 1770 | goto zap_buffer_no_jh; |
1771 | 1771 | ||
@@ -1796,7 +1796,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | |||
1796 | JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget"); | 1796 | JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget"); |
1797 | ret = __dispose_buffer(jh, | 1797 | ret = __dispose_buffer(jh, |
1798 | journal->j_running_transaction); | 1798 | journal->j_running_transaction); |
1799 | journal_put_journal_head(jh); | 1799 | jbd2_journal_put_journal_head(jh); |
1800 | spin_unlock(&journal->j_list_lock); | 1800 | spin_unlock(&journal->j_list_lock); |
1801 | jbd_unlock_bh_state(bh); | 1801 | jbd_unlock_bh_state(bh); |
1802 | spin_unlock(&journal->j_state_lock); | 1802 | spin_unlock(&journal->j_state_lock); |
@@ -1810,7 +1810,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | |||
1810 | JBUFFER_TRACE(jh, "give to committing trans"); | 1810 | JBUFFER_TRACE(jh, "give to committing trans"); |
1811 | ret = __dispose_buffer(jh, | 1811 | ret = __dispose_buffer(jh, |
1812 | journal->j_committing_transaction); | 1812 | journal->j_committing_transaction); |
1813 | journal_put_journal_head(jh); | 1813 | jbd2_journal_put_journal_head(jh); |
1814 | spin_unlock(&journal->j_list_lock); | 1814 | spin_unlock(&journal->j_list_lock); |
1815 | jbd_unlock_bh_state(bh); | 1815 | jbd_unlock_bh_state(bh); |
1816 | spin_unlock(&journal->j_state_lock); | 1816 | spin_unlock(&journal->j_state_lock); |
@@ -1844,7 +1844,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | |||
1844 | journal->j_running_transaction); | 1844 | journal->j_running_transaction); |
1845 | jh->b_next_transaction = NULL; | 1845 | jh->b_next_transaction = NULL; |
1846 | } | 1846 | } |
1847 | journal_put_journal_head(jh); | 1847 | jbd2_journal_put_journal_head(jh); |
1848 | spin_unlock(&journal->j_list_lock); | 1848 | spin_unlock(&journal->j_list_lock); |
1849 | jbd_unlock_bh_state(bh); | 1849 | jbd_unlock_bh_state(bh); |
1850 | spin_unlock(&journal->j_state_lock); | 1850 | spin_unlock(&journal->j_state_lock); |
@@ -1861,7 +1861,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh) | |||
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | zap_buffer: | 1863 | zap_buffer: |
1864 | journal_put_journal_head(jh); | 1864 | jbd2_journal_put_journal_head(jh); |
1865 | zap_buffer_no_jh: | 1865 | zap_buffer_no_jh: |
1866 | spin_unlock(&journal->j_list_lock); | 1866 | spin_unlock(&journal->j_list_lock); |
1867 | jbd_unlock_bh_state(bh); | 1867 | jbd_unlock_bh_state(bh); |
@@ -1877,7 +1877,7 @@ zap_buffer_unlocked: | |||
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | /** | 1879 | /** |
1880 | * void journal_invalidatepage() | 1880 | * void jbd2_journal_invalidatepage() |
1881 | * @journal: journal to use for flush... | 1881 | * @journal: journal to use for flush... |
1882 | * @page: page to flush | 1882 | * @page: page to flush |
1883 | * @offset: length of page to invalidate. | 1883 | * @offset: length of page to invalidate. |
@@ -1885,7 +1885,7 @@ zap_buffer_unlocked: | |||
1885 | * Reap page buffers containing data after offset in page. | 1885 | * Reap page buffers containing data after offset in page. |
1886 | * | 1886 | * |
1887 | */ | 1887 | */ |
1888 | void journal_invalidatepage(journal_t *journal, | 1888 | void jbd2_journal_invalidatepage(journal_t *journal, |
1889 | struct page *page, | 1889 | struct page *page, |
1890 | unsigned long offset) | 1890 | unsigned long offset) |
1891 | { | 1891 | { |
@@ -1927,7 +1927,7 @@ void journal_invalidatepage(journal_t *journal, | |||
1927 | /* | 1927 | /* |
1928 | * File a buffer on the given transaction list. | 1928 | * File a buffer on the given transaction list. |
1929 | */ | 1929 | */ |
1930 | void __journal_file_buffer(struct journal_head *jh, | 1930 | void __jbd2_journal_file_buffer(struct journal_head *jh, |
1931 | transaction_t *transaction, int jlist) | 1931 | transaction_t *transaction, int jlist) |
1932 | { | 1932 | { |
1933 | struct journal_head **list = NULL; | 1933 | struct journal_head **list = NULL; |
@@ -1956,7 +1956,7 @@ void __journal_file_buffer(struct journal_head *jh, | |||
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | if (jh->b_transaction) | 1958 | if (jh->b_transaction) |
1959 | __journal_temp_unlink_buffer(jh); | 1959 | __jbd2_journal_temp_unlink_buffer(jh); |
1960 | jh->b_transaction = transaction; | 1960 | jh->b_transaction = transaction; |
1961 | 1961 | ||
1962 | switch (jlist) { | 1962 | switch (jlist) { |
@@ -1998,12 +1998,12 @@ void __journal_file_buffer(struct journal_head *jh, | |||
1998 | set_buffer_jbddirty(bh); | 1998 | set_buffer_jbddirty(bh); |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | void journal_file_buffer(struct journal_head *jh, | 2001 | void jbd2_journal_file_buffer(struct journal_head *jh, |
2002 | transaction_t *transaction, int jlist) | 2002 | transaction_t *transaction, int jlist) |
2003 | { | 2003 | { |
2004 | jbd_lock_bh_state(jh2bh(jh)); | 2004 | jbd_lock_bh_state(jh2bh(jh)); |
2005 | spin_lock(&transaction->t_journal->j_list_lock); | 2005 | spin_lock(&transaction->t_journal->j_list_lock); |
2006 | __journal_file_buffer(jh, transaction, jlist); | 2006 | __jbd2_journal_file_buffer(jh, transaction, jlist); |
2007 | spin_unlock(&transaction->t_journal->j_list_lock); | 2007 | spin_unlock(&transaction->t_journal->j_list_lock); |
2008 | jbd_unlock_bh_state(jh2bh(jh)); | 2008 | jbd_unlock_bh_state(jh2bh(jh)); |
2009 | } | 2009 | } |
@@ -2018,7 +2018,7 @@ void journal_file_buffer(struct journal_head *jh, | |||
2018 | * | 2018 | * |
2019 | * Called under jbd_lock_bh_state(jh2bh(jh)) | 2019 | * Called under jbd_lock_bh_state(jh2bh(jh)) |
2020 | */ | 2020 | */ |
2021 | void __journal_refile_buffer(struct journal_head *jh) | 2021 | void __jbd2_journal_refile_buffer(struct journal_head *jh) |
2022 | { | 2022 | { |
2023 | int was_dirty; | 2023 | int was_dirty; |
2024 | struct buffer_head *bh = jh2bh(jh); | 2024 | struct buffer_head *bh = jh2bh(jh); |
@@ -2029,7 +2029,7 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2029 | 2029 | ||
2030 | /* If the buffer is now unused, just drop it. */ | 2030 | /* If the buffer is now unused, just drop it. */ |
2031 | if (jh->b_next_transaction == NULL) { | 2031 | if (jh->b_next_transaction == NULL) { |
2032 | __journal_unfile_buffer(jh); | 2032 | __jbd2_journal_unfile_buffer(jh); |
2033 | return; | 2033 | return; |
2034 | } | 2034 | } |
2035 | 2035 | ||
@@ -2039,10 +2039,10 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2039 | */ | 2039 | */ |
2040 | 2040 | ||
2041 | was_dirty = test_clear_buffer_jbddirty(bh); | 2041 | was_dirty = test_clear_buffer_jbddirty(bh); |
2042 | __journal_temp_unlink_buffer(jh); | 2042 | __jbd2_journal_temp_unlink_buffer(jh); |
2043 | jh->b_transaction = jh->b_next_transaction; | 2043 | jh->b_transaction = jh->b_next_transaction; |
2044 | jh->b_next_transaction = NULL; | 2044 | jh->b_next_transaction = NULL; |
2045 | __journal_file_buffer(jh, jh->b_transaction, | 2045 | __jbd2_journal_file_buffer(jh, jh->b_transaction, |
2046 | was_dirty ? BJ_Metadata : BJ_Reserved); | 2046 | was_dirty ? BJ_Metadata : BJ_Reserved); |
2047 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); | 2047 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); |
2048 | 2048 | ||
@@ -2054,26 +2054,26 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2054 | * For the unlocked version of this call, also make sure that any | 2054 | * For the unlocked version of this call, also make sure that any |
2055 | * hanging journal_head is cleaned up if necessary. | 2055 | * hanging journal_head is cleaned up if necessary. |
2056 | * | 2056 | * |
2057 | * __journal_refile_buffer is usually called as part of a single locked | 2057 | * __jbd2_journal_refile_buffer is usually called as part of a single locked |
2058 | * operation on a buffer_head, in which the caller is probably going to | 2058 | * operation on a buffer_head, in which the caller is probably going to |
2059 | * be hooking the journal_head onto other lists. In that case it is up | 2059 | * be hooking the journal_head onto other lists. In that case it is up |
2060 | * to the caller to remove the journal_head if necessary. For the | 2060 | * to the caller to remove the journal_head if necessary. For the |
2061 | * unlocked journal_refile_buffer call, the caller isn't going to be | 2061 | * unlocked jbd2_journal_refile_buffer call, the caller isn't going to be |
2062 | * doing anything else to the buffer so we need to do the cleanup | 2062 | * doing anything else to the buffer so we need to do the cleanup |
2063 | * ourselves to avoid a jh leak. | 2063 | * ourselves to avoid a jh leak. |
2064 | * | 2064 | * |
2065 | * *** The journal_head may be freed by this call! *** | 2065 | * *** The journal_head may be freed by this call! *** |
2066 | */ | 2066 | */ |
2067 | void journal_refile_buffer(journal_t *journal, struct journal_head *jh) | 2067 | void jbd2_journal_refile_buffer(journal_t *journal, struct journal_head *jh) |
2068 | { | 2068 | { |
2069 | struct buffer_head *bh = jh2bh(jh); | 2069 | struct buffer_head *bh = jh2bh(jh); |
2070 | 2070 | ||
2071 | jbd_lock_bh_state(bh); | 2071 | jbd_lock_bh_state(bh); |
2072 | spin_lock(&journal->j_list_lock); | 2072 | spin_lock(&journal->j_list_lock); |
2073 | 2073 | ||
2074 | __journal_refile_buffer(jh); | 2074 | __jbd2_journal_refile_buffer(jh); |
2075 | jbd_unlock_bh_state(bh); | 2075 | jbd_unlock_bh_state(bh); |
2076 | journal_remove_journal_head(bh); | 2076 | jbd2_journal_remove_journal_head(bh); |
2077 | 2077 | ||
2078 | spin_unlock(&journal->j_list_lock); | 2078 | spin_unlock(&journal->j_list_lock); |
2079 | __brelse(bh); | 2079 | __brelse(bh); |