mtd/fs/jffs3 erase.c,3.2,3.3

Artem Bityuckiy dedekind at infradead.org
Fri Dec 17 09:50:20 EST 2004


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

Modified Files:
	erase.c 
Log Message:
Change messaging.


Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/erase.c,v
retrieving revision 3.2
retrieving revision 3.3
diff -u -r3.2 -r3.3
--- erase.c	13 Dec 2004 15:37:37 -0000	3.2
+++ erase.c	17 Dec 2004 14:50:17 -0000	3.3
@@ -48,10 +48,12 @@
 #else /* Linux */
 	struct erase_info *instr;
 
-	D1(printk(KERN_DEBUG "jffs3_erase_block(): erase block %#x (range %#x-%#x)\n", jeb->offset, jeb->offset, jeb->offset + c->sector_size));
+	DBG_ERASE(1, "erase block %#x (range %#x-%#x)\n", jeb->offset, jeb->offset,
+			jeb->offset + c->sector_size);
 	instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);
 	if (!instr) {
-		printk(KERN_WARNING "kmalloc for struct erase_info in jffs3_erase_block failed. Refiling block for later\n");
+		WARNING_MSG("kmalloc for struct erase_info in jffs3_erase_block failed. "
+				"Refiling block for later\n");
 		spin_lock(&c->erase_completion_lock);
 		list_del(&jeb->list);
 		list_add(&jeb->list, &c->erase_pending_list);
@@ -84,7 +86,7 @@
 
 	if (ret == -ENOMEM || ret == -EAGAIN) {
 		/* Erase failed immediately. Refile it on the list */
-		D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret));
+		DBG_ERASE(1 ,"Erase at %#08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret);
 		spin_lock(&c->erase_completion_lock);
 		list_del(&jeb->list);
 		list_add(&jeb->list, &c->erase_pending_list);
@@ -96,9 +98,9 @@
 	}
 
 	if (ret == -EROFS) 
-		printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset);
+		WARNING_MSG("Erase at %#08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset);
 	else
-		printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret);
+		WARNING_MSG("Erase at %#08x failed immediately: errno %d\n", jeb->offset, ret);
 
 	jffs3_erase_failed(c, jeb, bad_offset);
 }
@@ -121,13 +123,13 @@
 			jffs3_mark_erased_block(c, jeb);
 
 			if (!--count) {
-				D1(printk(KERN_DEBUG "Count reached. jffs3_erase_pending_blocks leaving\n"));
+				DBG_ERASE(1, "Count reached, leaving\n");
 				goto done;
 			}
 
 		} else if (!list_empty(&c->erase_pending_list)) {
 			jeb = list_entry(c->erase_pending_list.next, struct jffs3_eraseblock, list);
-			D1(printk(KERN_DEBUG "Starting erase of pending block 0x%08x\n", jeb->offset));
+			DBG_ERASE(1, "Starting erase of pending block %#08x\n", jeb->offset);
 			list_del(&jeb->list);
 			c->erasing_size += c->sector_size;
 			c->wasted_size -= jeb->wasted_size;
@@ -152,14 +154,14 @@
 
 	spin_unlock(&c->erase_completion_lock);
  done:
-	D1(printk(KERN_DEBUG "jffs3_erase_pending_blocks completed\n"));
+	DBG_ERASE(1, "completed\n");
 
 	up(&c->erase_free_sem);
 }
 
 static void jffs3_erase_succeeded(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
 {
-	D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", jeb->offset));
+	DBG_ERASE(1, "Erase completed successfully at %#08x\n", jeb->offset);
 	spin_lock(&c->erase_completion_lock);
 	list_del(&jeb->list);
 	list_add_tail(&jeb->list, &c->erase_complete_list);
@@ -204,7 +206,8 @@
 	struct erase_priv_struct *priv = (void *)instr->priv;
 
 	if(instr->state != MTD_ERASE_DONE) {
-		printk(KERN_WARNING "Erase at 0x%08x finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", instr->addr, instr->state);
+		WARNING_MSG("Erase at %#08x finished, but state != MTD_ERASE_DONE. "
+				"State is 0x%x instead.\n", instr->addr, instr->state);
 		jffs3_erase_failed(priv->c, priv->jeb, instr->fail_addr);
 	} else {
 		jffs3_erase_succeeded(priv->c, priv->jeb);
@@ -253,12 +256,12 @@
 
 	/* PARANOIA */
 	if (!ic) {
-		printk(KERN_WARNING "inode_cache not found in remove_node_refs()!!\n");
+		WARNING_MSG("inode_cache not found!!\n");
 		return;
 	}
 
-	D1(printk(KERN_DEBUG "Removed nodes in range 0x%08x-0x%08x from ino #%u\n",
-		  jeb->offset, jeb->offset + c->sector_size, ic->ino));
+	DBG_ERASE(1, "Removed nodes in range %#08x-%#08x from ino #%u\n",
+		  jeb->offset, jeb->offset + c->sector_size, ic->ino);
 
 	D2({
 		int i=0;
@@ -268,7 +271,7 @@
 		this = ic->nodes;
 	   
 		while(this) {
-			printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this));
+			printk( "%#08x(%d)->", ref_offset(this), ref_flags(this));
 			if (++i == 5) {
 				printk("\n" KERN_DEBUG);
 				i=0;
@@ -279,7 +282,7 @@
 	});
 
 	if (ic->nodes == (void *)ic) {
-		D1(printk(KERN_DEBUG "inocache for ino #%u is all gone now. Freeing\n", ic->ino));
+		DBG_ERASE(1, "inocache for ino #%u is all gone now. Freeing\n", ic->ino);
 		jffs3_del_ino_cache(c, ic);
 		jffs3_free_inode_cache(ic);
 	}
@@ -288,7 +291,7 @@
 static void jffs3_free_all_node_refs(struct jffs3_sb_info *c, struct jffs3_eraseblock *jeb)
 {
 	struct jffs3_raw_node_ref *ref;
-	D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset));
+	DBG_ERASE(1, "Freeing all node refs for eraseblock offset %#08x\n", jeb->offset);
 	while(jeb->first_node) {
 		ref = jeb->first_node;
 		jeb->first_node = ref->next_phys;
@@ -314,7 +317,7 @@
 	if (!jffs3_cleanmarker_oob(c)) {
 		marker_ref = jffs3_alloc_raw_node_ref();
 		if (!marker_ref) {
-			printk(KERN_WARNING "Failed to allocate raw node ref for clean marker\n");
+			WARNING_MSG("Failed to allocate raw node ref for clean marker\n");
 			/* Stick it back on the list from whence it came and come back later */
 			jffs3_erase_pending_trigger(c);
 			spin_lock(&c->erase_completion_lock);
@@ -325,11 +328,12 @@
 	}
 	ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!ebuf) {
-		printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Assuming it worked\n", jeb->offset);
+		WARNING_MSG("Failed to allocate page buffer for verifying erase "
+				"at %#08x. Assuming it worked\n", jeb->offset);
 	} else {
 		uint32_t ofs = jeb->offset;
 
-		D1(printk(KERN_DEBUG "Verifying erase at 0x%08x\n", jeb->offset));
+		DBG_ERASE(1, "Verifying erase at %#08x\n", jeb->offset);
 		while(ofs < jeb->offset + c->sector_size) {
 			uint32_t readlen = min((uint32_t)PAGE_SIZE, jeb->offset + c->sector_size - ofs);
 			int i;
@@ -338,11 +342,13 @@
 
 			ret = jffs3_flash_read(c, ofs, readlen, &retlen, ebuf);
 			if (ret) {
-				printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);
+				WARNING_MSG("Read of newly-erased block at %#08x failed: %d. "
+						"Putting on bad_list\n", ofs, ret);
 				goto bad;
 			}
 			if (retlen != readlen) {
-				printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen);
+				WARNING_MSG("Short read from newly-erased block at %#08x. "
+						"Wanted %d, got %zd\n", ofs, readlen, retlen);
 				goto bad;
 			}
 			for (i=0; i<readlen; i += sizeof(unsigned long)) {
@@ -350,7 +356,8 @@
 				unsigned long datum = *(unsigned long *)(&ebuf[i]);
 				if (datum + 1) {
 					bad_offset += i;
-					printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", datum, bad_offset);
+					WARNING_MSG("Newly-erased block contained word 0x%lx "
+							"at offset %#08x\n", datum, bad_offset);
 				bad: 
 					if (!jffs3_cleanmarker_oob(c))
 						jffs3_free_raw_node_ref(marker_ref);
@@ -376,7 +383,7 @@
 	bad_offset = jeb->offset;
 
 	/* Write the erase complete marker */	
-	D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset));
+	DBG_ERASE(1, "Writing erased marker to block at %#08x\n", jeb->offset);
 	if (jffs3_cleanmarker_oob(c)) {
 
 		if (jffs3_write_nand_cleanmarker(c, jeb))
@@ -403,13 +410,13 @@
 		ret = jffs3_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen);
 		
 		if (ret) {
-			printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n",
-			       jeb->offset, ret);
+			WARNING_MSG("Write clean marker to block at %#08x failed: %d\n",
+				       jeb->offset, ret);
 			goto bad2;
 		}
 		if (retlen != sizeof(marker)) {
-			printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
-			       jeb->offset, sizeof(marker), retlen);
+			WARNING_MSG("Short write to newly-erased block at %#08x: Wanted %zd, got %zd\n",
+				       jeb->offset, sizeof(marker), retlen);
 			goto bad2;
 		}
 





More information about the linux-mtd-cvs mailing list