Skip to content

Commit b80fc01

Browse files
author
Mark Fasheh
committed
ocfs2: don't unconditionally pass LVB flags
Allow a lock type to specifiy whether it makes use of the LVB. The only type which does this right now is the meta data lock. This should save us some space on network messages since they won't have to needlessly transmit value blocks. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
1 parent aa2623a commit b80fc01

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

fs/ocfs2/dlmglue.c

+15-3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ struct ocfs2_lock_res_ops {
135135
*/
136136
#define LOCK_TYPE_REQUIRES_REFRESH 0x1
137137

138+
/*
139+
* Indicate that a lock type makes use of the lock value block.
140+
*/
141+
#define LOCK_TYPE_USES_LVB 0x2
142+
138143
typedef int (ocfs2_convert_worker_t)(struct ocfs2_lock_res *, int);
139144
static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
140145
struct ocfs2_lock_res *lockres,
@@ -150,7 +155,7 @@ static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
150155
static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
151156
.get_osb = ocfs2_get_inode_osb,
152157
.unblock = ocfs2_unblock_meta,
153-
.flags = LOCK_TYPE_REQUIRES_REFRESH,
158+
.flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
154159
};
155160

156161
static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
@@ -870,6 +875,9 @@ static int ocfs2_cluster_lock(struct ocfs2_super *osb,
870875

871876
ocfs2_init_mask_waiter(&mw);
872877

878+
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
879+
lkm_flags |= LKM_VALBLK;
880+
873881
again:
874882
wait = 0;
875883

@@ -937,7 +945,7 @@ static int ocfs2_cluster_lock(struct ocfs2_super *osb,
937945
status = dlmlock(osb->dlm,
938946
level,
939947
&lockres->l_lksb,
940-
lkm_flags|LKM_CONVERT|LKM_VALBLK,
948+
lkm_flags|LKM_CONVERT,
941949
lockres->l_name,
942950
OCFS2_LOCK_ID_MAX_LEN - 1,
943951
ocfs2_locking_ast,
@@ -2212,11 +2220,15 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
22122220
{
22132221
enum dlm_status status;
22142222
unsigned long flags;
2223+
int lkm_flags = 0;
22152224

22162225
/* We didn't get anywhere near actually using this lockres. */
22172226
if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED))
22182227
goto out;
22192228

2229+
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
2230+
lkm_flags |= LKM_VALBLK;
2231+
22202232
spin_lock_irqsave(&lockres->l_lock, flags);
22212233

22222234
mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_FREEING),
@@ -2266,7 +2278,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
22662278

22672279
mlog(0, "lock %s\n", lockres->l_name);
22682280

2269-
status = dlmunlock(osb->dlm, &lockres->l_lksb, LKM_VALBLK,
2281+
status = dlmunlock(osb->dlm, &lockres->l_lksb, lkm_flags,
22702282
ocfs2_unlock_ast, lockres);
22712283
if (status != DLM_NORMAL) {
22722284
ocfs2_log_dlm_error("dlmunlock", status, lockres);

0 commit comments

Comments
 (0)