diff options
author | Joel Becker <joel.becker@oracle.com> | 2009-02-12 19:41:25 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-04 19:07:50 -0400 |
commit | 0cf2f7632b1789b811ab20b611c4156e6de2b055 (patch) | |
tree | 34f7cf3584e4fa2bc187d4b75ce052cb98739b0e /fs/ocfs2/journal.c | |
parent | 292dd27ec76b96cebcef576f330ab121f59ccf05 (diff) |
ocfs2: Pass struct ocfs2_caching_info to the journal functions.
The next step in divorcing metadata I/O management from struct inode is
to pass struct ocfs2_caching_info to the journal functions. Thus the
journal locks a metadata cache with the cache io_lock function. It also
can compare ci_last_trans and ci_created_trans directly.
This is a large patch because of all the places we change
ocfs2_journal_access..(handle, inode, ...) to
ocfs2_journal_access..(handle, INODE_CACHE(inode), ...).
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index ddf08d384ba1..5b6c0e441445 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" |
@@ -601,14 +602,16 @@ static struct ocfs2_triggers dl_triggers = { | |||
601 | }; | 602 | }; |
602 | 603 | ||
603 | static int __ocfs2_journal_access(handle_t *handle, | 604 | static int __ocfs2_journal_access(handle_t *handle, |
604 | struct inode *inode, | 605 | struct ocfs2_caching_info *ci, |
605 | struct buffer_head *bh, | 606 | struct buffer_head *bh, |
606 | struct ocfs2_triggers *triggers, | 607 | struct ocfs2_triggers *triggers, |
607 | int type) | 608 | int type) |
608 | { | 609 | { |
609 | int status; | 610 | int status; |
611 | struct ocfs2_super *osb = | ||
612 | OCFS2_SB(ocfs2_metadata_cache_get_super(ci)); | ||
610 | 613 | ||
611 | BUG_ON(!inode); | 614 | BUG_ON(!ci || !ci->ci_ops); |
612 | BUG_ON(!handle); | 615 | BUG_ON(!handle); |
613 | BUG_ON(!bh); | 616 | BUG_ON(!bh); |
614 | 617 | ||
@@ -627,15 +630,15 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
627 | BUG(); | 630 | BUG(); |
628 | } | 631 | } |
629 | 632 | ||
630 | /* Set the current transaction information on the inode so | 633 | /* Set the current transaction information on the ci so |
631 | * that the locking code knows whether it can drop it's locks | 634 | * that the locking code knows whether it can drop it's locks |
632 | * on this inode or not. We're protected from the commit | 635 | * on this ci or not. We're protected from the commit |
633 | * thread updating the current transaction id until | 636 | * thread updating the current transaction id until |
634 | * ocfs2_commit_trans() because ocfs2_start_trans() took | 637 | * ocfs2_commit_trans() because ocfs2_start_trans() took |
635 | * j_trans_barrier for us. */ | 638 | * j_trans_barrier for us. */ |
636 | ocfs2_set_inode_lock_trans(OCFS2_SB(inode->i_sb)->journal, inode); | 639 | ocfs2_set_ci_lock_trans(osb->journal, ci); |
637 | 640 | ||
638 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); | 641 | ocfs2_metadata_cache_io_lock(ci); |
639 | switch (type) { | 642 | switch (type) { |
640 | case OCFS2_JOURNAL_ACCESS_CREATE: | 643 | case OCFS2_JOURNAL_ACCESS_CREATE: |
641 | case OCFS2_JOURNAL_ACCESS_WRITE: | 644 | case OCFS2_JOURNAL_ACCESS_WRITE: |
@@ -650,9 +653,9 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
650 | status = -EINVAL; | 653 | status = -EINVAL; |
651 | mlog(ML_ERROR, "Uknown access type!\n"); | 654 | mlog(ML_ERROR, "Uknown access type!\n"); |
652 | } | 655 | } |
653 | if (!status && ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)) && triggers) | 656 | if (!status && ocfs2_meta_ecc(osb) && triggers) |
654 | jbd2_journal_set_triggers(bh, &triggers->ot_triggers); | 657 | jbd2_journal_set_triggers(bh, &triggers->ot_triggers); |
655 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | 658 | ocfs2_metadata_cache_io_unlock(ci); |
656 | 659 | ||
657 | if (status < 0) | 660 | if (status < 0) |
658 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", | 661 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", |
@@ -662,66 +665,58 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
662 | return status; | 665 | return status; |
663 | } | 666 | } |
664 | 667 | ||
665 | int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, | 668 | int ocfs2_journal_access_di(handle_t *handle, struct ocfs2_caching_info *ci, |
666 | struct buffer_head *bh, int type) | 669 | struct buffer_head *bh, int type) |
667 | { | 670 | { |
668 | return __ocfs2_journal_access(handle, inode, bh, &di_triggers, | 671 | return __ocfs2_journal_access(handle, ci, bh, &di_triggers, type); |
669 | type); | ||
670 | } | 672 | } |
671 | 673 | ||
672 | int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, | 674 | int ocfs2_journal_access_eb(handle_t *handle, struct ocfs2_caching_info *ci, |
673 | struct buffer_head *bh, int type) | 675 | struct buffer_head *bh, int type) |
674 | { | 676 | { |
675 | return __ocfs2_journal_access(handle, inode, bh, &eb_triggers, | 677 | return __ocfs2_journal_access(handle, ci, bh, &eb_triggers, type); |
676 | type); | ||
677 | } | 678 | } |
678 | 679 | ||
679 | int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode, | 680 | int ocfs2_journal_access_gd(handle_t *handle, struct ocfs2_caching_info *ci, |
680 | struct buffer_head *bh, int type) | 681 | struct buffer_head *bh, int type) |
681 | { | 682 | { |
682 | return __ocfs2_journal_access(handle, inode, bh, &gd_triggers, | 683 | return __ocfs2_journal_access(handle, ci, bh, &gd_triggers, type); |
683 | type); | ||
684 | } | 684 | } |
685 | 685 | ||
686 | int ocfs2_journal_access_db(handle_t *handle, struct inode *inode, | 686 | int ocfs2_journal_access_db(handle_t *handle, struct ocfs2_caching_info *ci, |
687 | struct buffer_head *bh, int type) | 687 | struct buffer_head *bh, int type) |
688 | { | 688 | { |
689 | return __ocfs2_journal_access(handle, inode, bh, &db_triggers, | 689 | return __ocfs2_journal_access(handle, ci, bh, &db_triggers, type); |
690 | type); | ||
691 | } | 690 | } |
692 | 691 | ||
693 | int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode, | 692 | int ocfs2_journal_access_xb(handle_t *handle, struct ocfs2_caching_info *ci, |
694 | struct buffer_head *bh, int type) | 693 | struct buffer_head *bh, int type) |
695 | { | 694 | { |
696 | return __ocfs2_journal_access(handle, inode, bh, &xb_triggers, | 695 | return __ocfs2_journal_access(handle, ci, bh, &xb_triggers, type); |
697 | type); | ||
698 | } | 696 | } |
699 | 697 | ||
700 | int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode, | 698 | int ocfs2_journal_access_dq(handle_t *handle, struct ocfs2_caching_info *ci, |
701 | struct buffer_head *bh, int type) | 699 | struct buffer_head *bh, int type) |
702 | { | 700 | { |
703 | return __ocfs2_journal_access(handle, inode, bh, &dq_triggers, | 701 | return __ocfs2_journal_access(handle, ci, bh, &dq_triggers, type); |
704 | type); | ||
705 | } | 702 | } |
706 | 703 | ||
707 | int ocfs2_journal_access_dr(handle_t *handle, struct inode *inode, | 704 | int ocfs2_journal_access_dr(handle_t *handle, struct ocfs2_caching_info *ci, |
708 | struct buffer_head *bh, int type) | 705 | struct buffer_head *bh, int type) |
709 | { | 706 | { |
710 | return __ocfs2_journal_access(handle, inode, bh, &dr_triggers, | 707 | return __ocfs2_journal_access(handle, ci, bh, &dr_triggers, type); |
711 | type); | ||
712 | } | 708 | } |
713 | 709 | ||
714 | int ocfs2_journal_access_dl(handle_t *handle, struct inode *inode, | 710 | int ocfs2_journal_access_dl(handle_t *handle, struct ocfs2_caching_info *ci, |
715 | struct buffer_head *bh, int type) | 711 | struct buffer_head *bh, int type) |
716 | { | 712 | { |
717 | return __ocfs2_journal_access(handle, inode, bh, &dl_triggers, | 713 | return __ocfs2_journal_access(handle, ci, bh, &dl_triggers, type); |
718 | type); | ||
719 | } | 714 | } |
720 | 715 | ||
721 | int ocfs2_journal_access(handle_t *handle, struct inode *inode, | 716 | int ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, |
722 | struct buffer_head *bh, int type) | 717 | struct buffer_head *bh, int type) |
723 | { | 718 | { |
724 | return __ocfs2_journal_access(handle, inode, bh, NULL, type); | 719 | return __ocfs2_journal_access(handle, ci, bh, NULL, type); |
725 | } | 720 | } |
726 | 721 | ||
727 | int ocfs2_journal_dirty(handle_t *handle, | 722 | int ocfs2_journal_dirty(handle_t *handle, |