diff options
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 82 |
1 files changed, 46 insertions, 36 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index c48b93ac6b65..54c16b66327e 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include "slot_map.h" | 48 | #include "slot_map.h" |
49 | #include "super.h" | 49 | #include "super.h" |
50 | #include "sysfile.h" | 50 | #include "sysfile.h" |
51 | #include "uptodate.h" | ||
51 | #include "quota.h" | 52 | #include "quota.h" |
52 | 53 | ||
53 | #include "buffer_head_io.h" | 54 | #include "buffer_head_io.h" |
@@ -554,6 +555,14 @@ static struct ocfs2_triggers eb_triggers = { | |||
554 | .ot_offset = offsetof(struct ocfs2_extent_block, h_check), | 555 | .ot_offset = offsetof(struct ocfs2_extent_block, h_check), |
555 | }; | 556 | }; |
556 | 557 | ||
558 | static struct ocfs2_triggers rb_triggers = { | ||
559 | .ot_triggers = { | ||
560 | .t_commit = ocfs2_commit_trigger, | ||
561 | .t_abort = ocfs2_abort_trigger, | ||
562 | }, | ||
563 | .ot_offset = offsetof(struct ocfs2_refcount_block, rf_check), | ||
564 | }; | ||
565 | |||
557 | static struct ocfs2_triggers gd_triggers = { | 566 | static struct ocfs2_triggers gd_triggers = { |
558 | .ot_triggers = { | 567 | .ot_triggers = { |
559 | .t_commit = ocfs2_commit_trigger, | 568 | .t_commit = ocfs2_commit_trigger, |
@@ -601,14 +610,16 @@ static struct ocfs2_triggers dl_triggers = { | |||
601 | }; | 610 | }; |
602 | 611 | ||
603 | static int __ocfs2_journal_access(handle_t *handle, | 612 | static int __ocfs2_journal_access(handle_t *handle, |
604 | struct inode *inode, | 613 | struct ocfs2_caching_info *ci, |
605 | struct buffer_head *bh, | 614 | struct buffer_head *bh, |
606 | struct ocfs2_triggers *triggers, | 615 | struct ocfs2_triggers *triggers, |
607 | int type) | 616 | int type) |
608 | { | 617 | { |
609 | int status; | 618 | int status; |
619 | struct ocfs2_super *osb = | ||
620 | OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); | ||
610 | 621 | ||
611 | BUG_ON(!inode); | 622 | BUG_ON(!ci || !ci->ci_ops); |
612 | BUG_ON(!handle); | 623 | BUG_ON(!handle); |
613 | BUG_ON(!bh); | 624 | BUG_ON(!bh); |
614 | 625 | ||
@@ -627,15 +638,15 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
627 | BUG(); | 638 | BUG(); |
628 | } | 639 | } |
629 | 640 | ||
630 | /* Set the current transaction information on the inode so | 641 | /* Set the current transaction information on the ci so |
631 | * that the locking code knows whether it can drop it's locks | 642 | * that the locking code knows whether it can drop it's locks |
632 | * on this inode or not. We're protected from the commit | 643 | * on this ci or not. We're protected from the commit |
633 | * thread updating the current transaction id until | 644 | * thread updating the current transaction id until |
634 | * ocfs2_commit_trans() because ocfs2_start_trans() took | 645 | * ocfs2_commit_trans() because ocfs2_start_trans() took |
635 | * j_trans_barrier for us. */ | 646 | * j_trans_barrier for us. */ |
636 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); | 647 | ocfs2_set_ci_lock_trans(osb->journal, ci); |
637 | 648 | ||
638 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); | 649 | ocfs2_metadata_cache_io_lock(ci); |
639 | switch (type) { | 650 | switch (type) { |
640 | case OCFS2_JOURNAL_ACCESS_CREATE: | 651 | case OCFS2_JOURNAL_ACCESS_CREATE: |
641 | case OCFS2_JOURNAL_ACCESS_WRITE: | 652 | case OCFS2_JOURNAL_ACCESS_WRITE: |
@@ -650,9 +661,9 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
650 | status = -EINVAL; | 661 | status = -EINVAL; |
651 | mlog(ML_ERROR, "Uknown access type!\n"); | 662 | mlog(ML_ERROR, "Uknown access type!\n"); |
652 | } | 663 | } |
653 | if (!status && ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)) && triggers) | 664 | if (!status && ocfs2_meta_ecc(osb) && triggers) |
654 | jbd2_journal_set_triggers(bh, &triggers->ot_triggers); | 665 | jbd2_journal_set_triggers(bh, &triggers->ot_triggers); |
655 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | 666 | ocfs2_metadata_cache_io_unlock(ci); |
656 | 667 | ||
657 | if (status < 0) | 668 | if (status < 0) |
658 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", | 669 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", |
@@ -662,66 +673,65 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
662 | return status; | 673 | return status; |
663 | } | 674 | } |
664 | 675 | ||
665 | int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, | 676 | int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci, |
666 | struct buffer_head *bh, int type) | 677 | struct buffer_head *bh, int type) |
667 | { | 678 | { |
668 | return __ocfs2_journal_access(handle, inode, bh, &di_triggers, | 679 | return __ocfs2_journal_access(handle, ci, bh, &di_triggers, type); |
669 | type); | ||
670 | } | 680 | } |
671 | 681 | ||
672 | int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, | 682 | int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci, |
673 | struct buffer_head *bh, int type) | 683 | struct buffer_head *bh, int type) |
674 | { | 684 | { |
675 | return __ocfs2_journal_access(handle, inode, bh, &eb_triggers, | 685 | return __ocfs2_journal_access(handle, ci, bh, &eb_triggers, type); |
676 | type); | ||
677 | } | 686 | } |
678 | 687 | ||
679 | int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, | 688 | int ocfs2_journal_access_rb(handle_t *handle, struct ocfs2_caching_info *ci, |
680 | struct buffer_head *bh, int type) | 689 | struct buffer_head *bh, int type) |
681 | { | 690 | { |
682 | return __ocfs2_journal_access(handle, inode, bh, &gd_triggers, | 691 | return __ocfs2_journal_access(handle, ci, bh, &rb_triggers, |
683 | type); | 692 | type); |
684 | } | 693 | } |
685 | 694 | ||
686 | int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, | 695 | int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci, |
687 | struct buffer_head *bh, int type) | 696 | struct buffer_head *bh, int type) |
688 | { | 697 | { |
689 | return __ocfs2_journal_access(handle, inode, bh, &db_triggers, | 698 | return __ocfs2_journal_access(handle, ci, bh, &gd_triggers, type); |
690 | type); | ||
691 | } | 699 | } |
692 | 700 | ||
693 | int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, | 701 | int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci, |
694 | struct buffer_head *bh, int type) | 702 | struct buffer_head *bh, int type) |
695 | { | 703 | { |
696 | return __ocfs2_journal_access(handle, inode, bh, &xb_triggers, | 704 | return __ocfs2_journal_access(handle, ci, bh, &db_triggers, type); |
697 | type); | ||
698 | } | 705 | } |
699 | 706 | ||
700 | int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, | 707 | int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci, |
701 | struct buffer_head *bh, int type) | 708 | struct buffer_head *bh, int type) |
702 | { | 709 | { |
703 | return __ocfs2_journal_access(handle, inode, bh, &dq_triggers, | 710 | return __ocfs2_journal_access(handle, ci, bh, &xb_triggers, type); |
704 | type); | ||
705 | } | 711 | } |
706 | 712 | ||
707 | int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, | 713 | int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci, |
708 | struct buffer_head *bh, int type) | 714 | struct buffer_head *bh, int type) |
709 | { | 715 | { |
710 | return __ocfs2_journal_access(handle, inode, bh, &dr_triggers, | 716 | return __ocfs2_journal_access(handle, ci, bh, &dq_triggers, type); |
711 | type); | ||
712 | } | 717 | } |
713 | 718 | ||
714 | int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, | 719 | int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci, |
715 | struct buffer_head *bh, int type) | 720 | struct buffer_head *bh, int type) |
716 | { | 721 | { |
717 | return __ocfs2_journal_access(handle, inode, bh, &dl_triggers, | 722 | return __ocfs2_journal_access(handle, ci, bh, &dr_triggers, type); |
718 | type); | 723 | } |
724 | |||
725 | int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci, | ||
726 | struct buffer_head *bh, int type) | ||
727 | { | ||
728 | return __ocfs2_journal_access(handle, ci, bh, &dl_triggers, type); | ||
719 | } | 729 | } |
720 | 730 | ||
721 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, | 731 | int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, |
722 | struct buffer_head *bh, int type) | 732 | struct buffer_head *bh, int type) |
723 | { | 733 | { |
724 | return __ocfs2_journal_access(handle, inode, bh, NULL, type); | 734 | return __ocfs2_journal_access(handle, ci, bh, NULL, type); |
725 | } | 735 | } |
726 | 736 | ||
727 | int ocfs2_journal_dirty(handle_t *handle, | 737 | int ocfs2_journal_dirty(handle_t *handle, |
@@ -898,7 +908,7 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
898 | ocfs2_bump_recovery_generation(fe); | 908 | ocfs2_bump_recovery_generation(fe); |
899 | 909 | ||
900 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); | 910 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); |
901 | status = ocfs2_write_block(osb, bh, journal->j_inode); | 911 | status = ocfs2_write_block(osb, bh, INODE_CACHE(journal->j_inode)); |
902 | if (status < 0) | 912 | if (status < 0) |
903 | mlog_errno(status); | 913 | mlog_errno(status); |
904 | 914 | ||
@@ -1642,7 +1652,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1642 | ocfs2_get_recovery_generation(fe); | 1652 | ocfs2_get_recovery_generation(fe); |
1643 | 1653 | ||
1644 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); | 1654 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); |
1645 | status = ocfs2_write_block(osb, bh, inode); | 1655 | status = ocfs2_write_block(osb, bh, INODE_CACHE(inode)); |
1646 | if (status < 0) | 1656 | if (status < 0) |
1647 | mlog_errno(status); | 1657 | mlog_errno(status); |
1648 | 1658 | ||