Skip to contentSkip to conversation

wbuf flush or remount ro

PATCH Simon Haynes 1 participant 1 message May 7, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

David,

Just to recap

It seems that the latest jffs2 CVS code does not flush wbuf when the filesystem is remounted read only. This can cause a gc operation to be abnormally terminated an error messages are generated on remount.

A while ago you suggested I do something like this. See attached

I don't really know how to create a patch file so here is a diff and a patch. If the patch is not correct would you please enlighten me.

fs.c renamed from fs.cvs +12 -0
@@ -355,6 +355,13 @@
 
 	if (!(*flags & MS_RDONLY))
 		jffs2_start_garbage_collect_thread(c);
+	/* MHB hack */
+	else {
+		down(&c->alloc_sem);
+	        jffs2_flush_wbuf_pad(c);
+	        up(&c->alloc_sem);
+	}
+
 	
 	sb->s_flags = (sb->s_flags & ~MS_RDONLY)|(*flags & MS_RDONLY);
 
@@ -463,7 +470,12 @@
 	}
 
 	if (c->sector_size != c->mtd->erasesize)
+/* MHB */
+/*
 		printk(KERN_INFO "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n", 
+			c->mtd->erasesize / 1024, c->sector_size / 1024);
+*/
+		printk(KERN_DEBUG "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n", 
 			c->mtd->erasesize / 1024, c->sector_size / 1024);
 
 	if (c->flash_size < 5*c->sector_size) {

*** fs.cvs Fri May 7 14:29:45 2004
--- fs.c Fri May 7 14:08:40 2004
***************
*** 355,360 ****
--- 355,367 ----

if (!(*flags & MS_RDONLY))
jffs2_start_garbage_collect_thread(c);
+ /* MHB hack */
+ else {
+ down(&c->alloc_sem);
+ jffs2_flush_wbuf_pad(c);
+ up(&c->alloc_sem);
+ }
+

  	sb->s_flags = (sb->s_flags & ~MS_RDONLY)|(*flags & MS_RDONLY);

***************
*** 463,469 ****
--- 470,481 ----
}

if (c->sector_size != c->mtd->erasesize)
+ /* MHB */
+ /*
printk(KERN_INFO "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n",
+ c->mtd->erasesize / 1024, c->sector_size / 1024);
+ */
+ printk(KERN_DEBUG "jffs2: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n",
c->mtd->erasesize / 1024, c->sector_size / 1024);

  	if (c->flash_size < 5*c->sector_size) {