mtd/fs/jffs2 background.c,1.43,1.44

David Woodhouse dwmw2 at infradead.org
Wed Oct 8 09:29:58 EDT 2003


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

Modified Files:
	background.c 
Log Message:
Abort if GC ever gets -ENOSPC. Also honour c->nospc_dirty_size


Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- background.c	8 Oct 2003 10:45:15 -0000	1.43
+++ background.c	8 Oct 2003 13:29:55 -0000	1.44
@@ -118,6 +118,7 @@
 
 			case SIGKILL:
 				D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGKILL received.\n"));
+			die:
 				spin_lock(&c->erase_completion_lock);
 				c->gc_task = NULL;
 				spin_unlock(&c->erase_completion_lock);
@@ -137,7 +138,10 @@
 		spin_unlock_irq(&current_sig_lock);
 
 		D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n"));
-		jffs2_garbage_collect_pass(c);
+		if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
+			printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n");
+			goto die;
+		}
 	}
 }
 
@@ -163,7 +167,7 @@
 	dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size;
 
 	if (c->nr_free_blocks + c->nr_erasing_blocks < c->resv_blocks_gctrigger && 
-			(dirty > c->sector_size)) 
+			(dirty > c->nospc_dirty_size)) 
 		ret = 1;
 
 	D1(printk(KERN_DEBUG "thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x: %s\n", 




More information about the linux-mtd-cvs mailing list