diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 19:06:08 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 19:06:08 -0400 |
| commit | eb99adde31b7d85c67a5e1c2fa5e098e1056dd79 (patch) | |
| tree | 05d61251361c04f3afa64c5b1fe162558724d345 | |
| parent | f6e6e883730aff2718610d3eba7608fcf73328ed (diff) | |
| parent | 3fb5a9891dbb553dda96783dbc0dc4e77cbb2529 (diff) | |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2: (56 commits)
[PATCH] fs/ocfs2/dlm/: cleanups
ocfs2: fix compiler warnings in dlm_convert_lock_handler()
ocfs2: dlm_print_one_mle() needs to be defined
ocfs2: remove whitespace in dlmunlock.c
ocfs2: move dlm work to a private work queue
ocfs2: fix incorrect error returns
ocfs2: tune down some noisy messages during dlm recovery
ocfs2: display message before waiting for recovery to complete
ocfs2: mlog in dlm_convert_lock_handler() should be ML_ERROR
ocfs2: retry operations when a lock is marked in recovery
ocfs2: use cond_resched() in dlm_thread()
ocfs2: use GFP_NOFS in some dlm operations
ocfs2: wait for recovery when starting lock mastery
ocfs2: continue recovery when a dead node is encountered
ocfs2: remove unneccesary spin_unlock() in dlm_remaster_locks()
ocfs2: dlm_remaster_locks() should never exit without completing
ocfs2: special case recovery lock in dlmlock_remote()
ocfs2: pending mastery asserts and migrations should block each other
ocfs2: temporarily disable automatic lock migration
ocfs2: do not unconditionally purge the lockres in dlmlock_remote()
...
| -rw-r--r-- | fs/ocfs2/dlm/dlmast.c | 12 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 63 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmconvert.c | 24 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmdebug.c | 6 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmdebug.h | 30 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 101 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmfs.c | 6 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmlock.c | 68 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 448 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 580 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 68 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmunlock.c | 10 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/userdlm.c | 2 |
13 files changed, 1045 insertions, 373 deletions
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c index 87ee29cad50b..42775e2bbe2c 100644 --- a/fs/ocfs2/dlm/dlmast.c +++ b/fs/ocfs2/dlm/dlmast.c | |||
| @@ -197,12 +197,14 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
| 197 | lock->ml.node == dlm->node_num ? "master" : | 197 | lock->ml.node == dlm->node_num ? "master" : |
| 198 | "remote"); | 198 | "remote"); |
| 199 | memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN); | 199 | memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN); |
| 200 | } else if (lksb->flags & DLM_LKSB_PUT_LVB) { | ||
| 201 | mlog(0, "setting lvb from lockres for %s node\n", | ||
| 202 | lock->ml.node == dlm->node_num ? "master" : | ||
| 203 | "remote"); | ||
| 204 | memcpy(res->lvb, lksb->lvb, DLM_LVB_LEN); | ||
| 205 | } | 200 | } |
| 201 | /* Do nothing for lvb put requests - they should be done in | ||
| 202 | * place when the lock is downconverted - otherwise we risk | ||
| 203 | * racing gets and puts which could result in old lvb data | ||
| 204 | * being propagated. We leave the put flag set and clear it | ||
| 205 | * here. In the future we might want to clear it at the time | ||
| 206 | * the put is actually done. | ||
| 207 | */ | ||
| 206 | spin_unlock(&res->spinlock); | 208 | spin_unlock(&res->spinlock); |
| 207 | } | 209 | } |
| 208 | 210 | ||
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 88cc43df18f1..9bdc9cf65991 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
| @@ -37,7 +37,17 @@ | |||
| 37 | #define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes | 37 | #define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes |
| 38 | #define DLM_THREAD_MS 200 // flush at least every 200 ms | 38 | #define DLM_THREAD_MS 200 // flush at least every 200 ms |
| 39 | 39 | ||
| 40 | #define DLM_HASH_BUCKETS (PAGE_SIZE / sizeof(struct hlist_head)) | 40 | #define DLM_HASH_SIZE_DEFAULT (1 << 14) |
| 41 | #if DLM_HASH_SIZE_DEFAULT < PAGE_SIZE | ||
| 42 | # define DLM_HASH_PAGES 1 | ||
| 43 | #else | ||
| 44 | # define DLM_HASH_PAGES (DLM_HASH_SIZE_DEFAULT / PAGE_SIZE) | ||
| 45 | #endif | ||
| 46 | #define DLM_BUCKETS_PER_PAGE (PAGE_SIZE / sizeof(struct hlist_head)) | ||
| 47 | #define DLM_HASH_BUCKETS (DLM_HASH_PAGES * DLM_BUCKETS_PER_PAGE) | ||
| 48 | |||
| 49 | /* Intended to make it easier for us to switch out hash functions */ | ||
| 50 | #define dlm_lockid_hash(_n, _l) full_name_hash(_n, _l) | ||
| 41 | 51 | ||
| 42 | enum dlm_ast_type { | 52 | enum dlm_ast_type { |
| 43 | DLM_AST = 0, | 53 | DLM_AST = 0, |
| @@ -61,7 +71,8 @@ static inline int dlm_is_recovery_lock(const char *lock_name, int name_len) | |||
| 61 | return 0; | 71 | return 0; |
| 62 | } | 72 | } |
| 63 | 73 | ||
| 64 | #define DLM_RECO_STATE_ACTIVE 0x0001 | 74 | #define DLM_RECO_STATE_ACTIVE 0x0001 |
| 75 | #define DLM_RECO_STATE_FINALIZE 0x0002 | ||
| 65 | 76 | ||
| 66 | struct dlm_recovery_ctxt | 77 | struct dlm_recovery_ctxt |
| 67 | { | 78 | { |
| @@ -85,7 +96,7 @@ enum dlm_ctxt_state { | |||
| 85 | struct dlm_ctxt | 96 | struct dlm_ctxt |
| 86 | { | 97 | { |
| 87 | struct list_head list; | 98 | struct list_head list; |
| 88 | struct hlist_head *lockres_hash; | 99 | struct hlist_head **lockres_hash; |
| 89 | struct list_head dirty_list; | 100 | struct list_head dirty_list; |
| 90 | struct list_head purge_list; | 101 | struct list_head purge_list; |
| 91 | struct list_head pending_asts; | 102 | struct list_head pending_asts; |
| @@ -120,6 +131,7 @@ struct dlm_ctxt | |||
| 120 | struct o2hb_callback_func dlm_hb_down; | 131 | struct o2hb_callback_func dlm_hb_down; |
| 121 | struct task_struct *dlm_thread_task; | 132 | struct task_struct *dlm_thread_task; |
| 122 | struct task_struct *dlm_reco_thread_task; | 133 | struct task_struct *dlm_reco_thread_task; |
| 134 | struct workqueue_struct *dlm_worker; | ||
| 123 | wait_queue_head_t dlm_thread_wq; | 135 | wait_queue_head_t dlm_thread_wq; |
| 124 | wait_queue_head_t dlm_reco_thread_wq; | 136 | wait_queue_head_t dlm_reco_thread_wq; |
| 125 | wait_queue_head_t ast_wq; | 137 | wait_queue_head_t ast_wq; |
| @@ -132,6 +144,11 @@ struct dlm_ctxt | |||
| 132 | struct list_head dlm_eviction_callbacks; | 144 | struct list_head dlm_eviction_callbacks; |
| 133 | }; | 145 | }; |
| 134 | 146 | ||
| 147 | static inline struct hlist_head *dlm_lockres_hash(struct dlm_ctxt *dlm, unsigned i) | ||
| 148 | { | ||
| 149 | return dlm->lockres_hash[(i / DLM_BUCKETS_PER_PAGE) % DLM_HASH_PAGES] + (i % DLM_BUCKETS_PER_PAGE); | ||
| 150 | } | ||
| 151 | |||
| 135 | /* these keventd work queue items are for less-frequently | 152 | /* these keventd work queue items are for less-frequently |
| 136 | * called functions that cannot be directly called from the | 153 | * called functions that cannot be directly called from the |
| 137 | * net message handlers for some reason, usually because | 154 | * net message handlers for some reason, usually because |
| @@ -216,20 +233,29 @@ struct dlm_lock_resource | |||
| 216 | /* WARNING: Please see the comment in dlm_init_lockres before | 233 | /* WARNING: Please see the comment in dlm_init_lockres before |
| 217 | * adding fields here. */ | 234 | * adding fields here. */ |
| 218 | struct hlist_node hash_node; | 235 | struct hlist_node hash_node; |
| 236 | struct qstr lockname; | ||
| 219 | struct kref refs; | 237 | struct kref refs; |
| 220 | 238 | ||
| 221 | /* please keep these next 3 in this order | 239 | /* |
| 222 | * some funcs want to iterate over all lists */ | 240 | * Please keep granted, converting, and blocked in this order, |
| 241 | * as some funcs want to iterate over all lists. | ||
| 242 | * | ||
| 243 | * All four lists are protected by the hash's reference. | ||
| 244 | */ | ||
| 223 | struct list_head granted; | 245 | struct list_head granted; |
| 224 | struct list_head converting; | 246 | struct list_head converting; |
| 225 | struct list_head blocked; | 247 | struct list_head blocked; |
| 248 | struct list_head purge; | ||
| 226 | 249 | ||
| 250 | /* | ||
| 251 | * These two lists require you to hold an additional reference | ||
| 252 | * while they are on the list. | ||
| 253 | */ | ||
| 227 | struct list_head dirty; | 254 | struct list_head dirty; |
| 228 | struct list_head recovering; // dlm_recovery_ctxt.resources list | 255 | struct list_head recovering; // dlm_recovery_ctxt.resources list |
| 229 | 256 | ||
| 230 | /* unused lock resources have their last_used stamped and are | 257 | /* unused lock resources have their last_used stamped and are |
| 231 | * put on a list for the dlm thread to run. */ | 258 | * put on a list for the dlm thread to run. */ |
| 232 | struct list_head purge; | ||
| 233 | unsigned long last_used; | 259 | unsigned long last_used; |
| 234 | 260 | ||
| 235 | unsigned migration_pending:1; | 261 | unsigned migration_pending:1; |
| @@ -238,7 +264,6 @@ struct dlm_lock_resource | |||
| 238 | wait_queue_head_t wq; | 264 | wait_queue_head_t wq; |
| 239 | u8 owner; //node which owns the lock resource, or unknown | 265 | u8 owner; //node which owns the lock resource, or unknown |
| 240 | u16 state; | 266 | u16 state; |
| 241 | struct qstr lockname; | ||
| 242 | char lvb[DLM_LVB_LEN]; | 267 | char lvb[DLM_LVB_LEN]; |
| 243 | }; | 268 | }; |
| 244 | 269 | ||
| @@ -300,6 +325,15 @@ enum dlm_lockres_list { | |||
| 300 | DLM_BLOCKED_LIST | 325 | DLM_BLOCKED_LIST |
| 301 | }; | 326 | }; |
| 302 | 327 | ||
| 328 | static inline int dlm_lvb_is_empty(char *lvb) | ||
| 329 | { | ||
| 330 | int i; | ||
| 331 | for (i=0; i<DLM_LVB_LEN; i++) | ||
| 332 | if (lvb[i]) | ||
| 333 | return 0; | ||
| 334 | return 1; | ||
| 335 | } | ||
| 336 | |||
| 303 | static inline struct list_head * | 337 | static inline struct list_head * |
| 304 | dlm_list_idx_to_ptr(struct dlm_lock_resource *res, enum dlm_lockres_list idx) | 338 | dlm_list_idx_to_ptr(struct dlm_lock_resource *res, enum dlm_lockres_list idx) |
| 305 | { | 339 | { |
| @@ -609,7 +643,8 @@ struct dlm_finalize_reco | |||
| 609 | { | 643 | { |
| 610 | u8 node_idx; | 644 | u8 node_idx; |
| 611 | u8 dead_node; | ||
