diff options
-rw-r--r-- | fs/ocfs2/dlmglue.c | 123 |
1 files changed, 11 insertions, 112 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 2e4d43a54652..3d5c6a0eb9ec 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -67,14 +67,6 @@ struct ocfs2_mask_waiter { | |||
67 | unsigned long mw_goal; | 67 | unsigned long mw_goal; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static void ocfs2_inode_bast_func(void *opaque, | ||
71 | int level); | ||
72 | static void ocfs2_dentry_bast_func(void *opaque, | ||
73 | int level); | ||
74 | static void ocfs2_super_bast_func(void *opaque, | ||
75 | int level); | ||
76 | static void ocfs2_rename_bast_func(void *opaque, | ||
77 | int level); | ||
78 | static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); | 70 | static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); |
79 | static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); | 71 | static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); |
80 | 72 | ||
@@ -123,7 +115,6 @@ struct ocfs2_lock_res_ops { | |||
123 | * this callback if ->l_priv is not an ocfs2_super pointer | 115 | * this callback if ->l_priv is not an ocfs2_super pointer |
124 | */ | 116 | */ |
125 | struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *); | 117 | struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *); |
126 | void (*bast)(void *, int); | ||
127 | int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *); | 118 | int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *); |
128 | void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *); | 119 | void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *); |
129 | 120 | ||
@@ -152,40 +143,34 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, | |||
152 | 143 | ||
153 | static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = { | 144 | static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = { |
154 | .get_osb = ocfs2_get_inode_osb, | 145 | .get_osb = ocfs2_get_inode_osb, |
155 | .bast = ocfs2_inode_bast_func, | ||
156 | .unblock = ocfs2_unblock_inode_lock, | 146 | .unblock = ocfs2_unblock_inode_lock, |
157 | .flags = 0, | 147 | .flags = 0, |
158 | }; | 148 | }; |
159 | 149 | ||
160 | static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { | 150 | static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { |
161 | .get_osb = ocfs2_get_inode_osb, | 151 | .get_osb = ocfs2_get_inode_osb, |
162 | .bast = ocfs2_inode_bast_func, | ||
163 | .unblock = ocfs2_unblock_meta, | 152 | .unblock = ocfs2_unblock_meta, |
164 | .flags = LOCK_TYPE_REQUIRES_REFRESH, | 153 | .flags = LOCK_TYPE_REQUIRES_REFRESH, |
165 | }; | 154 | }; |
166 | 155 | ||
167 | static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { | 156 | static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { |
168 | .get_osb = ocfs2_get_inode_osb, | 157 | .get_osb = ocfs2_get_inode_osb, |
169 | .bast = ocfs2_inode_bast_func, | ||
170 | .unblock = ocfs2_unblock_data, | 158 | .unblock = ocfs2_unblock_data, |
171 | .flags = 0, | 159 | .flags = 0, |
172 | }; | 160 | }; |
173 | 161 | ||
174 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { | 162 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { |
175 | .bast = ocfs2_super_bast_func, | ||
176 | .unblock = ocfs2_unblock_osb_lock, | 163 | .unblock = ocfs2_unblock_osb_lock, |
177 | .flags = LOCK_TYPE_REQUIRES_REFRESH, | 164 | .flags = LOCK_TYPE_REQUIRES_REFRESH, |
178 | }; | 165 | }; |
179 | 166 | ||
180 | static struct ocfs2_lock_res_ops ocfs2_rename_lops = { | 167 | static struct ocfs2_lock_res_ops ocfs2_rename_lops = { |
181 | .bast = ocfs2_rename_bast_func, | ||
182 | .unblock = ocfs2_unblock_osb_lock, | 168 | .unblock = ocfs2_unblock_osb_lock, |
183 | .flags = 0, | 169 | .flags = 0, |
184 | }; | 170 | }; |
185 | 171 | ||
186 | static struct ocfs2_lock_res_ops ocfs2_dentry_lops = { | 172 | static struct ocfs2_lock_res_ops ocfs2_dentry_lops = { |
187 | .get_osb = ocfs2_get_dentry_osb, | 173 | .get_osb = ocfs2_get_dentry_osb, |
188 | .bast = ocfs2_dentry_bast_func, | ||
189 | .unblock = ocfs2_unblock_dentry_lock, | 174 | .unblock = ocfs2_unblock_dentry_lock, |
190 | .post_unlock = ocfs2_dentry_post_unlock, | 175 | .post_unlock = ocfs2_dentry_post_unlock, |
191 | .flags = 0, | 176 | .flags = 0, |
@@ -198,24 +183,6 @@ static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) | |||
198 | lockres->l_type == OCFS2_LOCK_TYPE_RW; | 183 | lockres->l_type == OCFS2_LOCK_TYPE_RW; |
199 | } | 184 | } |
200 | 185 | ||
201 | static inline int ocfs2_is_super_lock(struct ocfs2_lock_res *lockres) | ||
202 | { | ||
203 | return lockres->l_type == OCFS2_LOCK_TYPE_SUPER; | ||
204 | } | ||
205 | |||
206 | static inline int ocfs2_is_rename_lock(struct ocfs2_lock_res *lockres) | ||
207 | { | ||
208 | return lockres->l_type == OCFS2_LOCK_TYPE_RENAME; | ||
209 | } | ||
210 | |||
211 | static inline struct ocfs2_super *ocfs2_lock_res_super(struct ocfs2_lock_res *lockres) | ||
212 | { | ||
213 | BUG_ON(!ocfs2_is_super_lock(lockres) | ||
214 | && !ocfs2_is_rename_lock(lockres)); | ||
215 | |||
216 | return (struct ocfs2_super *) lockres->l_priv; | ||
217 | } | ||
218 | |||
219 | static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres) | 186 | static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres) |
220 | { | 187 | { |
221 | BUG_ON(!ocfs2_is_inode_lock(lockres)); | 188 | BUG_ON(!ocfs2_is_inode_lock(lockres)); |
@@ -663,17 +630,19 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, | |||
663 | return needs_downconvert; | 630 | return needs_downconvert; |
664 | } | 631 | } |
665 | 632 | ||
666 | static void ocfs2_generic_bast_func(struct ocfs2_super *osb, | 633 | static void ocfs2_blocking_ast(void *opaque, int level) |
667 | struct ocfs2_lock_res *lockres, | ||
668 | int level) | ||
669 | { | 634 | { |
635 | struct ocfs2_lock_res *lockres = opaque; | ||
636 | struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres); | ||
670 | int needs_downconvert; | 637 | int needs_downconvert; |
671 | unsigned long flags; | 638 | unsigned long flags; |
672 | 639 | ||
673 | mlog_entry_void(); | ||
674 | |||
675 | BUG_ON(level <= LKM_NLMODE); | 640 | BUG_ON(level <= LKM_NLMODE); |
676 | 641 | ||
642 | mlog(0, "BAST fired for lockres %s, blocking %d, level %d type %s\n", | ||
643 | lockres->l_name, level, lockres->l_level, | ||
644 | ocfs2_lock_type_string(lockres->l_type)); | ||
645 | |||
677 | spin_lock_irqsave(&lockres->l_lock, flags); | 646 | spin_lock_irqsave(&lockres->l_lock, flags); |
678 | needs_downconvert = ocfs2_generic_handle_bast(lockres, level); | 647 | needs_downconvert = ocfs2_generic_handle_bast(lockres, level); |
679 | if (needs_downconvert) | 648 | if (needs_downconvert) |
@@ -683,30 +652,6 @@ static void ocfs2_generic_bast_func(struct ocfs2_super *osb, | |||
683 | wake_up(&lockres->l_event); | 652 | wake_up(&lockres->l_event); |
684 | 653 | ||
685 | ocfs2_kick_vote_thread(osb); | 654 | ocfs2_kick_vote_thread(osb); |
686 | |||
687 | mlog_exit_void(); | ||
688 | } | ||
689 | |||
690 | static void ocfs2_inode_bast_func(void *opaque, int level) | ||
691 | { | ||
692 | struct ocfs2_lock_res *lockres = opaque; | ||
693 | struct inode *inode; | ||
694 | struct ocfs2_super *osb; | ||
695 | |||
696 | mlog_entry_void(); | ||
697 | |||
698 | BUG_ON(!ocfs2_is_inode_lock(lockres)); | ||
699 | |||
700 | inode = ocfs2_lock_res_inode(lockres); | ||
701 | osb = OCFS2_SB(inode->i_sb); | ||
702 | |||
703 | mlog(0, "BAST fired for inode %llu, blocking %d, level %d type %s\n", | ||
704 | (unsigned long long)OCFS2_I(inode)->ip_blkno, level, | ||
705 | lockres->l_level, ocfs2_lock_type_string(lockres->l_type)); | ||
706 | |||
707 | ocfs2_generic_bast_func(osb, lockres, level); | ||
708 | |||
709 | mlog_exit_void(); | ||
710 | } | 655 | } |
711 | 656 | ||
712 | static void ocfs2_locking_ast(void *opaque) | 657 | static void ocfs2_locking_ast(void *opaque) |
@@ -751,52 +696,6 @@ static void ocfs2_locking_ast(void *opaque) | |||
751 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 696 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
752 | } | 697 | } |
753 | 698 | ||
754 | static void ocfs2_super_bast_func(void *opaque, | ||
755 | int level) | ||
756 | { | ||
757 | struct ocfs2_lock_res *lockres = opaque; | ||
758 | struct ocfs2_super *osb; | ||
759 | |||
760 | mlog_entry_void(); | ||
761 | mlog(0, "Superblock BAST fired\n"); | ||
762 | |||
763 | BUG_ON(!ocfs2_is_super_lock(lockres)); | ||
764 | osb = ocfs2_lock_res_super(lockres); | ||
765 | ocfs2_generic_bast_func(osb, lockres, level); | ||
766 | |||
767 | mlog_exit_void(); | ||
768 | } | ||
769 | |||
770 | static void ocfs2_rename_bast_func(void *opaque, | ||
771 | int level) | ||
772 | { | ||
773 | struct ocfs2_lock_res *lockres = opaque; | ||
774 | struct ocfs2_super *osb; | ||
775 | |||
776 | mlog_entry_void(); | ||
777 | |||
778 | mlog(0, "Rename BAST fired\n"); | ||
779 | |||
780 | BUG_ON(!ocfs2_is_rename_lock(lockres)); | ||
781 | |||
782 | osb = ocfs2_lock_res_super(lockres); | ||
783 | ocfs2_generic_bast_func(osb, lockres, level); | ||
784 | |||
785 | mlog_exit_void(); | ||
786 | } | ||
787 | |||
788 | static void ocfs2_dentry_bast_func(void *opaque, int level) | ||
789 | { | ||
790 | struct ocfs2_lock_res *lockres = opaque; | ||
791 | struct ocfs2_dentry_lock *dl = lockres->l_priv; | ||
792 | struct ocfs2_super *osb = OCFS2_SB(dl->dl_inode->i_sb); | ||
793 | |||
794 | mlog(0, "Dentry bast: level: %d, name: %s\n", level, | ||
795 | lockres->l_name); | ||
796 | |||
797 | ocfs2_generic_bast_func(osb, lockres, level); | ||
798 | } | ||
799 | |||
800 | static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, | 699 | static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, |
801 | int convert) | 700 | int convert) |
802 | { | 701 | { |
@@ -853,7 +752,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
853 | OCFS2_LOCK_ID_MAX_LEN - 1, | 752 | OCFS2_LOCK_ID_MAX_LEN - 1, |
854 | ocfs2_locking_ast, | 753 | ocfs2_locking_ast, |
855 | lockres, | 754 | lockres, |
856 | lockres->l_ops->bast); | 755 | ocfs2_blocking_ast); |
857 | if (status != DLM_NORMAL) { | 756 | if (status != DLM_NORMAL) { |
858 | ocfs2_log_dlm_error("dlmlock", status, lockres); | 757 | ocfs2_log_dlm_error("dlmlock", status, lockres); |
859 | ret = -EINVAL; | 758 | ret = -EINVAL; |
@@ -1043,7 +942,7 @@ again: | |||
1043 | OCFS2_LOCK_ID_MAX_LEN - 1, | 942 | OCFS2_LOCK_ID_MAX_LEN - 1, |
1044 | ocfs2_locking_ast, | 943 | ocfs2_locking_ast, |
1045 | lockres, | 944 | lockres, |
1046 | lockres->l_ops->bast); | 945 | ocfs2_blocking_ast); |
1047 | if (status != DLM_NORMAL) { | 946 | if (status != DLM_NORMAL) { |
1048 | if ((lkm_flags & LKM_NOQUEUE) && | 947 | if ((lkm_flags & LKM_NOQUEUE) && |
1049 | (status == DLM_NOTQUEUED)) | 948 | (status == DLM_NOTQUEUED)) |
@@ -2524,7 +2423,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb, | |||
2524 | OCFS2_LOCK_ID_MAX_LEN - 1, | 2423 | OCFS2_LOCK_ID_MAX_LEN - 1, |
2525 | ocfs2_locking_ast, | 2424 | ocfs2_locking_ast, |
2526 | lockres, | 2425 | lockres, |
2527 | lockres->l_ops->bast); | 2426 | ocfs2_blocking_ast); |
2528 | if (status != DLM_NORMAL) { | 2427 | if (status != DLM_NORMAL) { |
2529 | ocfs2_log_dlm_error("dlmlock", status, lockres); | 2428 | ocfs2_log_dlm_error("dlmlock", status, lockres); |
2530 | ret = -EINVAL; | 2429 | ret = -EINVAL; |
@@ -3040,7 +2939,7 @@ static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres, | |||
3040 | 2939 | ||
3041 | mlog(0, "Unblock lockres %s\n", lockres->l_name); | 2940 | mlog(0, "Unblock lockres %s\n", lockres->l_name); |
3042 | 2941 | ||
3043 | osb = ocfs2_lock_res_super(lockres); | 2942 | osb = ocfs2_get_lockres_osb(lockres); |
3044 | 2943 | ||
3045 | status = ocfs2_generic_unblock_lock(osb, | 2944 | status = ocfs2_generic_unblock_lock(osb, |
3046 | lockres, | 2945 | lockres, |