[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070427084537.GD4213@traven>
Date: Fri, 27 Apr 2007 10:45:37 +0200
From: Matthias Kaehlcke <matthias.kaehlcke@...il.com>
To: gregkh@...e.de, axboe@...nel.dk
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: [PATCH 2/5] 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@...il.com>
--
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index b46f6c5..340272a 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -195,7 +195,7 @@ struct kcopyd_job {
* These fields are only used if the job has been split
* into more manageable parts.
*/
- struct semaphore lock;
+ struct mutex lock;
atomic_t sub_jobs;
sector_t progress;
};
@@ -452,7 +452,7 @@ static void segment_complete(int read_err,
sector_t count = 0;
struct kcopyd_job *job = (struct kcopyd_job *) context;
- down(&job->lock);
+ mutex_lock(&job->lock);
/* update the error */
if (read_err)
@@ -476,7 +476,7 @@ static void segment_complete(int read_err,
job->progress += count;
}
}
- up(&job->lock);
+ mutex_unlock(&job->lock);
if (count) {
int i;
@@ -558,7 +558,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
dispatch_job(job);
else {
- init_MUTEX(&job->lock);
+ mutex_init(&job->lock);
job->progress = 0;
split_job(job);
}
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
El trabajo es el refugio de los que no tienen nada que hacer
(Oscar Wilde)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists