mtd/fs/jffs2 super-v24.c,1.67,1.68 super.c,1.82,1.83

David Woodhouse dwmw2 at infradead.org
Sun Aug 24 07:14:24 EDT 2003


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

Modified Files:
	super-v24.c super.c 
Log Message:
sync_fs() to make sys_sync() work

Index: super-v24.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super-v24.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- super-v24.c	24 Aug 2003 10:29:09 -0000	1.67
+++ super-v24.c	24 Aug 2003 11:14:21 -0000	1.68
@@ -28,7 +28,8 @@
 #define MTD_BLOCK_MAJOR 31
 #endif
 
-void jffs2_put_super (struct super_block *);
+static void jffs2_put_super (struct super_block *);
+static int jffs2_sync_fs(struct super_block *);
 
 static struct super_operations jffs2_super_operations =
 {
@@ -37,7 +38,8 @@
 	write_super:	jffs2_write_super,
 	statfs:		jffs2_statfs,
 	remount_fs:	jffs2_remount_fs,
-	clear_inode:	jffs2_clear_inode
+	clear_inode:	jffs2_clear_inode,
+	sync_fs:	jffs2_sync_fs,
 };
 
 
@@ -74,7 +76,7 @@
 	return sb;
 }
 
-void jffs2_put_super (struct super_block *sb)
+static void jffs2_put_super (struct super_block *sb)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
 
@@ -96,6 +98,24 @@
 	put_mtd_device(c->mtd);
 	
 	D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
+}
+
+static int jffs2_sync_fs(struct super_block *sb)
+{
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
+	int ret;
+
+	if (!jffs2_wbuf_dirty(c))
+		return 0;
+
+	/* Flush with GC is OK -- it leaves a partially-written node
+	   but only a GC node, so no data are lost if it's not 
+	   complete and we immediately power off */
+	down(&c->alloc_sem);
+	ret = jffs2_flush_wbuf_gc(c);
+	up(&c->alloc_sem);
+			
+	return ret;	
 }
 
 static DECLARE_FSTYPE_DEV(jffs2_fs_type, "jffs2", jffs2_read_super);

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- super.c	24 Aug 2003 10:29:09 -0000	1.82
+++ super.c	24 Aug 2003 11:14:21 -0000	1.83
@@ -27,7 +27,8 @@
 #include <linux/namei.h>
 #include "nodelist.h"
 
-void jffs2_put_super (struct super_block *);
+static void jffs2_put_super(struct super_block *);
+static int jffs2_sync_fs(struct super_block *, int);
 
 
 static kmem_cache_t *jffs2_inode_cachep;
@@ -66,7 +67,8 @@
 	.write_super =	jffs2_write_super,
 	.statfs =	jffs2_statfs,
 	.remount_fs =	jffs2_remount_fs,
-	.clear_inode =	jffs2_clear_inode
+	.clear_inode =	jffs2_clear_inode,
+	.sync_fs =	jffs2_sync_fs,
 };
 
 static int jffs2_sb_compare(struct super_block *sb, void *data)
@@ -248,8 +250,7 @@
 	return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, minor(dev));
 }
 
-
-void jffs2_put_super (struct super_block *sb)
+static void jffs2_put_super (struct super_block *sb)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
 
@@ -271,6 +272,24 @@
 	D1(printk(KERN_DEBUG "jffs2_put_super returning\n"));
 }
 
+static int jffs2_sync_fs(struct super_block *sb, int wait)
+{
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
+	int ret;
+
+	if (!wait || !jffs2_wbuf_dirty(c))
+		return 0;
+
+	/* Flush with GC is OK -- it leaves a partially-written node
+	   but only a GC node, so no data are lost if it's not 
+	   complete and we immediately power off */
+	down(&c->alloc_sem);
+	ret = jffs2_flush_wbuf_gc(c);
+	up(&c->alloc_sem);
+			
+	return ret;	
+}
+
 static void jffs2_kill_sb(struct super_block *sb)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
@@ -278,15 +297,13 @@
 	put_mtd_device(c->mtd);
 	kfree(c);
 }
- 
+
 static struct file_system_type jffs2_fs_type = {
 	.owner =	THIS_MODULE,
 	.name =		"jffs2",
 	.get_sb =	jffs2_get_sb,
 	.kill_sb =	jffs2_kill_sb,
 };
-
-
 
 static int __init init_jffs2_fs(void)
 {




More information about the linux-mtd-cvs mailing list