diff options
author | David Teigland <teigland@redhat.com> | 2011-04-05 14:16:24 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2011-07-15 13:30:43 -0400 |
commit | 23e8e1aaacb10d9f05e44a93e10ea4ee5b3838a5 (patch) | |
tree | 7c94bc4eeb9dfd85a26869003c56dc45fc6fd697 /fs/dlm/lockspace.c | |
parent | 883ba74f43092823d0ed4c6b21f0171e9b334607 (diff) |
dlm: use workqueue for callbacks
Instead of creating our own kthread (dlm_astd) to deliver
callbacks for all lockspaces, use a per-lockspace workqueue
to deliver the callbacks. This eliminates complications and
slowdowns from many lockspaces sharing the same thread.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 98a97762c893..a1d8f1af144b 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include "lockspace.h" | 15 | #include "lockspace.h" |
16 | #include "member.h" | 16 | #include "member.h" |
17 | #include "recoverd.h" | 17 | #include "recoverd.h" |
18 | #include "ast.h" | ||
19 | #include "dir.h" | 18 | #include "dir.h" |
20 | #include "lowcomms.h" | 19 | #include "lowcomms.h" |
21 | #include "config.h" | 20 | #include "config.h" |
@@ -24,6 +23,7 @@ | |||
24 | #include "recover.h" | 23 | #include "recover.h" |
25 | #include "requestqueue.h" | 24 | #include "requestqueue.h" |
26 | #include "user.h" | 25 | #include "user.h" |
26 | #include "ast.h" | ||
27 | 27 | ||
28 | static int ls_count; | 28 | static int ls_count; |
29 | static struct mutex ls_lock; | 29 | static struct mutex ls_lock; |
@@ -359,17 +359,10 @@ static int threads_start(void) | |||
359 | { | 359 | { |
360 | int error; | 360 | int error; |
361 | 361 | ||
362 | /* Thread which process lock requests for all lockspace's */ | ||
363 | error = dlm_astd_start(); | ||
364 | if (error) { | ||
365 | log_print("cannot start dlm_astd thread %d", error); | ||
366 | goto fail; | ||
367 | } | ||
368 | |||
369 | error = dlm_scand_start(); | 362 | error = dlm_scand_start(); |
370 | if (error) { | 363 | if (error) { |
371 | log_print("cannot start dlm_scand thread %d", error); | 364 | log_print("cannot start dlm_scand thread %d", error); |
372 | goto astd_fail; | 365 | goto fail; |
373 | } | 366 | } |
374 | 367 | ||
375 | /* Thread for sending/receiving messages for all lockspace's */ | 368 | /* Thread for sending/receiving messages for all lockspace's */ |
@@ -383,8 +376,6 @@ static int threads_start(void) | |||
383 | 376 | ||
384 | scand_fail: | 377 | scand_fail: |
385 | dlm_scand_stop(); | 378 | dlm_scand_stop(); |
386 | astd_fail: | ||
387 | dlm_astd_stop(); | ||
388 | fail: | 379 | fail: |
389 | return error; | 380 | return error; |
390 | } | 381 | } |
@@ -393,7 +384,6 @@ static void threads_stop(void) | |||
393 | { | 384 | { |
394 | dlm_scand_stop(); | 385 | dlm_scand_stop(); |
395 | dlm_lowcomms_stop(); | 386 | dlm_lowcomms_stop(); |
396 | dlm_astd_stop(); | ||
397 | } | 387 | } |
398 | 388 | ||
399 | static int new_lockspace(const char *name, int namelen, void **lockspace, | 389 | static int new_lockspace(const char *name, int namelen, void **lockspace, |
@@ -514,6 +504,9 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
514 | init_completion(&ls->ls_members_done); | 504 | init_completion(&ls->ls_members_done); |
515 | ls->ls_members_result = -1; | 505 | ls->ls_members_result = -1; |
516 | 506 | ||
507 | mutex_init(&ls->ls_cb_mutex); | ||
508 | INIT_LIST_HEAD(&ls->ls_cb_delay); | ||
509 | |||
517 | ls->ls_recoverd_task = NULL; | 510 | ls->ls_recoverd_task = NULL; |
518 | mutex_init(&ls->ls_recoverd_active); | 511 | mutex_init(&ls->ls_recoverd_active); |
519 | spin_lock_init(&ls->ls_recover_lock); | 512 | spin_lock_init(&ls->ls_recover_lock); |
@@ -547,18 +540,26 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
547 | list_add(&ls->ls_list, &lslist); | 540 | list_add(&ls->ls_list, &lslist); |
548 | spin_unlock(&lslist_lock); | 541 | spin_unlock(&lslist_lock); |
549 | 542 | ||
543 | if (flags & DLM_LSFL_FS) { | ||
544 | error = dlm_callback_start(ls); | ||
545 | if (error) { | ||
546 | log_error(ls, "can't start dlm_callback %d", error); | ||
547 | goto out_delist; | ||
548 | } | ||
549 | } | ||
550 | |||
550 | /* needs to find ls in lslist */ | 551 | /* needs to find ls in lslist */ |
551 | error = dlm_recoverd_start(ls); | 552 | error = dlm_recoverd_start(ls); |
552 | if (error) { | 553 | if (error) { |
553 | log_error(ls, "can't start dlm_recoverd %d", error); | 554 | log_error(ls, "can't start dlm_recoverd %d", error); |
554 | goto out_delist; | 555 | goto out_callback; |
555 | } | 556 | } |
556 | 557 | ||
557 | ls->ls_kobj.kset = dlm_kset; | 558 | ls->ls_kobj.kset = dlm_kset; |
558 | error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, | 559 | error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, |
559 | "%s", ls->ls_name); | 560 | "%s", ls->ls_name); |
560 | if (error) | 561 | if (error) |
561 | goto out_stop; | 562 | goto out_recoverd; |
562 | kobject_uevent(&ls->ls_kobj, KOBJ_ADD); | 563 | kobject_uevent(&ls->ls_kobj, KOBJ_ADD); |
563 | 564 | ||
564 | /* let kobject handle freeing of ls if there's an error */ | 565 | /* let kobject handle freeing of ls if there's an error */ |
@@ -572,7 +573,7 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
572 | 573 | ||
573 | error = do_uevent(ls, 1); | 574 | error = do_uevent(ls, 1); |
574 | if (error) | 575 | if (error) |
575 | goto out_stop; | 576 | goto out_recoverd; |
576 | 577 | ||
577 | wait_for_completion(&ls->ls_members_done); | 578 | wait_for_completion(&ls->ls_members_done); |
578 | error = ls->ls_members_result; | 579 | error = ls->ls_members_result; |
@@ -589,8 +590,10 @@ static int new_lockspace(const char *name, int namelen, void **lockspace, | |||
589 | do_uevent(ls, 0); | 590 | do_uevent(ls, 0); |
590 | dlm_clear_members(ls); | 591 | dlm_clear_members(ls); |
591 | kfree(ls->ls_node_array); | 592 | kfree(ls->ls_node_array); |
592 | out_stop: | 593 | out_recoverd: |
593 | dlm_recoverd_stop(ls); | 594 | dlm_recoverd_stop(ls); |
595 | out_callback: | ||
596 | dlm_callback_stop(ls); | ||
594 | out_delist: | 597 | out_delist: |
595 | spin_lock(&lslist_lock); | 598 | spin_lock(&lslist_lock); |
596 | list_del(&ls->ls_list); | 599 | list_del(&ls->ls_list); |
@@ -652,8 +655,6 @@ static int lkb_idr_free(int id, void *p, void *data) | |||
652 | { | 655 | { |
653 | struct dlm_lkb *lkb = p; | 656 | struct dlm_lkb *lkb = p; |
654 | 657 | ||
655 | dlm_del_ast(lkb); | ||
656 | |||
657 | if (lkb->lkb_lvbptr && lkb->lkb_flags & DLM_IFL_MSTCPY) | 658 | if (lkb->lkb_lvbptr && lkb->lkb_flags & DLM_IFL_MSTCPY) |
658 | dlm_free_lvb(lkb->lkb_lvbptr); | 659 | dlm_free_lvb(lkb->lkb_lvbptr); |
659 | 660 | ||
@@ -717,12 +718,12 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
717 | 718 | ||
718 | dlm_recoverd_stop(ls); | 719 | dlm_recoverd_stop(ls); |
719 | 720 | ||
721 | dlm_callback_stop(ls); | ||
722 | |||
720 | remove_lockspace(ls); | 723 | remove_lockspace(ls); |
721 | 724 | ||
722 | dlm_delete_debug_file(ls); | 725 | dlm_delete_debug_file(ls); |
723 | 726 | ||
724 | dlm_astd_suspend(); | ||
725 | |||
726 | kfree(ls->ls_recover_buf); | 727 | kfree(ls->ls_recover_buf); |
727 | 728 | ||
728 | /* | 729 | /* |
@@ -740,8 +741,6 @@ static int release_lockspace(struct dlm_ls *ls, int force) | |||
740 | idr_remove_all(&ls->ls_lkbidr); | 741 | idr_remove_all(&ls->ls_lkbidr); |
741 | idr_destroy(&ls->ls_lkbidr); | 742 | idr_destroy(&ls->ls_lkbidr); |
742 | 743 | ||
743 | dlm_astd_resume(); | ||
744 | |||
745 | /* | 744 | /* |
746 | * Free all rsb's on rsbtbl[] lists | 745 | * Free all rsb's on rsbtbl[] lists |
747 | */ | 746 | */ |