diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-01-16 11:21:12 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2009-01-28 13:55:55 -0500 |
commit | 305a47b17c6efcc0e7b67b0bd41e2c12b7af758b (patch) | |
tree | 610c0b2642815221d57f39371d854d4751596dd5 /fs/dlm | |
parent | 152a649b647a8ef47bb74ff9e11850fa6001bedc (diff) |
dlm: Change rwlock which is only used in write mode to a spinlock
The ls_dirtbl[].lock was an rwlock, but since it was only used in write
mode a spinlock will suffice.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/dir.c | 18 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 2 | ||||
-rw-r--r-- | fs/dlm/lockspace.c | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c index 92969f879a17..858fba14aaa6 100644 --- a/fs/dlm/dir.c +++ b/fs/dlm/dir.c | |||
@@ -156,7 +156,7 @@ void dlm_dir_remove_entry(struct dlm_ls *ls, int nodeid, char *name, int namelen | |||
156 | 156 | ||
157 | bucket = dir_hash(ls, name, namelen); | 157 | bucket = dir_hash(ls, name, namelen); |
158 | 158 | ||
159 | write_lock(&ls->ls_dirtbl[bucket].lock); | 159 | spin_lock(&ls->ls_dirtbl[bucket].lock); |
160 | 160 | ||
161 | de = search_bucket(ls, name, namelen, bucket); | 161 | de = search_bucket(ls, name, namelen, bucket); |
162 | 162 | ||
@@ -173,7 +173,7 @@ void dlm_dir_remove_entry(struct dlm_ls *ls, int nodeid, char *name, int namelen | |||
173 | list_del(&de->list); | 173 | list_del(&de->list); |
174 | kfree(de); | 174 | kfree(de); |
175 | out: | 175 | out: |
176 | write_unlock(&ls->ls_dirtbl[bucket].lock); | 176 | spin_unlock(&ls->ls_dirtbl[bucket].lock); |
177 | } | 177 | } |
178 | 178 | ||
179 | void dlm_dir_clear(struct dlm_ls *ls) | 179 | void dlm_dir_clear(struct dlm_ls *ls) |
@@ -185,14 +185,14 @@ void dlm_dir_clear(struct dlm_ls *ls) | |||
185 | DLM_ASSERT(list_empty(&ls->ls_recover_list), ); | 185 | DLM_ASSERT(list_empty(&ls->ls_recover_list), ); |
186 | 186 | ||
187 | for (i = 0; i < ls->ls_dirtbl_size; i++) { | 187 | for (i = 0; i < ls->ls_dirtbl_size; i++) { |
188 | write_lock(&ls->ls_dirtbl[i].lock); | 188 | spin_lock(&ls->ls_dirtbl[i].lock); |
189 | head = &ls->ls_dirtbl[i].list; | 189 | head = &ls->ls_dirtbl[i].list; |
190 | while (!list_empty(head)) { | 190 | while (!list_empty(head)) { |
191 | de = list_entry(head->next, struct dlm_direntry, list); | 191 | de = list_entry(head->next, struct dlm_direntry, list); |
192 | list_del(&de->list); | 192 | list_del(&de->list); |
193 | put_free_de(ls, de); | 193 | put_free_de(ls, de); |
194 | } | 194 | } |
195 | write_unlock(&ls->ls_dirtbl[i].lock); | 195 | spin_unlock(&ls->ls_dirtbl[i].lock); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
@@ -307,17 +307,17 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name, | |||
307 | 307 | ||
308 | bucket = dir_hash(ls, name, namelen); | 308 | bucket = dir_hash(ls, name, namelen); |
309 | 309 | ||
310 | write_lock(&ls->ls_dirtbl[bucket].lock); | 310 | spin_lock(&ls->ls_dirtbl[bucket].lock); |
311 | de = search_bucket(ls, name, namelen, bucket); | 311 | de = search_bucket(ls, name, namelen, bucket); |
312 | if (de) { | 312 | if (de) { |
313 | *r_nodeid = de->master_nodeid; | 313 | *r_nodeid = de->master_nodeid; |
314 | write_unlock(&ls->ls_dirtbl[bucket].lock); | 314 | spin_unlock(&ls->ls_dirtbl[bucket].lock); |
315 | if (*r_nodeid == nodeid) | 315 | if (*r_nodeid == nodeid) |
316 | return -EEXIST; | 316 | return -EEXIST; |
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | 319 | ||
320 | write_unlock(&ls->ls_dirtbl[bucket].lock); | 320 | spin_unlock(&ls->ls_dirtbl[bucket].lock); |
321 | 321 | ||
322 | if (namelen > DLM_RESNAME_MAXLEN) | 322 | if (namelen > DLM_RESNAME_MAXLEN) |
323 | return -EINVAL; | 323 | return -EINVAL; |
@@ -330,7 +330,7 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name, | |||
330 | de->length = namelen; | 330 | de->length = namelen; |
331 | memcpy(de->name, name, namelen); | 331 | memcpy(de->name, name, namelen); |
332 | 332 | ||
333 | write_lock(&ls->ls_dirtbl[bucket].lock); | 333 | spin_lock(&ls->ls_dirtbl[bucket].lock); |
334 | tmp = search_bucket(ls, name, namelen, bucket); | 334 | tmp = search_bucket(ls, name, namelen, bucket); |
335 | if (tmp) { | 335 | if (tmp) { |
336 | kfree(de); | 336 | kfree(de); |
@@ -339,7 +339,7 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name, | |||
339 | list_add_tail(&de->list, &ls->ls_dirtbl[bucket].list); | 339 | list_add_tail(&de->list, &ls->ls_dirtbl[bucket].list); |
340 | } | 340 | } |
341 | *r_nodeid = de->master_nodeid; | 341 | *r_nodeid = de->master_nodeid; |
342 | write_unlock(&ls->ls_dirtbl[bucket].lock); | 342 | spin_unlock(&ls->ls_dirtbl[bucket].lock); |
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index 076e86f38bc8..d01ca0a711db 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h | |||
@@ -99,7 +99,7 @@ struct dlm_direntry { | |||
99 | 99 | ||
100 | struct dlm_dirtable { | 100 | struct dlm_dirtable { |
101 | struct list_head list; | 101 | struct list_head list; |
102 | rwlock_t lock; | 102 | spinlock_t lock; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | struct dlm_rsbtable { | 105 | struct dlm_rsbtable { |
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index aa32e5f02493..cd8e2df3c295 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -487,7 +487,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
487 | goto out_lkbfree; | 487 | goto out_lkbfree; |
488 | for (i = 0; i < size; i++) { | 488 | for (i = 0; i < size; i++) { |
489 | INIT_LIST_HEAD(&ls->ls_dirtbl[i].list); | 489 | INIT_LIST_HEAD(&ls->ls_dirtbl[i].list); |
490 | rwlock_init(&ls->ls_dirtbl[i].lock); | 490 | spin_lock_init(&ls->ls_dirtbl[i].lock); |
491 | } | 491 | } |
492 | 492 | ||
493 | INIT_LIST_HEAD(&ls->ls_waiters); | 493 | INIT_LIST_HEAD(&ls->ls_waiters); |