mtd/fs/jffs2 fs.c,1.11,1.12 nodelist.h,1.73,1.74 super.c,1.69,1.70

David Woodhouse dwmw2 at infradead.org
Tue Jun 25 21:20:46 EDT 2002


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv6175/fs/jffs2

Modified Files:
	fs.c nodelist.h super.c 
Log Message:
Dynamically allocate inocache_list, so it can be large enough to be 
useful without making the super_block union too huge in 2.4.


Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- fs.c	20 May 2002 14:56:38 -0000	1.11
+++ fs.c	26 Jun 2002 01:20:43 -0000	1.12
@@ -266,6 +266,7 @@
 {
 	struct jffs2_sb_info *c;
 	struct inode *root_i;
+	int ret;
 
 	c = JFFS2_SB_INFO(sb);
 
@@ -291,7 +292,7 @@
 		c->wbuf_ofs = 0xFFFFFFFF;
 		c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
 		if (!c->wbuf)
-			goto out_mtd;
+			return -ENOMEM;
 
 		/* Initialize process for timed wbuf flush */
 		INIT_TQUEUE(&c->wbuf_task,(void*) jffs2_wbuf_process, (void *)c);
@@ -301,8 +302,17 @@
 		c->wbuf_timer.data = (unsigned long) c;
 	}
 
-	if (jffs2_do_mount_fs(c))
-		goto out_mtd;
+	c->inocache_list = kmalloc(INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
+	if (!c->inocache_list) {
+		ret = -ENOMEM;
+		goto out_wbuf;
+	}
+	memset(c->inocache_list, 0, INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *));
+
+	if ((ret = jffs2_do_mount_fs(c)))
+		goto out_inohash;
+
+	ret = -EINVAL;
 
 	D1(printk(KERN_DEBUG "jffs2_do_fill_super(): Getting root inode\n"));
 	root_i = iget(sb, 1);
@@ -332,6 +342,10 @@
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
 	kfree(c->blocks);
- out_mtd:
-	return -EINVAL;
+ out_inohash:
+	kfree(c->inocache_list);
+ out_wbuf:
+	if (c->wbuf)
+		kfree(c->wbuf);
+	return ret;
 }

Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- nodelist.h	27 May 2002 09:23:09 -0000	1.73
+++ nodelist.h	26 Jun 2002 01:20:43 -0000	1.74
@@ -93,6 +93,8 @@
 	int nlink;
 };
 
+#define INOCACHE_HASHSIZE 128
+
 struct jffs2_scan_info {
 	struct jffs2_full_dirent *dents;
 	struct jffs2_tmp_dnode_info *tmpnodes;

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- super.c	9 Jun 2002 22:47:48 -0000	1.69
+++ super.c	26 Jun 2002 01:20:43 -0000	1.70
@@ -264,6 +264,9 @@
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
 	kfree(c->blocks);
+	if (c->wbuf)
+		kfree(c->wbuf);
+	kfree(c->inocache_list);
 	if (c->mtd->sync)
 		c->mtd->sync(c->mtd);
 





More information about the linux-mtd-cvs mailing list