diff options
author | David Teigland <teigland@redhat.com> | 2006-07-12 17:44:04 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-13 09:25:34 -0400 |
commit | 597d0cae0f99f62501e229bed50e8149604015bb (patch) | |
tree | b6cab09ff6fe2246740848164c0a52d5c03136a0 /fs/dlm/dlm_internal.h | |
parent | 2eb168ca94aba3bcae350ad9b31870955174a218 (diff) |
[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/dlm_internal.h')
-rw-r--r-- | fs/dlm/dlm_internal.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 149106f2b80f..db080de2a7e9 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/kref.h> | 35 | #include <linux/kref.h> |
36 | #include <linux/kernel.h> | 36 | #include <linux/kernel.h> |
37 | #include <linux/jhash.h> | 37 | #include <linux/jhash.h> |
38 | #include <linux/miscdevice.h> | ||
38 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
39 | #include <asm/semaphore.h> | 40 | #include <asm/semaphore.h> |
40 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
@@ -68,6 +69,7 @@ struct dlm_mhandle; | |||
68 | #define log_error(ls, fmt, args...) \ | 69 | #define log_error(ls, fmt, args...) \ |
69 | printk(KERN_ERR "dlm: %s: " fmt "\n", (ls)->ls_name , ##args) | 70 | printk(KERN_ERR "dlm: %s: " fmt "\n", (ls)->ls_name , ##args) |
70 | 71 | ||
72 | #define DLM_LOG_DEBUG | ||
71 | #ifdef DLM_LOG_DEBUG | 73 | #ifdef DLM_LOG_DEBUG |
72 | #define log_debug(ls, fmt, args...) log_error(ls, fmt, ##args) | 74 | #define log_debug(ls, fmt, args...) log_error(ls, fmt, ##args) |
73 | #else | 75 | #else |
@@ -204,6 +206,9 @@ struct dlm_args { | |||
204 | 206 | ||
205 | #define DLM_IFL_MSTCPY 0x00010000 | 207 | #define DLM_IFL_MSTCPY 0x00010000 |
206 | #define DLM_IFL_RESEND 0x00020000 | 208 | #define DLM_IFL_RESEND 0x00020000 |
209 | #define DLM_IFL_DEAD 0x00040000 | ||
210 | #define DLM_IFL_USER 0x00000001 | ||
211 | #define DLM_IFL_ORPHAN 0x00000002 | ||
207 | 212 | ||
208 | struct dlm_lkb { | 213 | struct dlm_lkb { |
209 | struct dlm_rsb *lkb_resource; /* the rsb */ | 214 | struct dlm_rsb *lkb_resource; /* the rsb */ |
@@ -231,6 +236,7 @@ struct dlm_lkb { | |||
231 | struct list_head lkb_rsb_lookup; /* waiting for rsb lookup */ | 236 | struct list_head lkb_rsb_lookup; /* waiting for rsb lookup */ |
232 | struct list_head lkb_wait_reply; /* waiting for remote reply */ | 237 | struct list_head lkb_wait_reply; /* waiting for remote reply */ |
233 | struct list_head lkb_astqueue; /* need ast to be sent */ | 238 | struct list_head lkb_astqueue; /* need ast to be sent */ |
239 | struct list_head lkb_ownqueue; /* list of locks for a process */ | ||
234 | 240 | ||
235 | char *lkb_lvbptr; | 241 | char *lkb_lvbptr; |
236 | struct dlm_lksb *lkb_lksb; /* caller's status block */ | 242 | struct dlm_lksb *lkb_lksb; /* caller's status block */ |
@@ -409,6 +415,7 @@ struct rcom_lock { | |||
409 | 415 | ||
410 | struct dlm_ls { | 416 | struct dlm_ls { |
411 | struct list_head ls_list; /* list of lockspaces */ | 417 | struct list_head ls_list; /* list of lockspaces */ |
418 | dlm_lockspace_t *ls_local_handle; | ||
412 | uint32_t ls_global_id; /* global unique lockspace ID */ | 419 | uint32_t ls_global_id; /* global unique lockspace ID */ |
413 | uint32_t ls_exflags; | 420 | uint32_t ls_exflags; |
414 | int ls_lvblen; | 421 | int ls_lvblen; |
@@ -444,6 +451,8 @@ struct dlm_ls { | |||
444 | wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ | 451 | wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ |
445 | int ls_uevent_result; | 452 | int ls_uevent_result; |
446 | 453 | ||
454 | struct miscdevice ls_device; | ||
455 | |||
447 | /* recovery related */ | 456 | /* recovery related */ |
448 | 457 | ||
449 | struct timer_list ls_timer; | 458 | struct timer_list ls_timer; |
@@ -461,6 +470,7 @@ struct dlm_ls { | |||
461 | spinlock_t ls_recover_list_lock; | 470 | spinlock_t ls_recover_list_lock; |
462 | int ls_recover_list_count; | 471 | int ls_recover_list_count; |
463 | wait_queue_head_t ls_wait_general; | 472 | wait_queue_head_t ls_wait_general; |
473 | struct mutex ls_clear_proc_locks; | ||
464 | 474 | ||
465 | struct list_head ls_root_list; /* root resources */ | 475 | struct list_head ls_root_list; /* root resources */ |
466 | struct rw_semaphore ls_root_sem; /* protect root_list */ | 476 | struct rw_semaphore ls_root_sem; /* protect root_list */ |
@@ -475,6 +485,40 @@ struct dlm_ls { | |||
475 | #define LSFL_RCOM_READY 3 | 485 | #define LSFL_RCOM_READY 3 |
476 | #define LSFL_UEVENT_WAIT 4 | 486 | #define LSFL_UEVENT_WAIT 4 |
477 | 487 | ||
488 | /* much of this is just saving user space pointers associated with the | ||
489 | lock that we pass back to the user lib with an ast */ | ||
490 | |||
491 | struct dlm_user_args { | ||
492 | struct dlm_user_proc *proc; /* each process that opens the lockspace | ||
493 | device has private data | ||
494 | (dlm_user_proc) on the struct file, | ||
495 | the process's locks point back to it*/ | ||
496 | struct dlm_lksb lksb; | ||
497 | int old_mode; | ||
498 | int update_user_lvb; | ||
499 | struct dlm_lksb __user *user_lksb; | ||
500 | void __user *castparam; | ||
501 | void __user *castaddr; | ||
502 | void __user *bastparam; | ||
503 | void __user *bastaddr; | ||
504 | }; | ||
505 | |||
506 | #define DLM_PROC_FLAGS_CLOSING 1 | ||
507 | #define DLM_PROC_FLAGS_COMPAT 2 | ||
508 | |||
509 | /* locks list is kept so we can remove all a process's locks when it | ||
510 | exits (or orphan those that are persistent) */ | ||
511 | |||
512 | struct dlm_user_proc { | ||
513 | dlm_lockspace_t *lockspace; | ||
514 | unsigned long flags; /* DLM_PROC_FLAGS */ | ||
515 | struct list_head asts; | ||
516 | spinlock_t asts_spin; | ||
517 | struct list_head locks; | ||
518 | spinlock_t locks_spin; | ||
519 | wait_queue_head_t wait; | ||
520 | }; | ||
521 | |||
478 | static inline int dlm_locking_stopped(struct dlm_ls *ls) | 522 | static inline int dlm_locking_stopped(struct dlm_ls *ls) |
479 | { | 523 | { |
480 | return !test_bit(LSFL_RUNNING, &ls->ls_flags); | 524 | return !test_bit(LSFL_RUNNING, &ls->ls_flags); |