mtd/fs/jffs2 file.c,1.89,1.90 nodelist.h,1.96,1.97 super-v24.c,1.70,1.71 super.c,1.84,1.85 wbuf.c,1.37,1.38

David Woodhouse dwmw2 at infradead.org
Mon Aug 25 07:38:08 EDT 2003


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

Modified Files:
	file.c nodelist.h super-v24.c super.c wbuf.c 
Log Message:
jffs2_flush_wbuf_gc() takes ino argument, for fsync sanity

Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/file.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- file.c	25 Aug 2003 11:31:46 -0000	1.89
+++ file.c	25 Aug 2003 11:38:05 -0000	1.90
@@ -30,10 +30,8 @@
 	struct inode *inode = dentry->d_inode;
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
 
-	/* Trigger GC to flush the pending writes.
-	   FIXME: We should do this only if our particular inode has
-	   writes pending in the wbuf */
-	jffs2_flush_wbuf_gc(c);
+	/* Trigger GC to flush any pending writes for this inode */
+	jffs2_flush_wbuf_gc(c, inode->i_ino);
 			
 	return 0;	
 }

Index: nodelist.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.h,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- nodelist.h	25 Aug 2003 11:31:46 -0000	1.96
+++ nodelist.h	25 Aug 2003 11:38:05 -0000	1.97
@@ -386,7 +386,7 @@
 
 #ifdef CONFIG_JFFS2_FS_NAND
 /* wbuf.c */
-int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c);
+int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino);
 int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c);
 int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);
 int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb);

Index: super-v24.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super-v24.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- super-v24.c	25 Aug 2003 11:31:47 -0000	1.70
+++ super-v24.c	25 Aug 2003 11:38:05 -0000	1.71
@@ -108,7 +108,7 @@
 	/* 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 */
-	return jffs2_flush_wbuf_gc(c);
+	return jffs2_flush_wbuf_gc(c, 0);
 }
 
 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.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- super.c	24 Aug 2003 20:34:53 -0000	1.84
+++ super.c	25 Aug 2003 11:38:05 -0000	1.85
@@ -280,7 +280,7 @@
 		/* 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 */
-		return jffs2_flush_wbuf_gc(c);
+		return jffs2_flush_wbuf_gc(c, 0);
 
 	return 0;	
 }

Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- wbuf.c	25 Aug 2003 11:31:47 -0000	1.37
+++ wbuf.c	25 Aug 2003 11:38:05 -0000	1.38
@@ -108,7 +108,7 @@
 	up(&c->alloc_sem);
 	/* if !c->nextblock then the tail will have got flushed from
 	   jffs2_do_reserve_space() anyway. */
-	jffs2_flush_wbuf_gc(c);
+	jffs2_flush_wbuf_gc(c, 0);
 }
 
 
@@ -220,14 +220,17 @@
 	return 0;
 }
 
-/* Trigger garbage collection to flush the write-buffer. */
-int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c)
+/* Trigger garbage collection to flush the write-buffer. 
+   If ino arg is zero, do it if _any_ real (i.e. not GC) writes are
+   outstanding. If ino arg non-zero, do it only if a write for the 
+   given inode is outstanding. */
+int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino)
 {
 	uint32_t old_wbuf_ofs;
 	uint32_t old_wbuf_len;
 	int ret = 0;
 
-	D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() called...\n"));
+	D1(printk(KERN_DEBUG "jffs2_flush_wbuf_gc() called for ino #%u...\n", ino));
 
 	down(&c->alloc_sem);
 	old_wbuf_ofs = c->wbuf_ofs;




More information about the linux-mtd-cvs mailing list