Skip to contentSkip to conversation

FAT fs printk() cleanup

PATCH In review Andrey Panin 2 participants 4 messages May 31, 2002 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FAT fs printk() cleanup

Patch (against 2.5.19) adds proper printk level into fat fs driver.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: wwwkeys.eu.pgp.net
fs/fat/cache.c +3 -3
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/cache.c linux/fs/fat/cache.c
@@ -52,7 +52,7 @@
 	}
 	b = sbi->fat_start + (first >> sb->s_blocksize_bits);
 	if (!(bh = fat_bread(sb, b))) {
-		printk("FAT: bread(block %d) in fat_access failed\n", b);
+		printk(KERN_ERR "FAT: bread(block %d) in fat_access failed\n", b);
 		return -EIO;
 	}
 	if ((first >> sb->s_blocksize_bits) == (last >> sb->s_blocksize_bits)) {
@@ -60,7 +60,7 @@
 	} else {
 		if (!(bh2 = fat_bread(sb, b+1))) {
 			fat_brelse(sb, bh);
-			printk("FAT: bread(block %d) in fat_access failed\n",
+			printk(KERN_ERR "FAT: bread(block %d) in fat_access failed\n",
 			       b + 1);
 			return -EIO;
 		}
@@ -227,7 +227,7 @@
 		    && walk->start_cluster == first
 		    && walk->file_cluster == f_clu) {
 			if (walk->disk_cluster != d_clu) {
-				printk("FAT: cache corruption inode=%lu\n",
+				printk(KERN_ERR "FAT: cache corruption inode=%lu\n",
 					inode->i_ino);
 				spin_unlock(&fat_cache_lock);
 				fat_cache_inval_inode(inode);
fs/fat/inode.c +23 -23

180 lines not on this page · raw message

fs/fat/misc.c +8 -8
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/misc.c linux/fs/fat/misc.c
@@ -49,10 +49,10 @@
 	if (not_ro)
 		s->s_flags |= MS_RDONLY;
 
-	printk("FAT: Filesystem panic (dev %s)\n"
+	printk(KERN_ERR "FAT: Filesystem panic (dev %s)\n"
 	       "    %s\n", s->s_id, panic_msg);
 	if (not_ro)
-		printk("    File system has been set read-only\n");
+		printk(KERN_ERR "    File system has been set read-only\n");
 }
 
 
@@ -75,7 +75,7 @@
 				if (!strncmp(extension,walk,3)) return 0;
 			return 1;	/* default binary conversion */
 		default:
-			printk("Invalid conversion mode - defaulting to "
+			printk(KERN_WARNING "Invalid conversion mode - defaulting to "
 			    "binary.\n");
 			return 1;
 	}
@@ -105,14 +105,14 @@
 
 	bh = fat_bread(sb, MSDOS_SB(sb)->fsinfo_sector);
 	if (bh == NULL) {
-		printk("FAT bread failed in fat_clusters_flush\n");
+		printk(KERN_ERR "FAT bread failed in fat_clusters_flush\n");
 		return;
 	}
 
 	fsinfo = (struct fat_boot_fsinfo *)bh->b_data;
 	/* Sanity check */
 	if (!IS_FSINFO(fsinfo)) {
-		printk("FAT: Did not find valid FSINFO signature.\n"
+		printk(KERN_ERR "FAT: Did not find valid FSINFO signature.\n"
 		       "     Found signature1 0x%08x signature2 0x%08x"
 		       " (sector = %lu)\n",
 		       CF_LE_L(fsinfo->signature1), CF_LE_L(fsinfo->signature2),
@@ -205,7 +205,7 @@
 		mark_inode_dirty(inode);
 	}
 	if (file_cluster != (inode->i_blocks >> (cluster_bits - 9))) {
-		printk ("file_cluster badly computed!!! %d <> %ld\n",
+		printk (KERN_ERR "file_cluster badly computed!!! %d <> %ld\n",
 			file_cluster, inode->i_blocks >> (cluster_bits - 9));
 		fat_cache_inval_inode(inode);
 	}
@@ -240,7 +240,7 @@
 	} else {
 		for ( ; sector < last_sector; sector++) {
 			if (!(bh = fat_getblk(sb, sector)))
-				printk("FAT: fat_getblk() failed\n");
+				printk(KERN_ERR "FAT: fat_getblk() failed\n");
 			else {
 				memset(bh->b_data, 0, sb->s_blocksize);
 				fat_set_uptodate(sb, bh, 1);
@@ -357,7 +357,7 @@
 
 	*bh = fat_bread(sb, sector);
 	if (*bh == NULL) {
-		printk("FAT: Directory bread(block %d) failed\n", sector);
+		printk(KERN_ERR "FAT: Directory bread(block %d) failed\n", sector);
 		/* skip this block */
 		*pos = (iblock + 1) << sb->s_blocksize_bits;
 		goto next;
#1 lore raw

I think it needs to go only to the console....

File-system error...
printk(...to the file system)
makes a file-system error...
<forever>

Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).

Windows-2000/Professional isn't.

#2 lore raw
In reply to Andrey Panin
Quoted 7 lines · Richard B. Johnson

I think it needs to go only to the console....

File-system error...
printk(...to the file system)
makes a file-system error...
<forever>

Do you have /var/log on FAT partition or on the floppy ? Yes, I know about umsdos, but show me one who *really* use it.

Signature · 2 lines
Andrey Panin            | Embedded systems software engineer
[email protected]        | PGP key: wwwkeys.eu.pgp.net
#3 lore raw
Quoted 4 lines · Andrey Panin
Quoted 3 lines · Richard B. Johnson

I think it needs to go only to the console....

Quoted 8 lines
Quoted 4 lines

File-system error...
printk(...to the file system)
makes a file-system error...
<forever>

Do you have /var/log on FAT partition or on the floppy ? Yes, I know about umsdos, but show me one who *really* use it.

Yes, that's what caught my attention. Also floppies are the most likely drives to produce errors. You might need a bit less "perfection" in your rule-making to accommodate real-world problems. Many servers have the root file-system mounted r/o with writable "throw-aways" mounted on the usual mount-points like /tmp and /var.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).

Windows-2000/Professional isn't.