diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 9336c60e3a36..47878cf16418 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -402,9 +402,7 @@ int ocfs2_commit_trans(struct ocfs2_super *osb, | |||
402 | } | 402 | } |
403 | 403 | ||
404 | /* | 404 | /* |
405 | * 'nblocks' is what you want to add to the current | 405 | * 'nblocks' is what you want to add to the current transaction. |
406 | * transaction. extend_trans will either extend the current handle by | ||
407 | * nblocks, or commit it and start a new one with nblocks credits. | ||
408 | * | 406 | * |
409 | * This might call jbd2_journal_restart() which will commit dirty buffers | 407 | * This might call jbd2_journal_restart() which will commit dirty buffers |
410 | * and then restart the transaction. Before calling | 408 | * and then restart the transaction. Before calling |
@@ -422,11 +420,15 @@ int ocfs2_commit_trans(struct ocfs2_super *osb, | |||
422 | */ | 420 | */ |
423 | int ocfs2_extend_trans(handle_t *handle, int nblocks) | 421 | int ocfs2_extend_trans(handle_t *handle, int nblocks) |
424 | { | 422 | { |
425 | int status; | 423 | int status, old_nblocks; |
426 | 424 | ||
427 | BUG_ON(!handle); | 425 | BUG_ON(!handle); |
428 | BUG_ON(!nblocks); | 426 | BUG_ON(nblocks < 0); |
427 | |||
428 | if (!nblocks) | ||
429 | return 0; | ||
429 | 430 | ||
431 | old_nblocks = handle->h_buffer_credits; | ||
430 | mlog_entry_void(); | 432 | mlog_entry_void(); |
431 | 433 | ||
432 | mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); | 434 | mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); |
@@ -445,7 +447,8 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks) | |||
445 | mlog(0, | 447 | mlog(0, |
446 | "jbd2_journal_extend failed, trying " | 448 | "jbd2_journal_extend failed, trying " |
447 | "jbd2_journal_restart\n"); | 449 | "jbd2_journal_restart\n"); |
448 | status = jbd2_journal_restart(handle, nblocks); | 450 | status = jbd2_journal_restart(handle, |
451 | old_nblocks + nblocks); | ||
449 | if (status < 0) { | 452 | if (status < 0) { |
450 | mlog_errno(status); | 453 | mlog_errno(status); |
451 | goto bail; | 454 | goto bail; |
@@ -734,8 +737,7 @@ int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, | |||
734 | return __ocfs2_journal_access(handle, ci, bh, NULL, type); | 737 | return __ocfs2_journal_access(handle, ci, bh, NULL, type); |
735 | } | 738 | } |
736 | 739 | ||
737 | int ocfs2_journal_dirty(handle_t *handle, | 740 | void ocfs2_journal_dirty(handle_t *handle, struct buffer_head *bh) |
738 | struct buffer_head *bh) | ||
739 | { | 741 | { |
740 | int status; | 742 | int status; |
741 | 743 | ||
@@ -743,13 +745,9 @@ int ocfs2_journal_dirty(handle_t *handle, | |||
743 | (unsigned long long)bh->b_blocknr); | 745 | (unsigned long long)bh->b_blocknr); |
744 | 746 | ||
745 | status = jbd2_journal_dirty_metadata(handle, bh); | 747 | status = jbd2_journal_dirty_metadata(handle, bh); |
746 | if (status < 0) | 748 | BUG_ON(status); |
747 | mlog(ML_ERROR, "Could not dirty metadata buffer. " | ||
748 | "(bh->b_blocknr=%llu)\n", | ||
749 | (unsigned long long)bh->b_blocknr); | ||
750 | 749 | ||
751 | mlog_exit(status); | 750 | mlog_exit_void(); |
752 | return status; | ||
753 | } | 751 | } |
754 | 752 | ||
755 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) | 753 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) |