* [PATCH] FAT fs printk() cleanup
@ 2002-05-31 12:50 Andrey Panin
2002-05-31 12:59 ` Richard B. Johnson
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Panin @ 2002-05-31 12:50 UTC (permalink / raw)
To: trivial; +Cc: linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 193 bytes --]
Patch (against 2.5.19) adds proper printk level into fat fs driver.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #1.2: patch-printk-fat-2.5.19 --]
[-- Type: text/plain, Size: 10038 bytes --]
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/cache.c linux/fs/fat/cache.c
--- linux.vanilla/fs/fat/cache.c Fri May 31 16:34:46 2002
+++ linux/fs/fat/cache.c Fri May 31 16:45:48 2002
@@ -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);
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/inode.c linux/fs/fat/inode.c
--- linux.vanilla/fs/fat/inode.c Fri May 31 16:34:46 2002
+++ linux/fs/fat/inode.c Fri May 31 16:46:39 2002
@@ -300,7 +300,7 @@
else *debug = 1;
}
else if (!strcmp(this_char,"fat")) {
- printk("FAT: fat option is obsolete, "
+ printk(KERN_WARNING "FAT: fat option is obsolete, "
"not supported now\n");
}
else if (!strcmp(this_char,"quiet")) {
@@ -308,7 +308,7 @@
else opts->quiet = 1;
}
else if (!strcmp(this_char,"blocksize")) {
- printk("FAT: blocksize option is obsolete, "
+ printk(KERN_WARNING "FAT: blocksize option is obsolete, "
"not supported now\n");
}
else if (!strcmp(this_char,"sys_immutable")) {
@@ -675,39 +675,39 @@
sb_min_blocksize(sb, 512);
bh = sb_bread(sb, 0);
if (bh == NULL) {
- printk("FAT: unable to read boot sector\n");
+ printk(KERN_ERR "FAT: unable to read boot sector\n");
goto out_fail;
}
b = (struct fat_boot_sector *) bh->b_data;
if (!b->reserved) {
if (!silent)
- printk("FAT: bogus number of reserved sectors\n");
+ printk(KERN_ERR "FAT: bogus number of reserved sectors\n");
brelse(bh);
goto out_invalid;
}
if (!b->fats) {
if (!silent)
- printk("FAT: bogus number of FAT structure\n");
+ printk(KERN_ERR "FAT: bogus number of FAT structure\n");
brelse(bh);
goto out_invalid;
}
if (!b->secs_track) {
if (!silent)
- printk("FAT: bogus sectors-per-track value\n");
+ printk(KERN_ERR "FAT: bogus sectors-per-track value\n");
brelse(bh);
goto out_invalid;
}
if (!b->heads) {
if (!silent)
- printk("FAT: bogus number-of-heads value\n");
+ printk(KERN_ERR "FAT: bogus number-of-heads value\n");
brelse(bh);
goto out_invalid;
}
media = b->media;
if (!FAT_VALID_MEDIA(media)) {
if (!silent)
- printk("FAT: invalid media value (0x%02x)\n", media);
+ printk(KERN_ERR "FAT: invalid media value (0x%02x)\n", media);
brelse(bh);
goto out_invalid;
}
@@ -718,7 +718,7 @@
|| (logical_sector_size < 512)
|| (PAGE_CACHE_SIZE < logical_sector_size)) {
if (!silent)
- printk("FAT: bogus logical sector size %d\n",
+ printk(KERN_ERR "FAT: bogus logical sector size %d\n",
logical_sector_size);
brelse(bh);
goto out_invalid;
@@ -727,14 +727,14 @@
if (!sbi->cluster_size
|| (sbi->cluster_size & (sbi->cluster_size - 1))) {
if (!silent)
- printk("FAT: bogus cluster size %d\n",
+ printk(KERN_ERR "FAT: bogus cluster size %d\n",
sbi->cluster_size);
brelse(bh);
goto out_invalid;
}
if (logical_sector_size < sb->s_blocksize) {
- printk("FAT: logical sector size too small for device"
+ printk(KERN_ERR "FAT: logical sector size too small for device"
" (logical sector size = %d)\n", logical_sector_size);
brelse(bh);
goto out_fail;
@@ -743,13 +743,13 @@
brelse(bh);
if (!sb_set_blocksize(sb, logical_sector_size)) {
- printk("FAT: unable to set blocksize %d\n",
+ printk(KERN_ERR "FAT: unable to set blocksize %d\n",
logical_sector_size);
goto out_fail;
}
bh = sb_bread(sb, 0);
if (bh == NULL) {
- printk("FAT: unable to read boot sector"
+ printk(KERN_ERR "FAT: unable to read boot sector"
" (logical sector size = %lu)\n",
sb->s_blocksize);
goto out_fail;
@@ -782,7 +782,7 @@
fsinfo_bh = sb_bread(sb, sbi->fsinfo_sector);
if (fsinfo_bh == NULL) {
- printk("FAT: bread failed, FSINFO block"
+ printk(KERN_ERR "FAT: bread failed, FSINFO block"
" (sector = %lu)\n", sbi->fsinfo_sector);
brelse(bh);
goto out_fail;
@@ -790,7 +790,7 @@
fsinfo = (struct fat_boot_fsinfo *)fsinfo_bh->b_data;
if (!IS_FSINFO(fsinfo)) {
- printk("FAT: Did not find valid FSINFO signature.\n"
+ printk(KERN_WARNING "FAT: Did not find valid FSINFO signature.\n"
" Found signature1 0x%08x signature2 0x%08x"
" (sector = %lu)\n",
CF_LE_L(fsinfo->signature1),
@@ -810,7 +810,7 @@
sbi->dir_entries =
CF_LE_W(get_unaligned((unsigned short *)&b->dir_entries));
if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
- printk("FAT: bogus directroy-entries per block\n");
+ printk(KERN_ERR "FAT: bogus directroy-entries per block\n");
brelse(bh);
goto out_invalid;
}
@@ -841,7 +841,7 @@
}
if (FAT_FIRST_ENT(sb, media) != first) {
if (!silent) {
- printk("FAT: invalid first entry of FAT "
+ printk(KERN_ERR "FAT: invalid first entry of FAT "
"(0x%x != 0x%x)\n",
FAT_FIRST_ENT(sb, media), first);
}
@@ -863,28 +863,28 @@
if (! sbi->nls_disk) {
/* Fail only if explicit charset specified */
if (sbi->options.codepage != 0) {
- printk("FAT: codepage %s not found\n", buf);
+ printk(KERN_ERR "FAT: codepage %s not found\n", buf);
goto out_fail;
}
sbi->options.codepage = 0; /* already 0?? */
sbi->nls_disk = load_nls_default();
}
if (!silent)
- printk("FAT: Using codepage %s\n", sbi->nls_disk->charset);
+ printk(KERN_INFO "FAT: Using codepage %s\n", sbi->nls_disk->charset);
/* FIXME: utf8 is using iocharset for upper/lower conversion */
if (sbi->options.isvfat) {
if (sbi->options.iocharset != NULL) {
sbi->nls_io = load_nls(sbi->options.iocharset);
if (!sbi->nls_io) {
- printk("FAT: IO charset %s not found\n",
+ printk(KERN_ERR "FAT: IO charset %s not found\n",
sbi->options.iocharset);
goto out_fail;
}
} else
sbi->nls_io = load_nls_default();
if (!silent)
- printk("FAT: Using IO charset %s\n",
+ printk(KERN_INFO "FAT: Using IO charset %s\n",
sbi->nls_io->charset);
}
@@ -901,7 +901,7 @@
insert_inode_hash(root_inode);
sb->s_root = d_alloc_root(root_inode);
if (!sb->s_root) {
- printk("FAT: get root inode failed\n");
+ printk(KERN_ERR "FAT: get root inode failed\n");
goto out_fail;
}
if(i >= 0) {
@@ -1089,7 +1089,7 @@
}
lock_kernel();
if (!(bh = fat_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
- printk("dev = %s, ino = %d\n", sb->s_id, i_pos);
+ printk(KERN_ERR "dev = %s, ino = %d\n", sb->s_id, i_pos);
fat_fs_panic(sb, "msdos_write_inode: unable to read i-node block");
unlock_kernel();
return;
diff -urN -X /usr/share/dontdiff linux.vanilla/fs/fat/misc.c linux/fs/fat/misc.c
--- linux.vanilla/fs/fat/misc.c Fri May 31 16:34:46 2002
+++ linux/fs/fat/misc.c Fri May 31 16:45:48 2002
@@ -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;
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] FAT fs printk() cleanup
2002-05-31 12:50 [PATCH] FAT fs printk() cleanup Andrey Panin
@ 2002-05-31 12:59 ` Richard B. Johnson
2002-05-31 13:14 ` Andrey Panin
0 siblings, 1 reply; 4+ messages in thread
From: Richard B. Johnson @ 2002-05-31 12:59 UTC (permalink / raw)
To: Andrey Panin; +Cc: trivial, linux-kernel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] FAT fs printk() cleanup
2002-05-31 12:59 ` Richard B. Johnson
@ 2002-05-31 13:14 ` Andrey Panin
2002-05-31 13:22 ` Richard B. Johnson
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Panin @ 2002-05-31 13:14 UTC (permalink / raw)
To: Richard B. Johnson; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 494 bytes --]
On Fri, May 31, 2002 at 08:59:08AM -0400, Richard B. Johnson wrote:
>
> 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.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] FAT fs printk() cleanup
2002-05-31 13:14 ` Andrey Panin
@ 2002-05-31 13:22 ` Richard B. Johnson
0 siblings, 0 replies; 4+ messages in thread
From: Richard B. Johnson @ 2002-05-31 13:22 UTC (permalink / raw)
To: Andrey Panin; +Cc: linux-kernel
On Fri, 31 May 2002, Andrey Panin wrote:
> On Fri, May 31, 2002 at 08:59:08AM -0400, Richard B. Johnson wrote:
> >
> > 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.
>
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-05-31 13:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-31 12:50 [PATCH] FAT fs printk() cleanup Andrey Panin
2002-05-31 12:59 ` Richard B. Johnson
2002-05-31 13:14 ` Andrey Panin
2002-05-31 13:22 ` Richard B. Johnson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.