aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r--fs/ocfs2/journal.c72
1 files changed, 38 insertions, 34 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index c47bc2a809c2..373d94366a4c 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -215,9 +215,9 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb)
215 goto finally; 215 goto finally;
216 } 216 }
217 217
218 journal_lock_updates(journal->j_journal); 218 jbd2_journal_lock_updates(journal->j_journal);
219 status = journal_flush(journal->j_journal); 219 status = jbd2_journal_flush(journal->j_journal);
220 journal_unlock_updates(journal->j_journal); 220 jbd2_journal_unlock_updates(journal->j_journal);
221 if (status < 0) { 221 if (status < 0) {
222 up_write(&journal->j_trans_barrier); 222 up_write(&journal->j_trans_barrier);
223 mlog_errno(status); 223 mlog_errno(status);
@@ -264,7 +264,7 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
264 264
265 down_read(&osb->journal->j_trans_barrier); 265 down_read(&osb->journal->j_trans_barrier);
266 266
267 handle = journal_start(journal, max_buffs); 267 handle = jbd2_journal_start(journal, max_buffs);
268 if (IS_ERR(handle)) { 268 if (IS_ERR(handle)) {
269 up_read(&osb->journal->j_trans_barrier); 269 up_read(&osb->journal->j_trans_barrier);
270 270
@@ -290,7 +290,7 @@ int ocfs2_commit_trans(struct ocfs2_super *osb,
290 290
291 BUG_ON(!handle); 291 BUG_ON(!handle);
292 292
293 ret = journal_stop(handle); 293 ret = jbd2_journal_stop(handle);
294 if (ret < 0) 294 if (ret < 0)
295 mlog_errno(ret); 295 mlog_errno(ret);
296 296
@@ -304,7 +304,7 @@ int ocfs2_commit_trans(struct ocfs2_super *osb,
304 * transaction. extend_trans will either extend the current handle by 304 * transaction. extend_trans will either extend the current handle by
305 * nblocks, or commit it and start a new one with nblocks credits. 305 * nblocks, or commit it and start a new one with nblocks credits.
306 * 306 *
307 * This might call journal_restart() which will commit dirty buffers 307 * This might call jbd2_journal_restart() which will commit dirty buffers
308 * and then restart the transaction. Before calling 308 * and then restart the transaction. Before calling
309 * ocfs2_extend_trans(), any changed blocks should have been 309 * ocfs2_extend_trans(), any changed blocks should have been
310 * dirtied. After calling it, all blocks which need to be changed must 310 * dirtied. After calling it, all blocks which need to be changed must
@@ -332,7 +332,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
332#ifdef CONFIG_OCFS2_DEBUG_FS 332#ifdef CONFIG_OCFS2_DEBUG_FS
333 status = 1; 333 status = 1;
334#else 334#else
335 status = journal_extend(handle, nblocks); 335 status = jbd2_journal_extend(handle, nblocks);
336 if (status < 0) { 336 if (status < 0) {
337 mlog_errno(status); 337 mlog_errno(status);
338 goto bail; 338 goto bail;
@@ -340,8 +340,10 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
340#endif 340#endif
341 341
342 if (status > 0) { 342 if (status > 0) {
343 mlog(0, "journal_extend failed, trying journal_restart\n"); 343 mlog(0,
344 status = journal_restart(handle, nblocks); 344 "jbd2_journal_extend failed, trying "
345 "jbd2_journal_restart\n");
346 status = jbd2_journal_restart(handle, nblocks);
345 if (status < 0) { 347 if (status < 0) {
346 mlog_errno(status); 348 mlog_errno(status);
347 goto bail; 349 goto bail;
@@ -393,11 +395,11 @@ int ocfs2_journal_access(handle_t *handle,
393 switch (type) { 395 switch (type) {
394 case OCFS2_JOURNAL_ACCESS_CREATE: 396 case OCFS2_JOURNAL_ACCESS_CREATE:
395 case OCFS2_JOURNAL_ACCESS_WRITE: 397 case OCFS2_JOURNAL_ACCESS_WRITE:
396 status = journal_get_write_access(handle, bh); 398 status = jbd2_journal_get_write_access(handle, bh);
397 break; 399 break;
398 400
399 case OCFS2_JOURNAL_ACCESS_UNDO: 401 case OCFS2_JOURNAL_ACCESS_UNDO:
400 status = journal_get_undo_access(handle, bh); 402 status = jbd2_journal_get_undo_access(handle, bh);
401 break; 403 break;
402 404
403 default: 405 default:
@@ -422,7 +424,7 @@ int ocfs2_journal_dirty(handle_t *handle,
422 mlog_entry("(bh->b_blocknr=%llu)\n", 424 mlog_entry("(bh->b_blocknr=%llu)\n",
423 (unsigned long long)bh->b_blocknr); 425 (unsigned long long)bh->b_blocknr);
424 426
425 status = journal_dirty_metadata(handle, bh); 427 status = jbd2_journal_dirty_metadata(handle, bh);
426 if (status < 0) 428 if (status < 0)
427 mlog(ML_ERROR, "Could not dirty metadata buffer. " 429 mlog(ML_ERROR, "Could not dirty metadata buffer. "
428 "(bh->b_blocknr=%llu)\n", 430 "(bh->b_blocknr=%llu)\n",
@@ -432,6 +434,7 @@ int ocfs2_journal_dirty(handle_t *handle,
432 return status; 434 return status;
433} 435}
434 436
437#ifdef CONFIG_OCFS2_COMPAT_JBD
435int ocfs2_journal_dirty_data(handle_t *handle, 438int ocfs2_journal_dirty_data(handle_t *handle,
436 struct buffer_head *bh) 439 struct buffer_head *bh)
437{ 440{
@@ -443,8 +446,9 @@ int ocfs2_journal_dirty_data(handle_t *handle,
443 446
444 return err; 447 return err;
445} 448}
449#endif
446 450
447#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD_DEFAULT_MAX_COMMIT_AGE) 451#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE)
448 452
449void ocfs2_set_journal_params(struct ocfs2_super *osb) 453void ocfs2_set_journal_params(struct ocfs2_super *osb)
450{ 454{
@@ -457,9 +461,9 @@ void ocfs2_set_journal_params(struct ocfs2_super *osb)
457 spin_lock(&journal->j_state_lock); 461 spin_lock(&journal->j_state_lock);
458 journal->j_commit_interval = commit_interval; 462 journal->j_commit_interval = commit_interval;
459 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER) 463 if (osb->s_mount_opt & OCFS2_MOUNT_BARRIER)
460 journal->j_flags |= JFS_BARRIER; 464 journal->j_flags |= JBD2_BARRIER;
461 else 465 else
462 journal->j_flags &= ~JFS_BARRIER; 466 journal->j_flags &= ~JBD2_BARRIER;
463 spin_unlock(&journal->j_state_lock); 467 spin_unlock(&journal->j_state_lock);
464} 468}
465 469
@@ -524,14 +528,14 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty)
524 mlog(0, "inode->ip_clusters = %u\n", OCFS2_I(inode)->ip_clusters); 528 mlog(0, "inode->ip_clusters = %u\n", OCFS2_I(inode)->ip_clusters);
525 529
526 /* call the kernels journal init function now */ 530 /* call the kernels journal init function now */
527 j_journal = journal_init_inode(inode); 531 j_journal = jbd2_journal_init_inode(inode);
528 if (j_journal == NULL) { 532 if (j_journal == NULL) {
529 mlog(ML_ERROR, "Linux journal layer error\n"); 533 mlog(ML_ERROR, "Linux journal layer error\n");
530 status = -EINVAL; 534 status = -EINVAL;
531 goto done; 535 goto done;
532 } 536 }
533 537
534 mlog(0, "Returned from journal_init_inode\n"); 538 mlog(0, "Returned from jbd2_journal_init_inode\n");
535 mlog(0, "j_journal->j_maxlen = %u\n", j_journal->j_maxlen); 539 mlog(0, "j_journal->j_maxlen = %u\n", j_journal->j_maxlen);
536 540
537 *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) & 541 *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) &
@@ -639,7 +643,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
639 if (journal->j_state != OCFS2_JOURNAL_LOADED) 643 if (journal->j_state != OCFS2_JOURNAL_LOADED)
640 goto done; 644 goto done;
641 645
642 /* need to inc inode use count as journal_destroy will iput. */ 646 /* need to inc inode use count - jbd2_journal_destroy will iput. */
643 if (!igrab(inode)) 647 if (!igrab(inode))
644 BUG(); 648 BUG();
645 649
@@ -668,9 +672,9 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
668 BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); 672 BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0);
669 673
670 if (ocfs2_mount_local(osb)) { 674 if (ocfs2_mount_local(osb)) {
671 journal_lock_updates(journal->j_journal); 675 jbd2_journal_lock_updates(journal->j_journal);
672 status = journal_flush(journal->j_journal); 676 status = jbd2_journal_flush(journal->j_journal);
673 journal_unlock_updates(journal->j_journal); 677 jbd2_journal_unlock_updates(journal->j_journal);
674 if (status < 0) 678 if (status < 0)
675 mlog_errno(status); 679 mlog_errno(status);
676 } 680 }
@@ -686,7 +690,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)
686 } 690 }
687 691
688 /* Shutdown the kernel journal system */ 692 /* Shutdown the kernel journal system */
689 journal_destroy(journal->j_journal); 693 jbd2_journal_destroy(journal->j_journal);
690 694
691 OCFS2_I(inode)->ip_open_count--; 695 OCFS2_I(inode)->ip_open_count--;
692 696
@@ -711,15 +715,15 @@ static void ocfs2_clear_journal_error(struct super_block *sb,
711{ 715{
712 int olderr; 716 int olderr;
713 717
714 olderr = journal_errno(journal); 718 olderr = jbd2_journal_errno(journal);
715 if (olderr) { 719 if (olderr) {
716 mlog(ML_ERROR, "File system error %d recorded in " 720 mlog(ML_ERROR, "File system error %d recorded in "
717 "journal %u.\n", olderr, slot); 721 "journal %u.\n", olderr, slot);
718 mlog(ML_ERROR, "File system on device %s needs checking.\n", 722 mlog(ML_ERROR, "File system on device %s needs checking.\n",
719 sb->s_id); 723 sb->s_id);
720 724
721 journal_ack_err(journal); 725 jbd2_journal_ack_err(journal);
722 journal_clear_err(journal); 726 jbd2_journal_clear_err(journal);
723 } 727 }
724} 728}
725 729
@@ -734,7 +738,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed)
734 738
735 osb = journal->j_osb; 739 osb = journal->j_osb;
736 740
737 status = journal_load(journal->j_journal); 741 status = jbd2_journal_load(journal->j_journal);
738 if (status < 0) { 742 if (status < 0) {
739 mlog(ML_ERROR, "Failed to load journal!\n"); 743 mlog(ML_ERROR, "Failed to load journal!\n");
740 goto done; 744 goto done;
@@ -778,7 +782,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full)
778 782
779 BUG_ON(!journal); 783 BUG_ON(!journal);
780 784
781 status = journal_wipe(journal->j_journal, full); 785 status = jbd2_journal_wipe(journal->j_journal, full);
782 if (status < 0) { 786 if (status < 0) {
783 mlog_errno(status); 787 mlog_errno(status);
784 goto bail; 788 goto bail;
@@ -1229,19 +1233,19 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
1229 } 1233 }
1230 1234
1231 mlog(0, "calling journal_init_inode\n"); 1235 mlog(0, "calling journal_init_inode\n");
1232 journal = journal_init_inode(inode); 1236 journal = jbd2_journal_init_inode(inode);
1233 if (journal == NULL) { 1237 if (journal == NULL) {
1234 mlog(ML_ERROR, "Linux journal layer error\n"); 1238 mlog(ML_ERROR, "Linux journal layer error\n");
1235 status = -EIO; 1239 status = -EIO;
1236 goto done; 1240 goto done;
1237 } 1241 }
1238 1242
1239 status = journal_load(journal); 1243 status = jbd2_journal_load(journal);
1240 if (status < 0) { 1244 if (status < 0) {
1241 mlog_errno(status); 1245 mlog_errno(status);
1242 if (!igrab(inode)) 1246 if (!igrab(inode))
1243 BUG(); 1247 BUG();
1244 journal_destroy(journal); 1248 jbd2_journal_destroy(journal);
1245 goto done; 1249 goto done;
1246 } 1250 }
1247 1251
@@ -1249,9 +1253,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
1249 1253
1250 /* wipe the journal */ 1254 /* wipe the journal */
1251 mlog(0, "flushing the journal.\n"); 1255 mlog(0, "flushing the journal.\n");
1252 journal_lock_updates(journal); 1256 jbd2_journal_lock_updates(journal);
1253 status = journal_flush(journal); 1257 status = jbd2_journal_flush(journal);
1254 journal_unlock_updates(journal); 1258 jbd2_journal_unlock_updates(journal);
1255 if (status < 0) 1259 if (status < 0)
1256 mlog_errno(status); 1260 mlog_errno(status);
1257 1261
@@ -1272,7 +1276,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
1272 if (!igrab(inode)) 1276 if (!igrab(inode))
1273 BUG(); 1277 BUG();
1274 1278
1275 journal_destroy(journal); 1279 jbd2_journal_destroy(journal);
1276 1280
1277done: 1281done:
1278 /* drop the lock on this nodes journal */ 1282 /* drop the lock on this nodes journal */