mtd/fs/jffs2/ecos/src fs-ecos.c,1.38,1.39

David Woodhouse dwmw2 at infradead.org
Thu Nov 11 07:46:20 EST 2004


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

Modified Files:
	fs-ecos.c 
Log Message:
Merge changes from eCos tree:

revision 1.31
date: 2004/10/21 18:13:44;  author: asl;  state: Exp;  lines: +4 -3
        * src/fs-ecos.c (jffs2_open): Call iput on dir node if
        jffs2_create fails.
        * src/fs-ecos.c (jffs2_umount): use jffs2_free_full_dirent instead
        of free.
----------------------------
revision 1.30
date: 2004/10/13 21:29:10;  author: asl;  state: Exp;  lines: +2 -0
        * src/fs-ecos.c (find_entry): jffs2_lookup may return error codes.
        Check added.
----------------------------
revision 1.29
date: 2004/09/19 14:28:46;  author: asl;  state: Exp;  lines: +10 -3
        * cdl/jffs2.cdl: Fixed outdated definitions for compression options.
        * src/fs-ecos.c: Added missing calls for jffs2_compressors_init()
        and jffs2_compressors_exit()


Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- fs-ecos.c	11 Nov 2004 11:26:03 -0000	1.38
+++ fs-ecos.c	11 Nov 2004 12:46:17 -0000	1.39
@@ -21,6 +21,7 @@
 #include <linux/pagemap.h>
 #include <linux/crc32.h>
 #include "nodelist.h"
+#include "compr.h"
 
 #include <errno.h>
 #include <string.h>
@@ -304,6 +305,8 @@
 
 	if (d == NULL)
 		return ENOENT;
+	if (IS_ERR(d))
+		return -PTR_ERR(d);
 
 	// If it's a new directory inode, increase refcount on its parent
 	if (S_ISDIR(d->i_mode) && !d->i_parent) {
@@ -543,14 +546,18 @@
 			return ENOMEM;
 		}
 		memset(c->inocache_list, 0, sizeof(struct jffs2_inode_cache *) * INOCACHE_HASHSIZE);
-                if (n_fs_mounted++ == 0)
+                if (n_fs_mounted++ == 0) {
                         jffs2_create_slab_caches(); // No error check, cannot fail
+			jffs2_compressors_init(); 
+		}
 
 		err = jffs2_read_super(jffs2_sb);
 
 		if (err) {
-                        if (--n_fs_mounted == 0)
+                        if (--n_fs_mounted == 0) {
                                 jffs2_destroy_slab_caches();
+				jffs2_compressors_exit();
+			}
                         
 			free(jffs2_sb);
 			free(c->inocache_list);
@@ -640,7 +647,7 @@
 		// free directory entries
 		for (fd = root->jffs2_i.dents; fd; fd = next) {
 		  next=fd->next;
-		  free(fd);
+		  jffs2_free_full_dirent(fd);
 		}
 
 		free(root);
@@ -662,8 +669,10 @@
 	} else {
 		jffs2_sb->s_mount_count--;
         }
-        if (--n_fs_mounted == 0)
+        if (--n_fs_mounted == 0) {
                 jffs2_destroy_slab_caches();        
+		jffs2_compressors_exit();
+	}
 	return ENOERR;
 }
 
@@ -705,8 +714,9 @@
 			err = jffs2_create(ds.dir, ds.name, S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node);
 
 			if (err != 0) {
-				//Possible orphaned inode on the flash - but will be gc'd
-				return err;
+                                //Possible orphaned inode on the flash - but will be gc'd
+                          	jffs2_iput(ds.dir);
+                                return err;
 			}
 
 			err = ENOERR;
@@ -1420,7 +1430,7 @@
 
         // Check that pos is still within current file size, or at the
         // very end.
-        if (pos < 0 || pos > node->i_size)
+        if (pos < 0 )
                 return EINVAL;
 
 	// All OK, set fp offset and return new position.





More information about the linux-mtd-cvs mailing list