aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-06-04 10:06:21 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2008-06-27 04:39:50 -0400
commit31fcba00fe7145527b159f8893ec6c9cc61309fd (patch)
tree6fef1dc1b20166b881356159d9ac8208a9335978 /fs/gfs2
parentb2cad26cfc2091050574a460b304ed103a35dbda (diff)
[GFS2] Remove all_list from lock_dlm
I discovered that we had a list onto which every lock_dlm lock was being put. Its only function was to discover whether we'd got any locks left after umount. Since there was already a counter for that purpose as well, I removed the list. The saving is sizeof(struct list_head) per glock - well worth having. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/locking/dlm/lock.c23
-rw-r--r--fs/gfs2/locking/dlm/lock_dlm.h2
-rw-r--r--fs/gfs2/locking/dlm/mount.c6
3 files changed, 1 insertions, 30 deletions
diff --git a/fs/gfs2/locking/dlm/lock.c b/fs/gfs2/locking/dlm/lock.c
index 894df4567a03..2482c9047505 100644
--- a/fs/gfs2/locking/dlm/lock.c
+++ b/fs/gfs2/locking/dlm/lock.c
@@ -58,9 +58,6 @@ static void gdlm_delete_lp(struct gdlm_lock *lp)
58 spin_lock(&ls->async_lock); 58 spin_lock(&ls->async_lock);
59 if (!list_empty(&lp->delay_list)) 59 if (!list_empty(&lp->delay_list))
60 list_del_init(&lp->delay_list); 60 list_del_init(&lp->delay_list);
61 gdlm_assert(!list_empty(&lp->all_list), "%x,%llx", lp->lockname.ln_type,
62 (unsigned long long)lp->lockname.ln_number);
63 list_del_init(&lp->all_list);
64 ls->all_locks_count--; 61 ls->all_locks_count--;
65 spin_unlock(&ls->async_lock); 62 spin_unlock(&ls->async_lock);
66 63
@@ -397,7 +394,6 @@ static int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name,
397 INIT_LIST_HEAD(&lp->delay_list); 394 INIT_LIST_HEAD(&lp->delay_list);
398 395
399 spin_lock(&ls->async_lock); 396 spin_lock(&ls->async_lock);
400 list_add(&lp->all_list, &ls->all_locks);
401 ls->all_locks_count++; 397 ls->all_locks_count++;
402 spin_unlock(&ls->async_lock); 398 spin_unlock(&ls->async_lock);
403 399
@@ -710,22 +706,3 @@ void gdlm_submit_delayed(struct gdlm_ls *ls)
710 wake_up(&ls->thread_wait); 706 wake_up(&ls->thread_wait);
711} 707}
712 708
713int gdlm_release_all_locks(struct gdlm_ls *ls)
714{
715 struct gdlm_lock *lp, *safe;
716 int count = 0;
717
718 spin_lock(&ls->async_lock);
719 list_for_each_entry_safe(lp, safe, &ls->all_locks, all_list) {
720 list_del_init(&lp->all_list);
721
722 if (lp->lvb && lp->lvb != junk_lvb)
723 kfree(lp->lvb);
724 kfree(lp);
725 count++;
726 }
727 spin_unlock(&ls->async_lock);
728
729 return count;
730}
731
diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h
index 845a27fd303e..21cf46617d90 100644
--- a/fs/gfs2/locking/dlm/lock_dlm.h
+++ b/fs/gfs2/locking/dlm/lock_dlm.h
@@ -74,7 +74,6 @@ struct gdlm_ls {
74 spinlock_t async_lock; 74 spinlock_t async_lock;
75 struct list_head delayed; 75 struct list_head delayed;
76 struct list_head submit; 76 struct list_head submit;
77 struct list_head all_locks;
78 u32 all_locks_count; 77 u32 all_locks_count;
79 wait_queue_head_t wait_control; 78 wait_queue_head_t wait_control;
80 struct task_struct *thread; 79 struct task_struct *thread;
@@ -112,7 +111,6 @@ struct gdlm_lock {
112 unsigned long flags; /* lock_dlm flags LFL_ */ 111 unsigned long flags; /* lock_dlm flags LFL_ */
113 112
114 struct list_head delay_list; /* delayed */ 113 struct list_head delay_list; /* delayed */
115 struct list_head all_list; /* all locks for the fs */
116 struct gdlm_lock *hold_null; /* NL lock for hold_lvb */ 114 struct gdlm_lock *hold_null; /* NL lock for hold_lvb */
117}; 115};
118 116
diff --git a/fs/gfs2/locking/dlm/mount.c b/fs/gfs2/locking/dlm/mount.c
index fa31c54c2e67..947e70673eec 100644
--- a/fs/gfs2/locking/dlm/mount.c
+++ b/fs/gfs2/locking/dlm/mount.c
@@ -28,7 +28,6 @@ static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs2_sbd *sdp,
28 spin_lock_init(&ls->async_lock); 28 spin_lock_init(&ls->async_lock);
29 INIT_LIST_HEAD(&ls->delayed); 29 INIT_LIST_HEAD(&ls->delayed);
30 INIT_LIST_HEAD(&ls->submit); 30 INIT_LIST_HEAD(&ls->submit);
31 INIT_LIST_HEAD(&ls->all_locks);
32 init_waitqueue_head(&ls->thread_wait); 31 init_waitqueue_head(&ls->thread_wait);
33 init_waitqueue_head(&ls->wait_control); 32 init_waitqueue_head(&ls->wait_control);
34 ls->jid = -1; 33 ls->jid = -1;
@@ -173,7 +172,6 @@ out:
173static void gdlm_unmount(void *lockspace) 172static void gdlm_unmount(void *lockspace)
174{ 173{
175 struct gdlm_ls *ls = lockspace; 174 struct gdlm_ls *ls = lockspace;
176 int rv;
177 175
178 log_debug("unmount flags %lx", ls->flags); 176 log_debug("unmount flags %lx", ls->flags);
179 177
@@ -187,9 +185,7 @@ static void gdlm_unmount(void *lockspace)
187 gdlm_kobject_release(ls); 185 gdlm_kobject_release(ls);
188 dlm_release_lockspace(ls->dlm_lockspace, 2); 186 dlm_release_lockspace(ls->dlm_lockspace, 2);
189 gdlm_release_threads(ls); 187 gdlm_release_threads(ls);
190 rv = gdlm_release_all_locks(ls); 188 BUG_ON(ls->all_locks_count);
191 if (rv)
192 log_info("gdlm_unmount: %d stray locks freed", rv);
193out: 189out:
194 kfree(ls); 190 kfree(ls);
195} 191}