mtd/fs/jffs2 background.c,1.39,1.40 fs.c,1.26,1.27 super-v24.c,1.71,1.72 super.c,1.85,1.86 wbuf.c,1.39,1.40

David Woodhouse dwmw2 at infradead.org
Mon Aug 25 09:24:15 EDT 2003


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

Modified Files:
	background.c fs.c super-v24.c super.c wbuf.c 
Log Message:
Make the timed sync happen from kupdated, don't muck around with our
own timers and schedule_work() any more. Remove sync_fs() since using
write_super() is sufficient for now.


Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- background.c	30 Jun 2003 10:58:57 -0000	1.39
+++ background.c	25 Aug 2003 13:24:12 -0000	1.40
@@ -61,14 +61,6 @@
 
 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
 {
-#ifdef CONFIG_JFFS2_FS_NAND
-	if (jffs2_cleanmarker_oob(c)) {
-		/* stop a eventually scheduled wbuf flush timer */
-		del_timer_sync(&c->wbuf_timer);
-		/* make sure, that a scheduled wbuf flush task is completed */
-		flush_scheduled_work();
-	}
-#endif
 	spin_lock(&c->erase_completion_lock);
 	if (c->gc_task) {
 		D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));

Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- fs.c	2 Jul 2003 10:46:00 -0000	1.26
+++ fs.c	25 Aug 2003 13:24:12 -0000	1.27
@@ -192,6 +192,7 @@
 	D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
 	jffs2_garbage_collect_trigger(c);
 	jffs2_erase_pending_blocks(c);
+	jffs2_flush_wbuf_gc(c, 0);
 }
 
 

Index: super-v24.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super-v24.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- super-v24.c	25 Aug 2003 11:38:05 -0000	1.71
+++ super-v24.c	25 Aug 2003 13:24:12 -0000	1.72
@@ -29,7 +29,6 @@
 #endif
 
 static void jffs2_put_super (struct super_block *);
-static int jffs2_sync_fs(struct super_block *);
 
 static struct super_operations jffs2_super_operations =
 {
@@ -39,7 +38,6 @@
 	statfs:		jffs2_statfs,
 	remount_fs:	jffs2_remount_fs,
 	clear_inode:	jffs2_clear_inode,
-	sync_fs:	jffs2_sync_fs,
 };
 
 
@@ -98,17 +96,6 @@
 	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);
-
-	D1(printk(KERN_DEBUG "jffs2_sync_fs() called\n"));
-	/* 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, 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.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- super.c	25 Aug 2003 11:38:05 -0000	1.85
+++ super.c	25 Aug 2003 13:24:12 -0000	1.86
@@ -28,8 +28,6 @@
 #include "nodelist.h"
 
 static void jffs2_put_super(struct super_block *);
-static int jffs2_sync_fs(struct super_block *, int);
-
 
 static kmem_cache_t *jffs2_inode_cachep;
 
@@ -68,7 +66,6 @@
 	.statfs =	jffs2_statfs,
 	.remount_fs =	jffs2_remount_fs,
 	.clear_inode =	jffs2_clear_inode,
-	.sync_fs =	jffs2_sync_fs,
 };
 
 static int jffs2_sb_compare(struct super_block *sb, void *data)
@@ -270,19 +267,6 @@
 		c->mtd->sync(c->mtd);
 
 	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);
-
-	if (wait)
-		/* 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, 0);
-
-	return 0;	
 }
 
 static void jffs2_kill_sb(struct super_block *sb)

Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- wbuf.c	25 Aug 2003 12:03:20 -0000	1.39
+++ wbuf.c	25 Aug 2003 13:24:13 -0000	1.40
@@ -72,6 +72,9 @@
 {
 	struct jffs2_inodirty *new;
 
+	/* Mark the superblock dirty so that kupdated will flush... */
+	OFNI_BS_2SFFJ(c)->s_dirt = 1;
+
 	if (jffs2_wbuf_pending_for_ino(c, ino))
 		return;
 
@@ -117,64 +120,6 @@
 	}
 }
 
-/* 
-*	Timed flushing of wbuf. If we have no consecutive write to wbuf, within	
-*	the specified time, we flush the contents with padding !
-*/
-void jffs2_wbuf_timeout (unsigned long data)
-{
-	struct jffs2_sb_info *c = (struct jffs2_sb_info *) data;
-	/* 
-	* Wake up the flush process, we need process context to have the right 
-	* to sleep on flash write
-	*/
-	D1(printk(KERN_DEBUG "jffs2_wbuf_timeout(): timer expired\n"));
-	schedule_work(&c->wbuf_task);
-}
-
-/*
-*	Process for timed wbuf flush
-*
-*	FIXME What happens, if we have a write failure there ????
-*/
-void jffs2_wbuf_process (void *data)
-{
-	struct jffs2_sb_info *c = (struct jffs2_sb_info *) data;	
-	
-	D1(printk(KERN_DEBUG "jffs2_wbuf_process() entered\n"));
-	
-	/* Check, if the timer is active again */
-	if (timer_pending (&c->wbuf_timer)) {
-		D1(printk (KERN_DEBUG "Nothing to do, timer is active again\n"));
-		return;
-	}
-
-	if (down_trylock(&c->alloc_sem)) {
-		/* If someone else has the alloc_sem, they're about to
-		   write anyway. So no need to waste space by
-		   padding */
-		D1(printk (KERN_DEBUG "jffs2_wbuf_process() alloc_sem already occupied\n"));
-		return;
-	}	
-
-	D1(printk (KERN_DEBUG "jffs2_wbuf_process() alloc_sem got\n"));
-
-	if (!c->nextblock) {
-		D1(printk(KERN_DEBUG "jffs2_wbuf_process(): nextblock NULL, nothing to do\n"));
-		if (c->wbuf_len) {
-			printk(KERN_WARNING "jffs2_wbuf_process(): c->wbuf_len is 0x%03x but nextblock is NULL!\n", c->wbuf_len);
-			up(&c->alloc_sem);
-			BUG();
-		}
-		return;
-	}
-	
-	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, 0);
-}
-
 
 /* Meaning of pad argument:
    0: Do not pad. Probably pointless - we only ever use this when we can't pad anyway.
@@ -197,9 +142,6 @@
 		BUG();
 	}
 
-	/* delete a eventually started timed wbuf flush */
-	del_timer_sync(&c->wbuf_timer);
-
 	if(!c->wbuf || !c->wbuf_len)
 		return 0;
 
@@ -535,15 +477,12 @@
 
 	/* If there's a remainder in the wbuf and it's a non-GC write,
 	   remember that the wbuf affects this ino */
-	if (c->wbuf_len && ino)
-		jffs2_wbuf_dirties_inode(c, ino);
 alldone:
 	*retlen = donelen;
-	/* Setup timed wbuf flush, if buffer len != 0 */
-	if (c->wbuf_len) {
-		D1(printk (KERN_DEBUG "jffs2_flash_writev: mod wbuf_timer\n"));	
-		mod_timer(&c->wbuf_timer, jiffies + WBUF_FLUSH_TIMEOUT);
-	}
+
+	if (c->wbuf_len && ino)
+		jffs2_wbuf_dirties_inode(c, ino);
+
 	return 0;
 }
 
@@ -894,14 +833,6 @@
 	c->wbuf_pagesize = c->mtd->oobblock;
 	c->wbuf_ofs = 0xFFFFFFFF;
 	c->wbuf_partnode_ofs = c->wbuf_ofs;
-
-	/* Initialise process for timed wbuf flush */
-	INIT_WORK(&c->wbuf_task,(void*) jffs2_wbuf_process, (void *)c);
-
-	/* Initialise timer for timed wbuf flush */
-	init_timer(&c->wbuf_timer);
-	c->wbuf_timer.function = jffs2_wbuf_timeout;
-	c->wbuf_timer.data = (unsigned long) c;
 
 	/* FIXME: If we had a generic way of describing the hardware's
 	   use of OOB area, we could perhaps make this generic too. */




More information about the linux-mtd-cvs mailing list