Commit def5b5b2 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Alasdair G Kergon

kcopyd use mutex instead of semaphore

Kcopyd uses a semaphore as mutex.  Use the mutex API instead of the (binary)
semaphore,
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 094262db
...@@ -198,7 +198,7 @@ struct kcopyd_job { ...@@ -198,7 +198,7 @@ struct kcopyd_job {
* These fields are only used if the job has been split * These fields are only used if the job has been split
* into more manageable parts. * into more manageable parts.
*/ */
struct semaphore lock; struct mutex lock;
atomic_t sub_jobs; atomic_t sub_jobs;
sector_t progress; sector_t progress;
}; };
...@@ -456,7 +456,7 @@ static void segment_complete(int read_err, ...@@ -456,7 +456,7 @@ static void segment_complete(int read_err,
sector_t count = 0; sector_t count = 0;
struct kcopyd_job *job = (struct kcopyd_job *) context; struct kcopyd_job *job = (struct kcopyd_job *) context;
down(&job->lock); mutex_lock(&job->lock);
/* update the error */ /* update the error */
if (read_err) if (read_err)
...@@ -480,7 +480,7 @@ static void segment_complete(int read_err, ...@@ -480,7 +480,7 @@ static void segment_complete(int read_err,
job->progress += count; job->progress += count;
} }
} }
up(&job->lock); mutex_unlock(&job->lock);
if (count) { if (count) {
int i; int i;
...@@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, ...@@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
dispatch_job(job); dispatch_job(job);
else { else {
init_MUTEX(&job->lock); mutex_init(&job->lock);
job->progress = 0; job->progress = 0;
split_job(job); split_job(job);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment