aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-09-13 01:08:14 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-09-24 16:50:47 -0400
commitb80fc012e03f8f207911b5eafe6916b000e03c8b (patch)
tree8eaad9bc587810f76241c8edd41d34f046f72010
parentaa2623ad80577b37637914e809bafa36994ccdf1 (diff)
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>
-rw-r--r--fs/ocfs2/dlmglue.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 3d5c6a0eb9ec..40562185088a 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -135,6 +135,11 @@ struct ocfs2_lock_res_ops {
135 */ 135 */
136#define LOCK_TYPE_REQUIRES_REFRESH 0x1 136#define LOCK_TYPE_REQUIRES_REFRESH 0x1
137 137
138/*
139 * Indicate that a lock type makes use of the lock value block.
140 */
141#define LOCK_TYPE_USES_LVB 0x2
142
138typedef int (ocfs2_convert_worker_t)(struct ocfs2_lock_res *, int); 143typedef int (ocfs2_convert_worker_t)(struct ocfs2_lock_res *, int);
139static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, 144static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
140 struct ocfs2_lock_res *lockres, 145 struct ocfs2_lock_res *lockres,
@@ -150,7 +155,7 @@ static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
150static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { 155static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
151 .get_osb = ocfs2_get_inode_osb, 156 .get_osb = ocfs2_get_inode_osb,
152 .unblock = ocfs2_unblock_meta, 157 .unblock = ocfs2_unblock_meta,
153 .flags = LOCK_TYPE_REQUIRES_REFRESH, 158 .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
154}; 159};
155 160
156static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { 161static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
@@ -870,6 +875,9 @@ static int ocfs2_cluster_lock(struct ocfs2_super *osb,
870 875
871 ocfs2_init_mask_waiter(&mw); 876 ocfs2_init_mask_waiter(&mw);
872 877
878 if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
879 lkm_flags |= LKM_VALBLK;
880
873again: 881again:
874 wait = 0; 882 wait = 0;
875 883
@@ -937,7 +945,7 @@ again:
937 status = dlmlock(osb->dlm, 945 status = dlmlock(osb->dlm,
938 level, 946 level,
939 &lockres->l_lksb, 947 &lockres->l_lksb,
940 lkm_flags|LKM_CONVERT|LKM_VALBLK, 948 lkm_flags|LKM_CONVERT,
941 lockres->l_name, 949 lockres->l_name,
942 OCFS2_LOCK_ID_MAX_LEN - 1, 950 OCFS2_LOCK_ID_MAX_LEN - 1,
943 ocfs2_locking_ast, 951 ocfs2_locking_ast,
@@ -2212,11 +2220,15 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
2212{ 2220{
2213 enum dlm_status status; 2221 enum dlm_status status;
2214 unsigned long flags; 2222 unsigned long flags;
2223 int lkm_flags = 0;
2215 2224
2216 /* We didn't get anywhere near actually using this lockres. */ 2225 /* We didn't get anywhere near actually using this lockres. */
2217 if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED)) 2226 if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED))
2218 goto out; 2227 goto out;
2219 2228
2229 if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
2230 lkm_flags |= LKM_VALBLK;
2231
2220 spin_lock_irqsave(&lockres->l_lock, flags); 2232 spin_lock_irqsave(&lockres->l_lock, flags);
2221 2233
2222 mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_FREEING), 2234 mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_FREEING),
@@ -2266,7 +2278,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb,
2266 2278
2267 mlog(0, "lock %s\n", lockres->l_name); 2279 mlog(0, "lock %s\n", lockres->l_name);
2268 2280
2269 status = dlmunlock(osb->dlm, &lockres->l_lksb, LKM_VALBLK, 2281 status = dlmunlock(osb->dlm, &lockres->l_lksb, lkm_flags,
2270 ocfs2_unlock_ast, lockres); 2282 ocfs2_unlock_ast, lockres);
2271 if (status != DLM_NORMAL) { 2283 if (status != DLM_NORMAL) {
2272 ocfs2_log_dlm_error("dlmunlock", status, lockres); 2284 ocfs2_log_dlm_error("dlmunlock", status, lockres);