aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/kcopyd.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-26 04:37:14 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:55 -0500
commit14cc3e2b633bb64063698980974df4535368e98f (patch)
treed542c9db7376de199d640b8e34d5630460b217b5 /drivers/md/kcopyd.c
parent353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (diff)
[PATCH] sem2mutex: misc static one-file mutexes
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Paul Mackerras <paulus@samba.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jens Axboe <axboe@suse.de> Cc: Neil Brown <neilb@cse.unsw.edu.au> Acked-by: Alasdair G Kergon <agk@redhat.com> Cc: Greg KH <greg@kroah.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/kcopyd.c')
-rw-r--r--drivers/md/kcopyd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index 8b3515f394a6..0d54e8b7d9de 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -590,51 +590,51 @@ static void client_del(struct kcopyd_client *kc)
590 up(&_client_lock); 590 up(&_client_lock);
591} 591}
592 592
593static DECLARE_MUTEX(kcopyd_init_lock); 593static DEFINE_MUTEX(kcopyd_init_lock);
594static int kcopyd_clients = 0; 594static int kcopyd_clients = 0;
595 595
596static int kcopyd_init(void) 596static int kcopyd_init(void)
597{ 597{
598 int r; 598 int r;
599 599
600 down(&kcopyd_init_lock); 600 mutex_lock(&kcopyd_init_lock);
601 601
602 if (kcopyd_clients) { 602 if (kcopyd_clients) {
603 /* Already initialized. */ 603 /* Already initialized. */
604 kcopyd_clients++; 604 kcopyd_clients++;
605 up(&kcopyd_init_lock); 605 mutex_unlock(&kcopyd_init_lock);
606 return 0; 606 return 0;
607 } 607 }
608 608
609 r = jobs_init(); 609 r = jobs_init();
610 if (r) { 610 if (r) {
611 up(&kcopyd_init_lock); 611 mutex_unlock(&kcopyd_init_lock);
612 return r; 612 return r;
613 } 613 }
614 614
615 _kcopyd_wq = create_singlethread_workqueue("kcopyd"); 615 _kcopyd_wq = create_singlethread_workqueue("kcopyd");
616 if (!_kcopyd_wq) { 616 if (!_kcopyd_wq) {
617 jobs_exit(); 617 jobs_exit();
618 up(&kcopyd_init_lock); 618 mutex_unlock(&kcopyd_init_lock);
619 return -ENOMEM; 619 return -ENOMEM;
620 } 620 }
621 621
622 kcopyd_clients++; 622 kcopyd_clients++;
623 INIT_WORK(&_kcopyd_work, do_work, NULL); 623 INIT_WORK(&_kcopyd_work, do_work, NULL);
624 up(&kcopyd_init_lock); 624 mutex_unlock(&kcopyd_init_lock);
625 return 0; 625 return 0;
626} 626}
627 627
628static void kcopyd_exit(void) 628static void kcopyd_exit(void)
629{ 629{
630 down(&kcopyd_init_lock); 630 mutex_lock(&kcopyd_init_lock);
631 kcopyd_clients--; 631 kcopyd_clients--;
632 if (!kcopyd_clients) { 632 if (!kcopyd_clients) {
633 jobs_exit(); 633 jobs_exit();
634 destroy_workqueue(_kcopyd_wq); 634 destroy_workqueue(_kcopyd_wq);
635 _kcopyd_wq = NULL; 635 _kcopyd_wq = NULL;
636 } 636 }
637 up(&kcopyd_init_lock); 637 mutex_unlock(&kcopyd_init_lock);
638} 638}
639 639
640int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result) 640int kcopyd_client_create(unsigned int nr_pages, struct kcopyd_client **result)