diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index c47bc2a809c2..81e40677eecb 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 | ||
435 | int ocfs2_journal_dirty_data(handle_t *handle, | 438 | int 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 | ||
449 | void ocfs2_set_journal_params(struct ocfs2_super *osb) | 453 | void 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) & |
@@ -550,8 +554,7 @@ done: | |||
550 | if (status < 0) { | 554 | if (status < 0) { |
551 | if (inode_lock) | 555 | if (inode_lock) |
552 | ocfs2_inode_unlock(inode, 1); | 556 | ocfs2_inode_unlock(inode, 1); |
553 | if (bh != NULL) | 557 | brelse(bh); |
554 | brelse(bh); | ||
555 | if (inode) { | 558 | if (inode) { |
556 | OCFS2_I(inode)->ip_open_count--; | 559 | OCFS2_I(inode)->ip_open_count--; |
557 | iput(inode); | 560 | iput(inode); |
@@ -639,7 +642,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
639 | if (journal->j_state != OCFS2_JOURNAL_LOADED) | 642 | if (journal->j_state != OCFS2_JOURNAL_LOADED) |
640 | goto done; | 643 | goto done; |
641 | 644 | ||
642 | /* need to inc inode use count as journal_destroy will iput. */ | 645 | /* need to inc inode use count - jbd2_journal_destroy will iput. */ |
643 | if (!igrab(inode)) | 646 | if (!igrab(inode)) |
644 | BUG(); | 647 | BUG(); |
645 | 648 | ||
@@ -668,9 +671,9 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
668 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); | 671 | BUG_ON(atomic_read(&(osb->journal->j_num_trans)) != 0); |
669 | 672 | ||
670 | if (ocfs2_mount_local(osb)) { | 673 | if (ocfs2_mount_local(osb)) { |
671 | journal_lock_updates(journal->j_journal); | 674 | jbd2_journal_lock_updates(journal->j_journal); |
672 | status = journal_flush(journal->j_journal); | 675 | status = jbd2_journal_flush(journal->j_journal); |
673 | journal_unlock_updates(journal->j_journal); | 676 | jbd2_journal_unlock_updates(journal->j_journal); |
674 | if (status < 0) | 677 | if (status < 0) |
675 | mlog_errno(status); | 678 | mlog_errno(status); |
676 | } | 679 | } |
@@ -686,7 +689,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
686 | } | 689 | } |
687 | 690 | ||
688 | /* Shutdown the kernel journal system */ | 691 | /* Shutdown the kernel journal system */ |
689 | journal_destroy(journal->j_journal); | 692 | jbd2_journal_destroy(journal->j_journal); |
690 | 693 | ||
691 | OCFS2_I(inode)->ip_open_count--; | 694 | OCFS2_I(inode)->ip_open_count--; |
692 | 695 | ||
@@ -711,15 +714,15 @@ static void ocfs2_clear_journal_error(struct super_block *sb, | |||
711 | { | 714 | { |
712 | int olderr; | 715 | int olderr; |
713 | 716 | ||
714 | olderr = journal_errno(journal); | 717 | olderr = jbd2_journal_errno(journal); |
715 | if (olderr) { | 718 | if (olderr) { |
716 | mlog(ML_ERROR, "File system error %d recorded in " | 719 | mlog(ML_ERROR, "File system error %d recorded in " |
717 | "journal %u.\n", olderr, slot); | 720 | "journal %u.\n", olderr, slot); |
718 | mlog(ML_ERROR, "File system on device %s needs checking.\n", | 721 | mlog(ML_ERROR, "File system on device %s needs checking.\n", |
719 | sb->s_id); | 722 | sb->s_id); |
720 | 723 | ||
721 | journal_ack_err(journal); | 724 | jbd2_journal_ack_err(journal); |
722 | journal_clear_err(journal); | 725 | jbd2_journal_clear_err(journal); |
723 | } | 726 | } |
724 | } | 727 | } |
725 | 728 | ||
@@ -734,7 +737,7 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) | |||
734 | 737 | ||
735 | osb = journal->j_osb; | 738 | osb = journal->j_osb; |
736 | 739 | ||
737 | status = journal_load(journal->j_journal); | 740 | status = jbd2_journal_load(journal->j_journal); |
738 | if (status < 0) { | 741 | if (status < 0) { |
739 | mlog(ML_ERROR, "Failed to load journal!\n"); | 742 | mlog(ML_ERROR, "Failed to load journal!\n"); |
740 | goto done; | 743 | goto done; |
@@ -778,7 +781,7 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) | |||
778 | 781 | ||
779 | BUG_ON(!journal); | 782 | BUG_ON(!journal); |
780 | 783 | ||
781 | status = journal_wipe(journal->j_journal, full); | 784 | status = jbd2_journal_wipe(journal->j_journal, full); |
782 | if (status < 0) { | 785 | if (status < 0) { |
783 | mlog_errno(status); | 786 | mlog_errno(status); |
784 | goto bail; | 787 | goto bail; |
@@ -847,9 +850,8 @@ static int ocfs2_force_read_journal(struct inode *inode) | |||
847 | 850 | ||
848 | /* We are reading journal data which should not | 851 | /* We are reading journal data which should not |
849 | * be put in the uptodate cache */ | 852 | * be put in the uptodate cache */ |
850 | status = ocfs2_read_blocks(OCFS2_SB(inode->i_sb), | 853 | status = ocfs2_read_blocks_sync(OCFS2_SB(inode->i_sb), |
851 | p_blkno, p_blocks, bhs, 0, | 854 | p_blkno, p_blocks, bhs); |
852 | NULL); | ||
853 | if (status < 0) { | 855 | if (status < 0) { |
854 | mlog_errno(status); | 856 | mlog_errno(status); |
855 | goto bail; | 857 | goto bail; |
@@ -865,8 +867,7 @@ static int ocfs2_force_read_journal(struct inode *inode) | |||
865 | 867 | ||
866 | bail: | 868 | bail: |
867 | for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++) | 869 | for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++) |
868 | if (bhs[i]) | 870 | brelse(bhs[i]); |
869 | brelse(bhs[i]); | ||
870 | mlog_exit(status); | 871 | mlog_exit(status); |
871 | return status; | 872 | return status; |
872 | } | 873 | } |
@@ -1133,7 +1134,8 @@ static int ocfs2_read_journal_inode(struct ocfs2_super *osb, | |||
1133 | } | 1134 | } |
1134 | SET_INODE_JOURNAL(inode); | 1135 | SET_INODE_JOURNAL(inode); |
1135 | 1136 | ||
1136 | status = ocfs2_read_block(osb, OCFS2_I(inode)->ip_blkno, bh, 0, inode); | 1137 | status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, bh, |
1138 | OCFS2_BH_IGNORE_CACHE); | ||
1137 | if (status < 0) { | 1139 | if (status < 0) { |
1138 | mlog_errno(status); | 1140 | mlog_errno(status); |
1139 | goto bail; | 1141 | goto bail; |
@@ -1229,19 +1231,19 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1229 | } | 1231 | } |
1230 | 1232 | ||
1231 | mlog(0, "calling journal_init_inode\n"); | 1233 | mlog(0, "calling journal_init_inode\n"); |
1232 | journal = journal_init_inode(inode); | 1234 | journal = jbd2_journal_init_inode(inode); |
1233 | if (journal == NULL) { | 1235 | if (journal == NULL) { |
1234 | mlog(ML_ERROR, "Linux journal layer error\n"); | 1236 | mlog(ML_ERROR, "Linux journal layer error\n"); |
1235 | status = -EIO; | 1237 | status = -EIO; |
1236 | goto done; | 1238 | goto done; |
1237 | } | 1239 | } |
1238 | 1240 | ||
1239 | status = journal_load(journal); | 1241 | status = jbd2_journal_load(journal); |
1240 | if (status < 0) { | 1242 | if (status < 0) { |
1241 | mlog_errno(status); | 1243 | mlog_errno(status); |
1242 | if (!igrab(inode)) | 1244 | if (!igrab(inode)) |
1243 | BUG(); | 1245 | BUG(); |
1244 | journal_destroy(journal); | 1246 | jbd2_journal_destroy(journal); |
1245 | goto done; | 1247 | goto done; |
1246 | } | 1248 | } |
1247 | 1249 | ||
@@ -1249,9 +1251,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1249 | 1251 | ||
1250 | /* wipe the journal */ | 1252 | /* wipe the journal */ |
1251 | mlog(0, "flushing the journal.\n"); | 1253 | mlog(0, "flushing the journal.\n"); |
1252 | journal_lock_updates(journal); | 1254 | jbd2_journal_lock_updates(journal); |
1253 | status = journal_flush(journal); | 1255 | status = jbd2_journal_flush(journal); |
1254 | journal_unlock_updates(journal); | 1256 | jbd2_journal_unlock_updates(journal); |
1255 | if (status < 0) | 1257 | if (status < 0) |
1256 | mlog_errno(status); | 1258 | mlog_errno(status); |
1257 | 1259 | ||
@@ -1272,7 +1274,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1272 | if (!igrab(inode)) | 1274 | if (!igrab(inode)) |
1273 | BUG(); | 1275 | BUG(); |
1274 | 1276 | ||
1275 | journal_destroy(journal); | 1277 | jbd2_journal_destroy(journal); |
1276 | 1278 | ||
1277 | done: | 1279 | done: |
1278 | /* drop the lock on this nodes journal */ | 1280 | /* drop the lock on this nodes journal */ |
@@ -1282,8 +1284,7 @@ done: | |||
1282 | if (inode) | 1284 | if (inode) |
1283 | iput(inode); | 1285 | iput(inode); |
1284 | 1286 | ||
1285 | if (bh) | 1287 | brelse(bh); |
1286 | brelse(bh); | ||
1287 | 1288 | ||
1288 | mlog_exit(status); | 1289 | mlog_exit(status); |
1289 | return status; | 1290 | return status; |