diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-10-19 17:38:52 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2007-10-19 21:01:08 -0400 |
commit | def5b5b26e6d97820465fadcb7d1cb73cc4daf33 (patch) | |
tree | ee9649cc571503da040ba1582688e16e52de4483 /drivers/md | |
parent | 094262db9e4c615e0db7a7b924d244b7a6c186b0 (diff) |
kcopyd use mutex instead of semaphore
Kcopyd uses a semaphore as mutex. Use the mutex API instead of the (binary)
semaphore,
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/kcopyd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index 7e052378c47e..f3831f31223e 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c | |||
@@ -198,7 +198,7 @@ struct kcopyd_job { | |||
198 | * These fields are only used if the job has been split | 198 | * These fields are only used if the job has been split |
199 | * into more manageable parts. | 199 | * into more manageable parts. |
200 | */ | 200 | */ |
201 | struct semaphore lock; | 201 | struct mutex lock; |
202 | atomic_t sub_jobs; | 202 | atomic_t sub_jobs; |
203 | sector_t progress; | 203 | sector_t progress; |
204 | }; | 204 | }; |
@@ -456,7 +456,7 @@ static void segment_complete(int read_err, | |||
456 | sector_t count = 0; | 456 | sector_t count = 0; |
457 | struct kcopyd_job *job = (struct kcopyd_job *) context; | 457 | struct kcopyd_job *job = (struct kcopyd_job *) context; |
458 | 458 | ||
459 | down(&job->lock); | 459 | mutex_lock(&job->lock); |
460 | 460 | ||
461 | /* update the error */ | 461 | /* update the error */ |
462 | if (read_err) | 462 | if (read_err) |
@@ -480,7 +480,7 @@ static void segment_complete(int read_err, | |||
480 | job->progress += count; | 480 | job->progress += count; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | up(&job->lock); | 483 | mutex_unlock(&job->lock); |
484 | 484 | ||
485 | if (count) { | 485 | if (count) { |
486 | int i; | 486 | int i; |
@@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, | |||
562 | dispatch_job(job); | 562 | dispatch_job(job); |
563 | 563 | ||
564 | else { | 564 | else { |
565 | init_MUTEX(&job->lock); | 565 | mutex_init(&job->lock); |
566 | job->progress = 0; | 566 | job->progress = 0; |
567 | split_job(job); | 567 | split_job(job); |
568 | } | 568 | } |