mtd/fs/jffs3 fs.c, 3.2, 3.3 dir.c, 3.3, 3.4 build.c, 3.2, 3.3 file.c, 3.3, 3.4 background.c, 3.3, 3.4

Artem Bityuckiy dedekind at infradead.org
Tue Dec 21 09:11:22 EST 2004


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

Modified Files:
	fs.c dir.c build.c file.c background.c 
Log Message:
Continue changing printks.


Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/fs.c,v
retrieving revision 3.2
retrieving revision 3.3
diff -u -r3.2 -r3.3
--- fs.c	13 Dec 2004 15:37:37 -0000	3.2
+++ fs.c	21 Dec 2004 14:11:19 -0000	3.3
@@ -39,7 +39,9 @@
 	unsigned int ivalid;
 	uint32_t phys_ofs, alloclen;
 	int ret;
-	D1(printk(KERN_DEBUG "jffs3_setattr(): ino #%lu\n", inode->i_ino));
+	
+	DBG_VFS(1, "ino #%lu\n", inode->i_ino);
+	
 	ret = inode_change_ok(inode, iattr);
 	if (ret) 
 		return ret;
@@ -54,7 +56,7 @@
 		dev = old_encode_dev(inode->i_rdev);
 		mdata = (char *)&dev;
 		mdatalen = sizeof(dev);
-		D1(printk(KERN_DEBUG "jffs3_setattr(): Writing %d bytes of kdev_t\n", mdatalen));
+		DBG_VFS(1, "Writing %d bytes of kdev_t\n", mdatalen);
 	} else if (S_ISLNK(inode->i_mode)) {
 		mdatalen = f->metadata->size;
 		mdata = kmalloc(f->metadata->size, GFP_USER);
@@ -65,7 +67,7 @@
 			kfree(mdata);
 			return ret;
 		}
-		D1(printk(KERN_DEBUG "jffs3_setattr(): Writing %d bytes of symlink target\n", mdatalen));
+		DBG_VFS(1, "Writing %d bytes of symlink target\n", mdatalen);
 	}
 
 	ri = jffs3_alloc_raw_inode();
@@ -220,7 +222,7 @@
 	struct jffs3_sb_info *c = JFFS3_SB_INFO(inode->i_sb);
 	struct jffs3_inode_info *f = JFFS3_INODE_INFO(inode);
 	
-	D1(printk(KERN_DEBUG "jffs3_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode));
+	DBG_VFS(1, "ino #%lu mode %o\n", inode->i_ino, inode->i_mode);
 
 	jffs3_do_clear_inode(c, f);
 }
@@ -232,7 +234,7 @@
 	struct jffs3_raw_inode latest_node;
 	int ret;
 
-	D1(printk(KERN_DEBUG "jffs3_read_inode(): inode->i_ino == %lu\n", inode->i_ino));
+	DBG_VFS(1, "inode->i_ino == %lu\n", inode->i_ino);
 
 	f = JFFS3_INODE_INFO(inode);
 	c = JFFS3_SB_INFO(inode->i_sb);
@@ -294,10 +296,10 @@
 	case S_IFBLK:
 	case S_IFCHR:
 		/* Read the device numbers from the media */
-		D1(printk(KERN_DEBUG "Reading device numbers from flash\n"));
+		DBG_VFS(1, "Reading device numbers from flash\n");
 		if (jffs3_read_dnode(c, f, f->metadata, (char *)&rdev, 0, sizeof(rdev)) < 0) {
 			/* Eep */
-			printk(KERN_NOTICE "Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino);
+			NOTICE_MSG("Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino);
 			up(&f->sem);
 			jffs3_do_clear_inode(c, f);
 			make_bad_inode(inode);
@@ -312,12 +314,12 @@
 		break;
 
 	default:
-		printk(KERN_WARNING "jffs3_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino);
+		WARNING_MSG("Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino);
 	}
 
 	up(&f->sem);
 
-	D1(printk(KERN_DEBUG "jffs3_read_inode() returning\n"));
+	DBG_VFS(1, "returning\n");
 }
 
 void jffs3_dirty_inode(struct inode *inode)
@@ -325,11 +327,11 @@
 	struct iattr iattr;
 
 	if (!(inode->i_state & I_DIRTY_DATASYNC)) {
-		D2(printk(KERN_DEBUG "jffs3_dirty_inode() not calling setattr() for ino #%lu\n", inode->i_ino));
+		DBG_VFS(2, "calling setattr() for ino #%lu\n", inode->i_ino);
 		return;
 	}
 
-	D1(printk(KERN_DEBUG "jffs3_dirty_inode() calling setattr() for ino #%lu\n", inode->i_ino));
+	DBG_VFS(1, "calling setattr() for ino #%lu\n", inode->i_ino);
 
 	iattr.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_MTIME|ATTR_CTIME;
 	iattr.ia_mode = inode->i_mode;
@@ -376,7 +378,7 @@
 	if (sb->s_flags & MS_RDONLY)
 		return;
 
-	D1(printk(KERN_DEBUG "jffs3_write_super()\n"));
+	DBG_VFS(1, "entering\n");
 	jffs3_garbage_collect_trigger(c);
 	jffs3_erase_pending_blocks(c, 0);
 	jffs3_flush_wbuf_gc(c, 0);
@@ -393,7 +395,7 @@
 	struct jffs3_inode_info *f;
 	int ret;
 
-	D1(printk(KERN_DEBUG "jffs3_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode));
+	DBG_VFS(1, "dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode);
 
 	c = JFFS3_SB_INFO(sb);
 	
@@ -452,7 +454,7 @@
 
 #ifndef CONFIG_JFFS3_FS_NAND
 	if (c->mtd->type == MTD_NANDFLASH) {
-		printk(KERN_ERR "jffs3: Cannot operate on NAND flash unless jffs3 NAND support is compiled in.\n");
+		ERROR_MSG("Cannot operate on NAND flash unless jffs3 NAND support is compiled in.\n");
 		return -EINVAL;
 	}
 #endif
@@ -477,16 +479,16 @@
 	 */
 	if ((c->sector_size * blocks) != c->flash_size) {
 		c->flash_size = c->sector_size * blocks;		
-		printk(KERN_INFO "jffs3: Flash size not aligned to erasesize, reducing to %dKiB\n",
-			c->flash_size / 1024);
+		NOTICE_MSG("Flash size not aligned to erasesize, reducing to %dKiB\n",
+				c->flash_size / 1024);
 	}
 
 	if (c->sector_size != c->mtd->erasesize)
-		printk(KERN_INFO "jffs3: Erase block size too small (%dKiB). Using virtual blocks size (%dKiB) instead\n", 
+		NOTICE_MSG("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) {
-		printk(KERN_ERR "jffs3: Too few erase blocks (%d)\n", c->flash_size / c->sector_size);
+		ERROR_MSG("Too few erase blocks (%d)\n", c->flash_size / c->sector_size);
 		return -EINVAL;
 	}
 
@@ -510,14 +512,14 @@
 
 	ret = -EINVAL;
 
-	D1(printk(KERN_DEBUG "jffs3_do_fill_super(): Getting root inode\n"));
+	DBG_VFS(1, "Getting root inode\n");
 	root_i = iget(sb, 1);
 	if (is_bad_inode(root_i)) {
-		D1(printk(KERN_WARNING "get root inode failed\n"));
+		WARNING_MSG("get root inode failed\n");
 		goto out_nodes;
 	}
 
-	D1(printk(KERN_DEBUG "jffs3_do_fill_super(): d_alloc_root()\n"));
+	DBG_VFS(1, "d_alloc_root()\n");
 	sb->s_root = d_alloc_root(root_i);
 	if (!sb->s_root)
 		goto out_root_i;
@@ -577,20 +579,18 @@
 		*/
 		inode = ilookup(OFNI_BS_2SFFJ(c), inum);
 		if (!inode) {
-			D1(printk(KERN_DEBUG "ilookup() failed for ino #%u; inode is probably deleted.\n",
-				  inum));
+			DBG_GC(1, "ilookup() failed for ino #%u; inode is probably deleted.\n", inum);
 
 			spin_lock(&c->inocache_lock);
 			ic = jffs3_get_ino_cache(c, inum);
 			if (!ic) {
-				D1(printk(KERN_DEBUG "Inode cache for ino #%u is gone.\n", inum));
+				DBG_GC(1, "Inode cache for ino #%u is gone.\n", inum);
 				spin_unlock(&c->inocache_lock);
 				return NULL;
 			}
 			if (ic->state != INO_STATE_CHECKEDABSENT) {
 				/* Wait for progress. Don't just loop */
-				D1(printk(KERN_DEBUG "Waiting for ino #%u in state %d\n",
-					  ic->ino, ic->state));
+				DBG_GC(1, "Waiting for ino #%u in state %d\n", ic->ino, ic->state);
 				sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock);
 			} else {
 				spin_unlock(&c->inocache_lock);
@@ -608,8 +608,7 @@
 			return ERR_PTR(-ENOMEM);
 	}
 	if (is_bad_inode(inode)) {
-		printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n",
-		       inum, nlink);
+		ERROR_MSG("Eep. read_inode() failed for ino #%u. nlink %d\n", inum, nlink);
 		/* NB. This will happen again. We need to do something appropriate here. */
 		iput(inode);
 		return ERR_PTR(-EIO);

Index: dir.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/dir.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -r3.3 -r3.4
--- dir.c	13 Dec 2004 11:35:41 -0000	3.3
+++ dir.c	21 Dec 2004 14:11:19 -0000	3.4
@@ -85,7 +85,7 @@
 	uint32_t ino = 0;
 	struct inode *inode = NULL;
 
-	D1(printk(KERN_DEBUG "jffs3_lookup()\n"));
+	DBG_VFS(1, "entering\n");
 
 	dir_f = JFFS3_INODE_INFO(dir_i);
 	c = JFFS3_SB_INFO(dir_i->i_sb);
@@ -107,7 +107,7 @@
 	if (ino) {
 		inode = iget(dir_i->i_sb, ino);
 		if (!inode) {
-			printk(KERN_WARNING "iget() failed for ino #%u\n", ino);
+			WARNING_MSG("iget() failed for ino #%u\n", ino);
 			return (ERR_PTR(-EIO));
 		}
 	}
@@ -128,7 +128,7 @@
 	struct jffs3_full_dirent *fd;
 	unsigned long offset, curofs;
 
-	D1(printk(KERN_DEBUG "jffs3_readdir() for dir_i #%lu\n", filp->f_dentry->d_inode->i_ino));
+	DBG_VFS(1, "for dir_i #%lu\n", filp->f_dentry->d_inode->i_ino);
 
 	f = JFFS3_INODE_INFO(inode);
 	c = JFFS3_SB_INFO(inode->i_sb);
@@ -136,14 +136,14 @@
 	offset = filp->f_pos;
 
 	if (offset == 0) {
-		D1(printk(KERN_DEBUG "Dirent 0: \".\", ino #%lu\n", inode->i_ino));
+		DBG_VFS(1, "Dirent 0: \".\", ino #%lu\n", inode->i_ino);
 		if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0)
 			goto out;
 		offset++;
 	}
 	if (offset == 1) {
 		unsigned long pino = parent_ino(filp->f_dentry);
-		D1(printk(KERN_DEBUG "Dirent 1: \"..\", ino #%lu\n", pino));
+		DBG_VFS(1, "Dirent 1: \"..\", ino #%lu\n", pino);
 		if (filldir(dirent, "..", 2, 1, pino, DT_DIR) < 0)
 			goto out;
 		offset++;
@@ -156,16 +156,16 @@
 		curofs++;
 		/* First loop: curofs = 2; offset = 2 */
 		if (curofs < offset) {
-			D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n", 
-				  fd->name, fd->ino, fd->type, curofs, offset));
+			DBG_VFS(2, "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n", 
+				  fd->name, fd->ino, fd->type, curofs, offset);
 			continue;
 		}
 		if (!fd->ino) {
-			D2(printk(KERN_DEBUG "Skipping deletion dirent \"%s\"\n", fd->name));
+			DBG_VFS(2, "Skipping deletion dirent \"%s\"\n", fd->name);
 			offset++;
 			continue;
 		}
-		D2(printk(KERN_DEBUG "Dirent %ld: \"%s\", ino #%u, type %d\n", offset, fd->name, fd->ino, fd->type));
+		DBG_VFS(2, "Dirent %ld: \"%s\", ino #%u, type %d\n", offset, fd->name, fd->ino, fd->type);
 		if (filldir(dirent, fd->name, strlen(fd->name), offset, fd->ino, fd->type) < 0)
 			break;
 		offset++;
@@ -194,12 +194,12 @@
 	
 	c = JFFS3_SB_INFO(dir_i->i_sb);
 
-	D1(printk(KERN_DEBUG "jffs3_create()\n"));
+	DBG_VFS(1, "entering\n");
 
 	inode = jffs3_new_inode(dir_i, mode, ri);
 
 	if (IS_ERR(inode)) {
-		D1(printk(KERN_DEBUG "jffs3_new_inode() failed\n"));
+		DBG_VFS(1, "failed\n");
 		jffs3_free_raw_inode(ri);
 		return PTR_ERR(inode);
 	}
@@ -227,8 +227,9 @@
 	jffs3_free_raw_inode(ri);
 	d_instantiate(dentry, inode);
 
-	D1(printk(KERN_DEBUG "jffs3_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n",
-		  inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages));
+	DBG_VFS(1, "Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n",
+		  inode->i_ino, inode->i_mode, inode->i_nlink,
+		  f->inocache->nlink, inode->i_mapping->nrpages);
 	return 0;
 }
 
@@ -783,7 +784,7 @@
 			f->inocache->nlink++;
 		up(&f->sem);
 
-		printk(KERN_NOTICE "jffs3_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret);
+		NOTICE_MSG("(rename): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret);
 		/* Might as well let the VFS know */
 		d_instantiate(new_dentry, old_dentry->d_inode);
 		atomic_inc(&old_dentry->d_inode->i_count);

Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/build.c,v
retrieving revision 3.2
retrieving revision 3.3
diff -u -r3.2 -r3.3
--- build.c	13 Dec 2004 15:37:37 -0000	3.2
+++ build.c	21 Dec 2004 14:11:19 -0000	3.3
@@ -51,7 +51,7 @@
 {
 	struct jffs3_full_dirent *fd;
 
-	D1(printk(KERN_DEBUG "jffs3_build_inode building directory inode #%u\n", ic->ino));
+	DBG_BLD(1, "building directory inode #%u\n", ic->ino);
 
 	/* For each child, increase nlink */
 	for(fd = ic->scan_dents; fd; fd = fd->next) {
@@ -63,21 +63,22 @@
 
 		child_ic = jffs3_get_ino_cache(c, fd->ino);
 		if (!child_ic) {
-			printk(KERN_NOTICE "Eep. Child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n",
-				  fd->name, fd->ino, ic->ino);
+			NOTICE_MSG("Eep. Child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n",
+					fd->name, fd->ino, ic->ino);
 			jffs3_mark_node_obsolete(c, fd->raw);
 			continue;
 		}
 
 		if (child_ic->nlink++ && fd->type == DT_DIR) {
-			printk(KERN_NOTICE "Child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", fd->name, fd->ino, ic->ino);
+			NOTICE_MSG("Child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n",
+					fd->name, fd->ino, ic->ino);
 			if (fd->ino == 1 && ic->ino == 1) {
-				printk(KERN_NOTICE "This is mostly harmless, and probably caused by creating a JFFS3 image\n");
-				printk(KERN_NOTICE "using a buggy version of mkfs.jffs3. Use at least v1.17.\n");
+				NOTICE_MSG("This is mostly harmless, and probably caused by creating a JFFS3 image\n");
+				NOTICE_MSG("using a buggy version of mkfs.jffs3. Use at least v1.17.\n");
 			}
 			/* What do we do about it? */
 		}
-		D1(printk(KERN_DEBUG "Increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino));
+		DBG_BLD(1, "Increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino);
 		/* Can't free them. We might need them in pass 2 */
 	}
 }
@@ -103,12 +104,12 @@
 	if (ret)
 		goto exit;
 
-	D1(printk(KERN_DEBUG "Scanned flash completely\n"));
+	DBG_BLD(1, "Scanned flash completely\n");
 	D2(jffs3_dbg_dump_block_lists(c));
 
 	/* Now scan the directory tree, increasing nlink according to every dirent found. */
 	for_each_inode(i, c, ic) {
-		D1(printk(KERN_DEBUG "Pass 1: ino #%u\n", ic->ino));
+		DBG_BLD(1, "Pass 1: ino #%u\n", ic->ino);
 
 		D1(BUG_ON(ic->ino > c->highest_ino));
 
@@ -119,17 +120,18 @@
 	}
 	c->flags &= ~JFFS3_SB_FLAG_MOUNTING;
 
-	D1(printk(KERN_DEBUG "Pass 1 complete\n"));
+	DBG_BLD(1, "Pass 1 complete\n");
 
 	/* Next, scan for inodes with nlink == 0 and remove them. If
 	   they were directories, then decrement the nlink of their
 	   children too, and repeat the scan. As that's going to be
 	   a fairly uncommon occurrence, it's not so evil to do it this
 	   way. Recursion bad. */
-	D1(printk(KERN_DEBUG "Pass 2 starting\n"));
+	DBG_BLD(1, "Pass 2 starting\n");
 
 	for_each_inode(i, c, ic) {
-		D1(printk(KERN_DEBUG "Pass 2: ino #%u, nlink %d, ic %p, nodes %p\n", ic->ino, ic->nlink, ic, ic->nodes));
+		DBG_BLD(1, "Pass 2: ino #%u, nlink %d, ic %p, nodes %p\n",
+				ic->ino, ic->nlink, ic, ic->nodes);
 		if (ic->nlink)
 			continue;
 			
@@ -137,25 +139,25 @@
 		cond_resched();
 	} 
 
-	D1(printk(KERN_DEBUG "Pass 2a starting\n"));
+	DBG_BLD(1, "Pass 2a starting\n");
 
 	while (dead_fds) {
 		fd = dead_fds;
 		dead_fds = fd->next;
 
 		ic = jffs3_get_ino_cache(c, fd->ino);
-		D1(printk(KERN_DEBUG "Removing dead_fd ino #%u (\"%s\"), ic at %p\n", fd->ino, fd->name, ic));
+		DBG_BLD(1, "Removing dead_fd ino #%u (\"%s\"), ic at %p\n", fd->ino, fd->name, ic);
 
 		if (ic)
 			jffs3_build_remove_unlinked_inode(c, ic, &dead_fds);
 		jffs3_free_full_dirent(fd);
 	}
 
-	D1(printk(KERN_DEBUG "Pass 2 complete\n"));
+	DBG_BLD(1, "Pass 2 complete\n");
 	
 	/* Finally, we can scan again and free the dirent structs */
 	for_each_inode(i, c, ic) {
-		D1(printk(KERN_DEBUG "Pass 3: ino #%u, ic %p, nodes %p\n", ic->ino, ic, ic->nodes));
+		DBG_BLD(1, "Pass 3: ino #%u, ic %p, nodes %p\n", ic->ino, ic, ic->nodes);
 
 		while(ic->scan_dents) {
 			fd = ic->scan_dents;
@@ -165,7 +167,7 @@
 		ic->scan_dents = NULL;
 		cond_resched();
 	}
-	D1(printk(KERN_DEBUG "Pass 3 complete\n"));
+	DBG_BLD(1, "Pass 3 complete\n");
 	D2(jffs3_dbg_dump_block_lists(c));
 
 	/* Rotate the lists by some number to ensure wear levelling */
@@ -192,19 +194,19 @@
 	struct jffs3_raw_node_ref *raw;
 	struct jffs3_full_dirent *fd;
 
-	D1(printk(KERN_DEBUG "JFFS3: Removing ino #%u with nlink == zero.\n", ic->ino));
+	DBG_BLD(1, "Removing ino #%u with nlink == zero.\n", ic->ino);
 	
 	raw = ic->nodes;
 	while (raw != (void *)ic) {
 		struct jffs3_raw_node_ref *next = raw->next_in_ino;
-		D1(printk(KERN_DEBUG "obsoleting node at 0x%08x\n", ref_offset(raw)));
+		DBG_BLD(1, "obsoleting node at 0x%08x\n", ref_offset(raw));
 		jffs3_mark_node_obsolete(c, raw);
 		raw = next;
 	}
 
 	if (ic->scan_dents) {
 		int whinged = 0;
-		D1(printk(KERN_DEBUG "Inode #%u was a directory which may have children...\n", ic->ino));
+		DBG_BLD(1, "Inode #%u was a directory which may have children...\n", ic->ino);
 
 		while(ic->scan_dents) {
 			struct jffs3_inode_cache *child_ic;
@@ -214,21 +216,22 @@
 
 			if (!fd->ino) {
 				/* It's a deletion dirent. Ignore it */
-				D1(printk(KERN_DEBUG "Child \"%s\" is a deletion dirent, skipping...\n", fd->name));
+				DBG_BLD(1, "Child \"%s\" is a deletion dirent, skipping...\n", fd->name);
 				jffs3_free_full_dirent(fd);
 				continue;
 			}
 			if (!whinged) {
 				whinged = 1;
-				printk(KERN_NOTICE "Inode #%u was a directory with children - removing those too...\n", ic->ino);
+				NOTICE_MSG("Inode #%u was a directory with children - "
+						"removing those too...\n", ic->ino);
 			}
 
-			D1(printk(KERN_DEBUG "Removing child \"%s\", ino #%u\n",
-				  fd->name, fd->ino));
+			DBG_BLD(1, "Removing child \"%s\", ino #%u\n", fd->name, fd->ino);
 			
 			child_ic = jffs3_get_ino_cache(c, fd->ino);
 			if (!child_ic) {
-				printk(KERN_NOTICE "Cannot remove child \"%s\", ino #%u, because it doesn't exist\n", fd->name, fd->ino);
+				NOTICE_MSG("Cannot remove child \"%s\", ino #%u, "
+					"because it doesn't exist\n", fd->name, fd->ino);
 				jffs3_free_full_dirent(fd);
 				continue;
 			}
@@ -239,13 +242,13 @@
 			child_ic->nlink--;
 			
 			if (!child_ic->nlink) {
-				D1(printk(KERN_DEBUG "Inode #%u (\"%s\") has now got zero nlink. Adding to dead_fds list.\n",
-					  fd->ino, fd->name));
+				DBG_BLD(1, "Inode #%u (\"%s\") has now got zero nlink. Adding to dead_fds list.\n",
+					  fd->ino, fd->name);
 				fd->next = *dead_fds;
 				*dead_fds = fd;
 			} else {
-				D1(printk(KERN_DEBUG "Inode #%u (\"%s\") has now got nlink %d. Ignoring.\n",
-					  fd->ino, fd->name, child_ic->nlink));
+				DBG_BLD(1, "Inode #%u (\"%s\") has now got nlink %d. Ignoring.\n",
+					  fd->ino, fd->name, child_ic->nlink);
 				jffs3_free_full_dirent(fd);
 			}
 		}
@@ -293,20 +296,20 @@
 	   trying to GC to make more space. It'll be a fruitless task */
 	c->nospc_dirty_size = c->sector_size + (c->flash_size / 100);
 
-	D1(printk(KERN_DEBUG "JFFS3 trigger levels (size %d KiB, block size %d KiB, %d blocks)\n",
-		  c->flash_size / 1024, c->sector_size / 1024, c->nr_blocks));
-	D1(printk(KERN_DEBUG "Blocks required to allow deletion:    %d (%d KiB)\n",
-		  c->resv_blocks_deletion, c->resv_blocks_deletion*c->sector_size/1024));
-	D1(printk(KERN_DEBUG "Blocks required to allow writes:      %d (%d KiB)\n",
-		  c->resv_blocks_write, c->resv_blocks_write*c->sector_size/1024));
-	D1(printk(KERN_DEBUG "Blocks required to quiesce GC thread: %d (%d KiB)\n",
-		  c->resv_blocks_gctrigger, c->resv_blocks_gctrigger*c->sector_size/1024));
-	D1(printk(KERN_DEBUG "Blocks required to allow GC merges:   %d (%d KiB)\n",
-		  c->resv_blocks_gcmerge, c->resv_blocks_gcmerge*c->sector_size/1024));
-	D1(printk(KERN_DEBUG "Blocks required to GC bad blocks:     %d (%d KiB)\n",
-		  c->resv_blocks_gcbad, c->resv_blocks_gcbad*c->sector_size/1024));
-	D1(printk(KERN_DEBUG "Amount of dirty space required to GC: %d bytes\n",
-		  c->nospc_dirty_size));
+	DBG_BLD(1, "JFFS3 trigger levels (size %d KiB, block size %d KiB, %d blocks)\n",
+		  c->flash_size / 1024, c->sector_size / 1024, c->nr_blocks);
+	DBG_BLD(1, "Blocks required to allow deletion:    %d (%d KiB)\n",
+		  c->resv_blocks_deletion, c->resv_blocks_deletion*c->sector_size/1024);
+	DBG_BLD(1, "Blocks required to allow writes:      %d (%d KiB)\n",
+		  c->resv_blocks_write, c->resv_blocks_write*c->sector_size/1024);
+	DBG_BLD(1, "Blocks required to quiesce GC thread: %d (%d KiB)\n",
+		  c->resv_blocks_gctrigger, c->resv_blocks_gctrigger*c->sector_size/1024);
+	DBG_BLD(1, "Blocks required to allow GC merges:   %d (%d KiB)\n",
+		  c->resv_blocks_gcmerge, c->resv_blocks_gcmerge*c->sector_size/1024);
+	DBG_BLD(1, "Blocks required to GC bad blocks:     %d (%d KiB)\n",
+		  c->resv_blocks_gcbad, c->resv_blocks_gcbad*c->sector_size/1024);
+	DBG_BLD(1, "Amount of dirty space required to GC: %d bytes\n",
+		  c->nospc_dirty_size);
 } 
 
 int jffs3_do_mount_fs(struct jffs3_sb_info *c)
@@ -355,7 +358,7 @@
 	c->highest_ino = 1;
 
 	if (jffs3_build_filesystem(c)) {
-		D1(printk(KERN_DEBUG "build_fs failed\n"));
+		DBG_BLD(1, "build_fs failed\n");
 		jffs3_free_ino_caches(c);
 		jffs3_free_raw_node_refs(c);
 		kfree(c->blocks);

Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/file.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -r3.3 -r3.4
--- file.c	13 Dec 2004 11:35:41 -0000	3.3
+++ file.c	21 Dec 2004 14:11:19 -0000	3.4
@@ -73,7 +73,7 @@
 	unsigned char *pg_buf;
 	int ret;
 
-	D2(printk(KERN_DEBUG "jffs3_do_readpage_nolock(): ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT));
+	DBG_VFS(2, "ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT);
 
 	if (!PageLocked(pg))
                 PAGE_BUG(pg);
@@ -94,7 +94,7 @@
 	flush_dcache_page(pg);
 	kunmap(pg);
 
-	D2(printk(KERN_DEBUG "readpage finished\n"));
+	DBG_VFS(2,"readpage finished\n");
 	return 0;
 }
 
@@ -124,7 +124,7 @@
 	uint32_t pageofs = pg->index << PAGE_CACHE_SHIFT;
 	int ret = 0;
 
-	D1(printk(KERN_DEBUG "jffs3_prepare_write()\n"));
+	DBG_VFS(1, "entering\n");
 
 	if (pageofs > inode->i_size) {
 		/* Make new hole frag from old EOF to new page */
@@ -133,8 +133,8 @@
 		struct jffs3_full_dnode *fn;
 		uint32_t phys_ofs, alloc_len;
 		
-		D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
-			  (unsigned int)inode->i_size, pageofs));
+		DBG_VFS(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
+			  (unsigned int)inode->i_size, pageofs);
 
 		ret = jffs3_reserve_space(c, sizeof(ri), &phys_ofs, &alloc_len, ALLOC_NORMAL);
 		if (ret)
@@ -177,7 +177,7 @@
 			f->metadata = NULL;
 		}
 		if (ret) {
-			D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in prepare_write, returned %d\n", ret));
+			DBG_VFS(1, "Eep. add_full_dnode_to_inode() failed in prepare_write, returned %d\n", ret);
 			jffs3_mark_node_obsolete(c, fn->raw);
 			jffs3_free_full_dnode(fn);
 			jffs3_complete_reservation(c);
@@ -195,7 +195,7 @@
 		ret = jffs3_do_readpage_nolock(inode, pg);
 		up(&f->sem);
 	}
-	D1(printk(KERN_DEBUG "end prepare_write(). pg->flags %lx\n", pg->flags));
+	DBG_VFS(1, "end. pg->flags %lx\n", pg->flags);
 	return ret;
 }
 
@@ -212,8 +212,8 @@
 	int ret = 0;
 	uint32_t writtenlen = 0;
 
-	D1(printk(KERN_DEBUG "jffs3_commit_write(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n",
-		  inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end, pg->flags));
+	DBG_VFS(1, "ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n",
+		  inode->i_ino, pg->index << PAGE_CACHE_SHIFT, start, end, pg->flags);
 
 	if (!start && end == PAGE_CACHE_SIZE) {
 		/* We need to avoid deadlock with page_cache_read() in
@@ -226,7 +226,7 @@
 	ri = jffs3_alloc_raw_inode();
 
 	if (!ri) {
-		D1(printk(KERN_DEBUG "jffs3_commit_write(): Allocation of raw inode failed\n"));
+		WARNING_MSG("Allocation of raw inode failed\n");
 		return -ENOMEM;
 	}
 
@@ -274,11 +274,11 @@
 		/* generic_file_write has written more to the page cache than we've
 		   actually written to the medium. Mark the page !Uptodate so that 
 		   it gets reread */
-		D1(printk(KERN_DEBUG "jffs3_commit_write(): Not all bytes written. Marking page !uptodate\n"));
+		DBG_VFS(1, "Not all bytes written. Marking page !uptodate\n");
 		SetPageError(pg);
 		ClearPageUptodate(pg);
 	}
 
-	D1(printk(KERN_DEBUG "jffs3_commit_write() returning %d\n",writtenlen?writtenlen:ret));
+	DBG_VFS(1, "returning %d\n",writtenlen?writtenlen:ret);
 	return writtenlen?writtenlen:ret;
 }

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/background.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -u -r3.3 -r3.4
--- background.c	13 Dec 2004 11:35:41 -0000	3.3
+++ background.c	21 Dec 2004 14:11:19 -0000	3.4
@@ -86,7 +86,7 @@
 
 		if (!jffs3_thread_should_wake(c)) {
 			set_current_state (TASK_INTERRUPTIBLE);
-			D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread sleeping...\n"));
+			DBG_GCT(1, "GC thread sleeping...\n");
 			/* Yes, there's a race here; we checked jffs3_thread_should_wake()
 			   before setting current->state to TASK_INTERRUPTIBLE. But it doesn't
 			   matter - We don't care if we miss a wakeup, because the GC thread
@@ -113,28 +113,28 @@
 
 			switch(signr) {
 			case SIGSTOP:
-				D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread(): SIGSTOP received.\n"));
+				DBG_GCT(1, "SIGSTOP received.\n");
 				set_current_state(TASK_STOPPED);
 				schedule();
 				break;
 
 			case SIGKILL:
-				D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread(): SIGKILL received.\n"));
+				DBG_GCT(1, "SIGKILL received.\n");
 				goto die;
 
 			case SIGHUP:
-				D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread(): SIGHUP received.\n"));
+				DBG_GCT(1, "SIGHUP received.\n");
 				break;
 			default:
-				D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread(): signal %ld received\n", signr));
+				DBG_GCT(1, "signal %ld received\n", signr);
 			}
 		}
 		/* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */
 		disallow_signal(SIGHUP);
 
-		D1(printk(KERN_DEBUG "jffs3_garbage_collect_thread(): pass\n"));
+		DBG_GCT(1, "GC pass\n");
 		if (jffs3_garbage_collect_pass(c) == -ENOSPC) {
-			printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n");
+			WARNING_MSG("No space for garbage collection. Aborting GC thread\n");
 			goto die;
 		}
 	}





More information about the linux-mtd-cvs mailing list