Re: superblock help [PATCH for fat]

Andries.Brouwer@cwi.nl
Thu, 1 Apr 1999 13:19:00 +0200 (MET DST)


> Here is the dump from two disks, one is a hard-disk that
> boots W98 just fine. That's the large file.
> The small file is from a Toray optical disk (650MB).
> I formatted both disks with W98 and they work with no problem on W98.

Thanks!

The first one (your /dev/sdb1 if I am not mistaken)
has 65245 clusters, while the fat only describes 64256.
So, you waste a thousand clusters where the kernel
only expects at most 3 wasted clusters.

I suppose the following patch would help:

--- /g1/linux/linux-2.2.5/linux/fs/fat/inode.c Mon Jan 4 19:08:28 1999
+++ ./inode.c Thu Apr 1 12:40:24 1999
@@ -406,9 +406,12 @@
fat_clusters = MSDOS_SB(sb)->fat_length*SECTOR_SIZE*8/
MSDOS_SB(sb)->fat_bits;
error = !MSDOS_SB(sb)->fats || (MSDOS_SB(sb)->dir_entries &
- (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > fat_clusters+
- MSDOS_MAX_EXTRA || (logical_sector_size & (SECTOR_SIZE-1))
+ (MSDOS_DPS-1)) || (logical_sector_size & (SECTOR_SIZE-1))
|| !b->secs_track || !b->heads;
+ if (!error)
+ if (MSDOS_SB(sb)->clusters+2 > fat_clusters+MSDOS_MAX_EXTRA)
+ printk("Funny: clusters+2=%d fat_clusters=%d\n",
+ MSDOS_SB(sb)->clusters+2, fat_clusters);
}
fat_brelse(sb, bh);
/*
@@ -420,7 +423,7 @@
/* because clusters (DOS) are often aligned */
/* on odd sectors. */
sb->s_blocksize_bits = blksize == 512 ? 9 : (blksize == 1024 ? 10 : 11);
- if (!strcmp(cvf_format,"none"))
+ if (error || !strcmp(cvf_format,"none"))
i = -1;
else
i = detect_cvf(sb,cvf_format);

About the second disk, it looks uneventful:

Units = cylinders of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
disk21 0+ 633 634- 649200 6 FAT16
disk22 ? 0 - 0 0 0 Empty
disk23 0 - 0 0 0 Empty
disk24 0 - 0 0 0 Empty

But there is no FAT filesystem to be seen - everything is just empty.

Andries

[P.S. In case you try the abve patch, please report.
It was pasted from another window - tabs will have become spaces.]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/