[PATCH] sem2mutex: fs/
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: Eric Van Hensbergen <ericvh@ericvh.myip.org> Cc: Robert Love <rml@tech9.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
e655a250d5
commit
353ab6e97b
@@ -33,13 +33,14 @@
|
||||
*/
|
||||
#define STREAM_END_SPACE 12
|
||||
|
||||
static DECLARE_MUTEX(deflate_sem);
|
||||
static DECLARE_MUTEX(inflate_sem);
|
||||
static DEFINE_MUTEX(deflate_mutex);
|
||||
static DEFINE_MUTEX(inflate_mutex);
|
||||
static z_stream inf_strm, def_strm;
|
||||
|
||||
#ifdef __KERNEL__ /* Linux-only */
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
static int __init alloc_workspaces(void)
|
||||
{
|
||||
@@ -79,11 +80,11 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
if (*dstlen <= STREAM_END_SPACE)
|
||||
return -1;
|
||||
|
||||
down(&deflate_sem);
|
||||
mutex_lock(&deflate_mutex);
|
||||
|
||||
if (Z_OK != zlib_deflateInit(&def_strm, 3)) {
|
||||
printk(KERN_WARNING "deflateInit failed\n");
|
||||
up(&deflate_sem);
|
||||
mutex_unlock(&deflate_mutex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
if (ret != Z_OK) {
|
||||
D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret));
|
||||
zlib_deflateEnd(&def_strm);
|
||||
up(&deflate_sem);
|
||||
mutex_unlock(&deflate_mutex);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +134,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
*sourcelen = def_strm.total_in;
|
||||
ret = 0;
|
||||
out:
|
||||
up(&deflate_sem);
|
||||
mutex_unlock(&deflate_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
|
||||
int ret;
|
||||
int wbits = MAX_WBITS;
|
||||
|
||||
down(&inflate_sem);
|
||||
mutex_lock(&inflate_mutex);
|
||||
|
||||
inf_strm.next_in = data_in;
|
||||
inf_strm.avail_in = srclen;
|
||||
@@ -173,7 +174,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
|
||||
|
||||
if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) {
|
||||
printk(KERN_WARNING "inflateInit failed\n");
|
||||
up(&inflate_sem);
|
||||
mutex_unlock(&inflate_mutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
|
||||
printk(KERN_NOTICE "inflate returned %d\n", ret);
|
||||
}
|
||||
zlib_inflateEnd(&inf_strm);
|
||||
up(&inflate_sem);
|
||||
mutex_unlock(&inflate_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user