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/jbd2/transaction.c | |
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/jbd2/transaction.c')
-rw-r--r-- | fs/jbd2/transaction.c | 244 |
1 files changed, 122 insertions, 122 deletions
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); |