summaryrefslogtreecommitdiffstats
path: root/fs/dlm/lockspace.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2006-07-12 16:44:04 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-07-13 09:25:34 -0400
commit597d0cae0f99f62501e229bed50e8149604015bb (patch)
treeb6cab09ff6fe2246740848164c0a52d5c03136a0 /fs/dlm/lockspace.c
parent2eb168ca94aba3bcae350ad9b31870955174a218 (diff)
downloadlinux-597d0cae0f99f62501e229bed50e8149604015bb.tar.gz
linux-597d0cae0f99f62501e229bed50e8149604015bb.tar.bz2
linux-597d0cae0f99f62501e229bed50e8149604015bb.zip
[DLM] dlm: user locks
This changes the way the dlm handles user locks. The core dlm is now aware of user locks so they can be dealt with more efficiently. There is no more dlm_device module which previously managed its own duplicate copy of every user lock. Signed-off-by: Patrick Caulfield <pcaulfie@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r--fs/dlm/lockspace.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 9ed4b70348fb..3f6cb422ac4b 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -270,12 +270,36 @@ struct dlm_ls *dlm_find_lockspace_global(uint32_t id)
return ls;
}
-struct dlm_ls *dlm_find_lockspace_local(void *id)
+struct dlm_ls *dlm_find_lockspace_local(dlm_lockspace_t *lockspace)
{
- struct dlm_ls *ls = id;
+ struct dlm_ls *ls;
spin_lock(&lslist_lock);
- ls->ls_count++;
+ list_for_each_entry(ls, &lslist, ls_list) {
+ if (ls->ls_local_handle == lockspace) {
+ ls->ls_count++;
+ goto out;
+ }
+ }
+ ls = NULL;
+ out:
+ spin_unlock(&lslist_lock);
+ return ls;
+}
+
+struct dlm_ls *dlm_find_lockspace_device(int minor)
+{
+ struct dlm_ls *ls;
+
+ spin_lock(&lslist_lock);
+ list_for_each_entry(ls, &lslist, ls_list) {
+ if (ls->ls_device.minor == minor) {
+ ls->ls_count++;
+ goto out;
+ }
+ }
+ ls = NULL;
+ out:
spin_unlock(&lslist_lock);
return ls;
}
@@ -436,6 +460,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
init_rwsem(&ls->ls_in_recovery);
INIT_LIST_HEAD(&ls->ls_requestqueue);
mutex_init(&ls->ls_requestqueue_mutex);
+ mutex_init(&ls->ls_clear_proc_locks);
ls->ls_recover_buf = kmalloc(dlm_config.buffer_size, GFP_KERNEL);
if (!ls->ls_recover_buf)
@@ -444,6 +469,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
INIT_LIST_HEAD(&ls->ls_recover_list);
spin_lock_init(&ls->ls_recover_list_lock);
ls->ls_recover_list_count = 0;
+ ls->ls_local_handle = ls;
init_waitqueue_head(&ls->ls_wait_general);
INIT_LIST_HEAD(&ls->ls_root_list);
init_rwsem(&ls->ls_root_sem);