public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* jffs2 & new linux zlib
@ 2002-02-19 14:24 Clive Davies
  2002-02-20  6:33 ` Slow jffs2 startup on DOM Michael Michael
  0 siblings, 1 reply; 15+ messages in thread
From: Clive Davies @ 2002-02-19 14:24 UTC (permalink / raw)
  To: linux-mtd

In testing jffs2 in linux 2.5.4-rmk1 I've found that kmalloc cannot allocate 
objects of the size returned by zlib_deflate_workspacesize() and 
zlib_inflate_workspacesize(). The patch below uses vmalloc to sucessfully 
allocate the memory, however I'm not sure that this is the best approach., 
maybe it would be better to try and reduce the size of the deflate_workspace 
& inflate workspace in zlib? (This might be a ridiculous idea, I haven't a 
clue how zlib works) Any suggestions?

--- linux_2.5.4-rmk1/fs/jffs2/compr_zlib.c	Mon Feb 11 01:50:06 2002
+++ linux/fs/jffs2/compr_zlib.c	Tue Feb 19 13:33:24 2002
@@ -80,8 +80,7 @@ int zlib_compress(unsigned char *data_in
 		return -1;
 
 #ifdef __KERNEL__
-	strm.workspace = kmalloc(zlib_deflate_workspacesize(),
-				 GFP_KERNEL);
+	strm.workspace = vmalloc(zlib_deflate_workspacesize());
 	if (strm.workspace == NULL) {
 		printk(KERN_WARNING "deflateInit alloc of workspace failed\n");
 		return -1;
@@ -123,7 +122,7 @@ int zlib_compress(unsigned char *data_in
 
 	}
 	zlib_deflateEnd(&strm);
-	kfree(strm.workspace);
+	vfree(strm.workspace);
 
 	D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld\n", strm.total_in, 
strm.total_out));
 
@@ -137,7 +136,7 @@ int zlib_compress(unsigned char *data_in
 
  out_err:
 	zlib_deflateEnd(&strm);
-	kfree(strm.workspace);
+	vfree(strm.workspace);
 	return -1;
 }
 
@@ -148,8 +147,7 @@ void zlib_decompress(unsigned char *data
 	int ret;
 
 #ifdef __KERNEL__
-	strm.workspace = kmalloc(zlib_inflate_workspacesize(),
-				 GFP_KERNEL);
+	strm.workspace = vmalloc(zlib_inflate_workspacesize());
 	if (strm.workspace == NULL) {
 		printk(KERN_WARNING "inflateInit alloc of workspace failed\n");
 		return;
@@ -177,5 +175,5 @@ void zlib_decompress(unsigned char *data
 		printk(KERN_NOTICE "inflate returned %d\n", ret);
 	}
 	zlib_inflateEnd(&strm);
-	kfree(strm.workspace);
+	vfree(strm.workspace);
 }

^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <14164.1014588644@redhat.com>]

end of thread, other threads:[~2002-02-25  7:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-19 14:24 jffs2 & new linux zlib Clive Davies
2002-02-20  6:33 ` Slow jffs2 startup on DOM Michael Michael
2002-02-20 16:32   ` Gad Hayisraeli
2002-02-21  7:35     ` Michael Michael
2002-02-21  8:33     ` David Woodhouse
2002-02-21  9:51       ` Michael Michael
2002-02-21  9:53         ` David Woodhouse
2002-02-21 11:34           ` Michael Michael
2002-02-21 12:32             ` Michael Michael
2002-02-22 12:05             ` Simon Evans
2002-02-22 14:59               ` Michael Michael
2002-02-24  9:18       ` Gad Hayisraeli
2002-02-24 10:47         ` Joakim Tjernlund
2002-02-24 12:04           ` David Woodhouse
     [not found] <14164.1014588644@redhat.com>
2002-02-25  7:47 ` Joakim Tjernlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox