From f116629d03655adaf7832b93b03c99391d09d4a7 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Mon, 26 Jun 2006 00:24:46 -0700 Subject: [PATCH] fs: use list_move() This patch converts the combination of list_del(A) and list_add(A, B) to list_move(A, B) under fs/. Cc: Ian Kent Acked-by: Joel Becker Cc: Neil Brown Cc: Hans Reiser Cc: Urban Widmark Acked-by: David Howells Acked-by: Mark Fasheh Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/ocfs2/dlm/dlmconvert.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'fs/ocfs2/dlm/dlmconvert.c') diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index 8285228..70888b3 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c @@ -231,8 +231,7 @@ switch_queues: lock->ml.convert_type = type; /* do not alter lock refcount. switching lists. */ - list_del_init(&lock->list); - list_add_tail(&lock->list, &res->converting); + list_move_tail(&lock->list, &res->converting); unlock_exit: spin_unlock(&lock->spinlock); @@ -248,8 +247,7 @@ void dlm_revert_pending_convert(struct dlm_lock_resource *res, struct dlm_lock *lock) { /* do not alter lock refcount. switching lists. */ - list_del_init(&lock->list); - list_add_tail(&lock->list, &res->granted); + list_move_tail(&lock->list, &res->granted); lock->ml.convert_type = LKM_IVMODE; lock->lksb->flags &= ~(DLM_LKSB_GET_LVB|DLM_LKSB_PUT_LVB); } @@ -294,8 +292,7 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, res->state |= DLM_LOCK_RES_IN_PROGRESS; /* move lock to local convert queue */ /* do not alter lock refcount. switching lists. */ - list_del_init(&lock->list); - list_add_tail(&lock->list, &res->converting); + list_move_tail(&lock->list, &res->converting); lock->convert_pending = 1; lock->ml.convert_type = type; -- cgit v1.1 From c0a8520c7333dd62624683772f31864c7f9c46d9 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 27 Apr 2006 19:07:45 -0700 Subject: ocfs2: do LVB puts in place Don't wait until the AST will be fired to do the LVB copy into the lock resource. Signed-off-by: Mark Fasheh --- fs/ocfs2/dlm/dlmconvert.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/ocfs2/dlm/dlmconvert.c') diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index 70888b3..90cbaaf 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c @@ -214,6 +214,9 @@ grant: if (lock->ml.node == dlm->node_num) mlog(0, "doing in-place convert for nonlocal lock\n"); lock->ml.type = type; + if (lock->lksb->flags & DLM_LKSB_PUT_LVB) + memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN); + status = DLM_NORMAL; *call_ast = 1; goto unlock_exit; -- cgit v1.1 From b220532a71adf65d45c3aa8a284bfa7ec57957bd Mon Sep 17 00:00:00 2001 From: Kurt Hackel Date: Mon, 1 May 2006 14:29:28 -0700 Subject: ocfs2: retry operations when a lock is marked in recovery Before checking for a nonexistent lock, make sure the lockres is not marked RECOVERING. The caller will just retry and the state should be fixed up when recovery completes. Signed-off-by: Kurt Hackel Signed-off-by: Mark Fasheh --- fs/ocfs2/dlm/dlmconvert.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'fs/ocfs2/dlm/dlmconvert.c') diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index 90cbaaf..2f7ad52 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c @@ -464,6 +464,12 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data) } spin_lock(&res->spinlock); + status = __dlm_lockres_state_to_status(res); + if (status != DLM_NORMAL) { + spin_unlock(&res->spinlock); + dlm_error(status); + goto leave; + } list_for_each(iter, &res->granted) { lock = list_entry(iter, struct dlm_lock, list); if (lock->ml.cookie == cnv->cookie && @@ -473,6 +479,20 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data) } lock = NULL; } + if (!lock) { + __dlm_print_one_lock_resource(res); + list_for_each(iter, &res->granted) { + lock = list_entry(iter, struct dlm_lock, list); + if (lock->ml.node == cnv->node_idx) { + mlog(0, "There is something here " + "for node %u, lock->ml.cookie=%llu, " + "cnv->cookie=%llu\n", cnv->node_idx, + lock->ml.cookie, cnv->cookie); + break; + } + } + lock = NULL; + } spin_unlock(&res->spinlock); if (!lock) { status = DLM_IVLOCKID; -- cgit v1.1 From 44a7f1d063bbe45773353903f36d9d88fb73d82a Mon Sep 17 00:00:00 2001 From: Kurt Hackel Date: Mon, 1 May 2006 14:29:59 -0700 Subject: ocfs2: mlog in dlm_convert_lock_handler() should be ML_ERROR Signed-off-by: Kurt Hackel Signed-off-by: Mark Fasheh --- fs/ocfs2/dlm/dlmconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/ocfs2/dlm/dlmconvert.c') diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index 2f7ad52..b24fa53 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c @@ -484,7 +484,7 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data) list_for_each(iter, &res->granted) { lock = list_entry(iter, struct dlm_lock, list); if (lock->ml.node == cnv->node_idx) { - mlog(0, "There is something here " + mlog(ML_ERROR, "There is something here " "for node %u, lock->ml.cookie=%llu, " "cnv->cookie=%llu\n", cnv->node_idx, lock->ml.cookie, cnv->cookie); -- cgit v1.1 From 43dee336c903fae15783b90983dfdedd2c7ffefc Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Mon, 1 May 2006 14:56:57 -0700 Subject: ocfs2: fix compiler warnings in dlm_convert_lock_handler() We need to cast to unsigned long long. Signed-off-by: Mark Fasheh --- fs/ocfs2/dlm/dlmconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/ocfs2/dlm/dlmconvert.c') diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index b24fa53..c764dc8 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c @@ -487,7 +487,8 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data) mlog(ML_ERROR, "There is something here " "for node %u, lock->ml.cookie=%llu, " "cnv->cookie=%llu\n", cnv->node_idx, - lock->ml.cookie, cnv->cookie); + (unsigned long long)lock->ml.cookie, + (unsigned long long)cnv->cookie); break; } } -- cgit v1.1