diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2006-09-14 01:01:16 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-09-24 16:50:48 -0400 |
commit | b5e500e23e532795fbf79a3cdbcb014f207fdb2a (patch) | |
tree | 44acf287ae9c45678d7b712518d252c95c75eb5b /fs | |
parent | cc567d89b3af4294580c9c97610d2c1018032e33 (diff) |
ocfs2: Remove ->unblock lockres operation
Have ocfs2_process_blocked_lock() call ocfs2_generic_unblock_lock(), which
gets to be ocfs2_unblock_lock() now that it's the only possible unblock
function.
Remove the ->unblock() callback from the structure, and all lock type
specific unblock functions.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/dlmglue.c | 152 |
1 files changed, 6 insertions, 146 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index d92756dcd477..182ff2476ccf 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -73,7 +73,7 @@ static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); | |||
73 | /* | 73 | /* |
74 | * Return value from ->downconvert_worker functions. | 74 | * Return value from ->downconvert_worker functions. |
75 | * | 75 | * |
76 | * These control the precise actions of ocfs2_generic_unblock_lock() | 76 | * These control the precise actions of ocfs2_unblock_lock() |
77 | * and ocfs2_process_blocked_lock() | 77 | * and ocfs2_process_blocked_lock() |
78 | * | 78 | * |
79 | */ | 79 | */ |
@@ -90,31 +90,19 @@ struct ocfs2_unblock_ctl { | |||
90 | enum ocfs2_unblock_action unblock_action; | 90 | enum ocfs2_unblock_action unblock_action; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static int ocfs2_unblock_meta(struct ocfs2_lock_res *lockres, | ||
94 | struct ocfs2_unblock_ctl *ctl); | ||
95 | static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, | 93 | static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, |
96 | int new_level); | 94 | int new_level); |
97 | static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres); | 95 | static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres); |
98 | 96 | ||
99 | static int ocfs2_unblock_data(struct ocfs2_lock_res *lockres, | ||
100 | struct ocfs2_unblock_ctl *ctl); | ||
101 | static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, | 97 | static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, |
102 | int blocking); | 98 | int blocking); |
103 | 99 | ||
104 | static int ocfs2_unblock_inode_lock(struct ocfs2_lock_res *lockres, | ||
105 | struct ocfs2_unblock_ctl *ctl); | ||
106 | |||
107 | static int ocfs2_unblock_dentry_lock(struct ocfs2_lock_res *lockres, | ||
108 | struct ocfs2_unblock_ctl *ctl); | ||
109 | static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, | 100 | static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, |
110 | int blocking); | 101 | int blocking); |
111 | 102 | ||
112 | static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, | 103 | static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, |
113 | struct ocfs2_lock_res *lockres); | 104 | struct ocfs2_lock_res *lockres); |
114 | 105 | ||
115 | static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres, | ||
116 | struct ocfs2_unblock_ctl *ctl); | ||
117 | |||
118 | /* | 106 | /* |
119 | * OCFS2 Lock Resource Operations | 107 | * OCFS2 Lock Resource Operations |
120 | * | 108 | * |
@@ -126,7 +114,7 @@ struct ocfs2_lock_res_ops { | |||
126 | * this callback if ->l_priv is not an ocfs2_super pointer | 114 | * this callback if ->l_priv is not an ocfs2_super pointer |
127 | */ | 115 | */ |
128 | struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *); | 116 | struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *); |
129 | int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *); | 117 | |
130 | void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *); | 118 | void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *); |
131 | 119 | ||
132 | /* | 120 | /* |
@@ -186,19 +174,13 @@ struct ocfs2_lock_res_ops { | |||
186 | */ | 174 | */ |
187 | #define LOCK_TYPE_USES_LVB 0x2 | 175 | #define LOCK_TYPE_USES_LVB 0x2 |
188 | 176 | ||
189 | static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, | ||
190 | struct ocfs2_lock_res *lockres, | ||
191 | struct ocfs2_unblock_ctl *ctl); | ||
192 | |||
193 | static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = { | 177 | static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = { |
194 | .get_osb = ocfs2_get_inode_osb, | 178 | .get_osb = ocfs2_get_inode_osb, |
195 | .unblock = ocfs2_unblock_inode_lock, | ||
196 | .flags = 0, | 179 | .flags = 0, |
197 | }; | 180 | }; |
198 | 181 | ||
199 | static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { | 182 | static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { |
200 | .get_osb = ocfs2_get_inode_osb, | 183 | .get_osb = ocfs2_get_inode_osb, |
201 | .unblock = ocfs2_unblock_meta, | ||
202 | .check_downconvert = ocfs2_check_meta_downconvert, | 184 | .check_downconvert = ocfs2_check_meta_downconvert, |
203 | .set_lvb = ocfs2_set_meta_lvb, | 185 | .set_lvb = ocfs2_set_meta_lvb, |
204 | .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB, | 186 | .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB, |
@@ -206,24 +188,20 @@ static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { | |||
206 | 188 | ||
207 | static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { | 189 | static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { |
208 | .get_osb = ocfs2_get_inode_osb, | 190 | .get_osb = ocfs2_get_inode_osb, |
209 | .unblock = ocfs2_unblock_data, | ||
210 | .downconvert_worker = ocfs2_data_convert_worker, | 191 | .downconvert_worker = ocfs2_data_convert_worker, |
211 | .flags = 0, | 192 | .flags = 0, |
212 | }; | 193 | }; |
213 | 194 | ||
214 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { | 195 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { |
215 | .unblock = ocfs2_unblock_osb_lock, | ||
216 | .flags = LOCK_TYPE_REQUIRES_REFRESH, | 196 | .flags = LOCK_TYPE_REQUIRES_REFRESH, |
217 | }; | 197 | }; |
218 | 198 | ||
219 | static struct ocfs2_lock_res_ops ocfs2_rename_lops = { | 199 | static struct ocfs2_lock_res_ops ocfs2_rename_lops = { |
220 | .unblock = ocfs2_unblock_osb_lock, | ||
221 | .flags = 0, | 200 | .flags = 0, |
222 | }; | 201 | }; |
223 | 202 | ||
224 | static struct ocfs2_lock_res_ops ocfs2_dentry_lops = { | 203 | static struct ocfs2_lock_res_ops ocfs2_dentry_lops = { |
225 | .get_osb = ocfs2_get_dentry_osb, | 204 | .get_osb = ocfs2_get_dentry_osb, |
226 | .unblock = ocfs2_unblock_dentry_lock, | ||
227 | .post_unlock = ocfs2_dentry_post_unlock, | 205 | .post_unlock = ocfs2_dentry_post_unlock, |
228 | .downconvert_worker = ocfs2_dentry_convert_worker, | 206 | .downconvert_worker = ocfs2_dentry_convert_worker, |
229 | .flags = 0, | 207 | .flags = 0, |
@@ -2553,9 +2531,9 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
2553 | return ret; | 2531 | return ret; |
2554 | } | 2532 | } |
2555 | 2533 | ||
2556 | static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, | 2534 | static int ocfs2_unblock_lock(struct ocfs2_super *osb, |
2557 | struct ocfs2_lock_res *lockres, | 2535 | struct ocfs2_lock_res *lockres, |
2558 | struct ocfs2_unblock_ctl *ctl) | 2536 | struct ocfs2_unblock_ctl *ctl) |
2559 | { | 2537 | { |
2560 | unsigned long flags; | 2538 | unsigned long flags; |
2561 | int blocking; | 2539 | int blocking; |
@@ -2694,53 +2672,6 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, | |||
2694 | return UNBLOCK_CONTINUE; | 2672 | return UNBLOCK_CONTINUE; |
2695 | } | 2673 | } |
2696 | 2674 | ||
2697 | int ocfs2_unblock_data(struct ocfs2_lock_res *lockres, | ||
2698 | struct ocfs2_unblock_ctl *ctl) | ||
2699 | { | ||
2700 | int status; | ||
2701 | struct inode *inode; | ||
2702 | struct ocfs2_super *osb; | ||
2703 | |||
2704 | mlog_entry_void(); | ||
2705 | |||
2706 | inode = ocfs2_lock_res_inode(lockres); | ||
2707 | osb = OCFS2_SB(inode->i_sb); | ||
2708 | |||
2709 | mlog(0, "unblock inode %llu\n", | ||
2710 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
2711 | |||
2712 | status = ocfs2_generic_unblock_lock(osb, lockres, ctl); | ||
2713 | if (status < 0) | ||
2714 | mlog_errno(status); | ||
2715 | |||
2716 | mlog(0, "inode %llu, requeue = %d\n", | ||
2717 | (unsigned long long)OCFS2_I(inode)->ip_blkno, ctl->requeue); | ||
2718 | |||
2719 | mlog_exit(status); | ||
2720 | return status; | ||
2721 | } | ||
2722 | |||
2723 | static int ocfs2_unblock_inode_lock(struct ocfs2_lock_res *lockres, | ||
2724 | struct ocfs2_unblock_ctl *ctl) | ||
2725 | { | ||
2726 | int status; | ||
2727 | struct inode *inode; | ||
2728 | |||
2729 | mlog_entry_void(); | ||
2730 | |||
2731 | mlog(0, "Unblock lockres %s\n", lockres->l_name); | ||
2732 | |||
2733 | inode = ocfs2_lock_res_inode(lockres); | ||
2734 | |||
2735 | status = ocfs2_generic_unblock_lock(OCFS2_SB(inode->i_sb), | ||
2736 | lockres, ctl); | ||
2737 | if (status < 0) | ||
2738 | mlog_errno(status); | ||
2739 | |||
2740 | mlog_exit(status); | ||
2741 | return status; | ||
2742 | } | ||
2743 | |||
2744 | static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, | 2675 | static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres, |
2745 | int new_level) | 2676 | int new_level) |
2746 | { | 2677 | { |
@@ -2764,31 +2695,6 @@ static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres) | |||
2764 | __ocfs2_stuff_meta_lvb(inode); | 2695 | __ocfs2_stuff_meta_lvb(inode); |
2765 | } | 2696 | } |
2766 | 2697 | ||
2767 | static int ocfs2_unblock_meta(struct ocfs2_lock_res *lockres, | ||
2768 | struct ocfs2_unblock_ctl *ctl) | ||
2769 | { | ||
2770 | int status; | ||
2771 | struct inode *inode; | ||
2772 | |||
2773 | mlog_entry_void(); | ||
2774 | |||
2775 | inode = ocfs2_lock_res_inode(lockres); | ||
2776 | |||
2777 | mlog(0, "unblock inode %llu\n", | ||
2778 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
2779 | |||
2780 | status = ocfs2_generic_unblock_lock(OCFS2_SB(inode->i_sb), | ||
2781 | lockres, ctl); | ||
2782 | if (status < 0) | ||
2783 | mlog_errno(status); | ||
2784 | |||
2785 | mlog(0, "inode %llu, requeue = %d\n", | ||
2786 | (unsigned long long)OCFS2_I(inode)->ip_blkno, ctl->requeue); | ||
2787 | |||
2788 | mlog_exit(status); | ||
2789 | return status; | ||
2790 | } | ||
2791 | |||
2792 | /* | 2698 | /* |
2793 | * Does the final reference drop on our dentry lock. Right now this | 2699 | * Does the final reference drop on our dentry lock. Right now this |
2794 | * happens in the vote thread, but we could choose to simplify the | 2700 | * happens in the vote thread, but we could choose to simplify the |
@@ -2911,51 +2817,6 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, | |||
2911 | return UNBLOCK_CONTINUE_POST; | 2817 | return UNBLOCK_CONTINUE_POST; |
2912 | } | 2818 | } |
2913 | 2819 | ||
2914 | static int ocfs2_unblock_dentry_lock(struct ocfs2_lock_res *lockres, | ||
2915 | struct ocfs2_unblock_ctl *ctl) | ||
2916 | { | ||
2917 | int ret; | ||
2918 | struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres); | ||
2919 | struct ocfs2_super *osb = OCFS2_SB(dl->dl_inode->i_sb); | ||
2920 | |||
2921 | mlog(0, "unblock dentry lock: %llu\n", | ||
2922 | (unsigned long long)OCFS2_I(dl->dl_inode)->ip_blkno); | ||
2923 | |||
2924 | ret = ocfs2_generic_unblock_lock(osb, | ||
2925 | lockres, | ||
2926 | ctl); | ||
2927 | if (ret < 0) | ||
2928 | mlog_errno(ret); | ||
2929 | |||
2930 | mlog(0, "requeue = %d, post = %d\n", ctl->requeue, ctl->unblock_action); | ||
2931 | |||
2932 | return ret; | ||
2933 | } | ||
2934 | |||
2935 | /* Generic unblock function for any lockres whose private data is an | ||
2936 | * ocfs2_super pointer. */ | ||
2937 | static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres, | ||
2938 | struct ocfs2_unblock_ctl *ctl) | ||
2939 | { | ||
2940 | int status; | ||
2941 | struct ocfs2_super *osb; | ||
2942 | |||
2943 | mlog_entry_void(); | ||
2944 | |||
2945 | mlog(0, "Unblock lockres %s\n", lockres->l_name); | ||
2946 | |||
2947 | osb = ocfs2_get_lockres_osb(lockres); | ||
2948 | |||
2949 | status = ocfs2_generic_unblock_lock(osb, | ||
2950 | lockres, | ||
2951 | ctl); | ||
2952 | if (status < 0) | ||
2953 | mlog_errno(status); | ||
2954 | |||
2955 | mlog_exit(status); | ||
2956 | return status; | ||
2957 | } | ||
2958 | |||
2959 | void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | 2820 | void ocfs2_process_blocked_lock(struct ocfs2_super *osb, |
2960 | struct ocfs2_lock_res *lockres) | 2821 | struct ocfs2_lock_res *lockres) |
2961 | { | 2822 | { |
@@ -2971,7 +2832,6 @@ void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | |||
2971 | 2832 | ||
2972 | BUG_ON(!lockres); | 2833 | BUG_ON(!lockres); |
2973 | BUG_ON(!lockres->l_ops); | 2834 | BUG_ON(!lockres->l_ops); |
2974 | BUG_ON(!lockres->l_ops->unblock); | ||
2975 | 2835 | ||
2976 | mlog(0, "lockres %s blocked.\n", lockres->l_name); | 2836 | mlog(0, "lockres %s blocked.\n", lockres->l_name); |
2977 | 2837 | ||
@@ -2985,7 +2845,7 @@ void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | |||
2985 | goto unqueue; | 2845 | goto unqueue; |
2986 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 2846 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
2987 | 2847 | ||
2988 | status = lockres->l_ops->unblock(lockres, &ctl); | 2848 | status = ocfs2_unblock_lock(osb, lockres, &ctl); |
2989 | if (status < 0) | 2849 | if (status < 0) |
2990 | mlog_errno(status); | 2850 | mlog_errno(status); |
2991 | 2851 | ||