Skip to content

Commit aa2623a

Browse files
author
Mark Fasheh
committed
ocfs2: combine inode and generic blocking AST functions
There is extremely little difference between the two now. We can remove the callback from ocfs2_lock_res_ops as well. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
1 parent 54a7e75 commit aa2623a

File tree

1 file changed

+11
-112
lines changed

1 file changed

+11
-112
lines changed

fs/ocfs2/dlmglue.c

+11-112
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@ struct ocfs2_mask_waiter {
6767
unsigned long mw_goal;
6868
};
6969

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);
7870
static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres);
7971
static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres);
8072

@@ -123,7 +115,6 @@ struct ocfs2_lock_res_ops {
123115
* this callback if ->l_priv is not an ocfs2_super pointer
124116
*/
125117
struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *);
126-
void (*bast)(void *, int);
127118
int (*unblock)(struct ocfs2_lock_res *, struct ocfs2_unblock_ctl *);
128119
void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *);
129120

@@ -152,40 +143,34 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
152143

153144
static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
154145
.get_osb = ocfs2_get_inode_osb,
155-
.bast = ocfs2_inode_bast_func,
156146
.unblock = ocfs2_unblock_inode_lock,
157147
.flags = 0,
158148
};
159149

160150
static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
161151
.get_osb = ocfs2_get_inode_osb,
162-
.bast = ocfs2_inode_bast_func,
163152
.unblock = ocfs2_unblock_meta,
164153
.flags = LOCK_TYPE_REQUIRES_REFRESH,
165154
};
166155

167156
static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
168157
.get_osb = ocfs2_get_inode_osb,
169-
.bast = ocfs2_inode_bast_func,
170158
.unblock = ocfs2_unblock_data,
171159
.flags = 0,
172160
};
173161

174162
static struct ocfs2_lock_res_ops ocfs2_super_lops = {
175-
.bast = ocfs2_super_bast_func,
176163
.unblock = ocfs2_unblock_osb_lock,
177164
.flags = LOCK_TYPE_REQUIRES_REFRESH,
178165
};
179166

180167
static struct ocfs2_lock_res_ops ocfs2_rename_lops = {
181-
.bast = ocfs2_rename_bast_func,
182168
.unblock = ocfs2_unblock_osb_lock,
183169
.flags = 0,
184170
};
185171

186172
static struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
187173
.get_osb = ocfs2_get_dentry_osb,
188-
.bast = ocfs2_dentry_bast_func,
189174
.unblock = ocfs2_unblock_dentry_lock,
190175
.post_unlock = ocfs2_dentry_post_unlock,
191176
.flags = 0,
@@ -198,24 +183,6 @@ static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
198183
lockres->l_type == OCFS2_LOCK_TYPE_RW;
199184
}
200185

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-
219186
static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres)
220187
{
221188
BUG_ON(!ocfs2_is_inode_lock(lockres));
@@ -663,17 +630,19 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
663630
return needs_downconvert;
664631
}
665632

666-
static void ocfs2_generic_bast_func(struct ocfs2_super *osb,
667-
struct ocfs2_lock_res *lockres,
668-
int level)
633+
static void ocfs2_blocking_ast(void *opaque, int level)
669634
{
635+
struct ocfs2_lock_res *lockres = opaque;
636+
struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres);
670637
int needs_downconvert;
671638
unsigned long flags;
672639

673-
mlog_entry_void();
674-
675640
BUG_ON(level <= LKM_NLMODE);
676641

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+
677646
spin_lock_irqsave(&lockres->l_lock, flags);
678647
needs_downconvert = ocfs2_generic_handle_bast(lockres, level);
679648
if (needs_downconvert)
@@ -683,30 +652,6 @@ static void ocfs2_generic_bast_func(struct ocfs2_super *osb,
683652
wake_up(&lockres->l_event);
684653

685654
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();
710655
}
711656

712657
static void ocfs2_locking_ast(void *opaque)
@@ -751,52 +696,6 @@ static void ocfs2_locking_ast(void *opaque)
751696
spin_unlock_irqrestore(&lockres->l_lock, flags);
752697
}
753698

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-
800699
static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
801700
int convert)
802701
{
@@ -853,7 +752,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb,
853752
OCFS2_LOCK_ID_MAX_LEN - 1,
854753
ocfs2_locking_ast,
855754
lockres,
856-
lockres->l_ops->bast);
755+
ocfs2_blocking_ast);
857756
if (status != DLM_NORMAL) {
858757
ocfs2_log_dlm_error("dlmlock", status, lockres);
859758
ret = -EINVAL;
@@ -1043,7 +942,7 @@ static int ocfs2_cluster_lock(struct ocfs2_super *osb,
1043942
OCFS2_LOCK_ID_MAX_LEN - 1,
1044943
ocfs2_locking_ast,
1045944
lockres,
1046-
lockres->l_ops->bast);
945+
ocfs2_blocking_ast);
1047946
if (status != DLM_NORMAL) {
1048947
if ((lkm_flags & LKM_NOQUEUE) &&
1049948
(status == DLM_NOTQUEUED))
@@ -2524,7 +2423,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
25242423
OCFS2_LOCK_ID_MAX_LEN - 1,
25252424
ocfs2_locking_ast,
25262425
lockres,
2527-
lockres->l_ops->bast);
2426+
ocfs2_blocking_ast);
25282427
if (status != DLM_NORMAL) {
25292428
ocfs2_log_dlm_error("dlmlock", status, lockres);
25302429
ret = -EINVAL;
@@ -3040,7 +2939,7 @@ static int ocfs2_unblock_osb_lock(struct ocfs2_lock_res *lockres,
30402939

30412940
mlog(0, "Unblock lockres %s\n", lockres->l_name);
30422941

3043-
osb = ocfs2_lock_res_super(lockres);
2942+
osb = ocfs2_get_lockres_osb(lockres);
30442943

30452944
status = ocfs2_generic_unblock_lock(osb,
30462945
lockres,

0 commit comments

Comments
 (0)