paula@bcsaic.UUCP (Paul Allen) (10/24/89)
In <24297@louie.udel.EDU>, Guy Helmer noted that the badblocks program doesn't correctly handle bad blocks with numbers greater than 8191. Basically, the inode created by badblocks points to the right block numbers, but all of the blocks get mapped into the first block of the zone bitmap. Although I think fsck will repair the damage, the fix for badblocks.c is simple. In blk_ok() and in set_bit(), the lines that read: words = offset/INT_BITS; should read: words = z_num/INT_BITS; With this fix, fsck is now happy with my minix partition. (Except for the part that's larger than 32M. Read on...) Also, badblocks can be modified to handle block numbers up to 65535 by changing a couple ints to unsigned. Specifically: - In main(), blk_nr should be unsigned. - In blk_ok() and set_bit(), the argument num and the variable z_num should be unsigned. - In blk_ok() and set_bit(), znum should be calculated by: z_num = num - (sp->s_firstdatazone-1); rather than: z_num = num + 1 - sp->s_firstdatazone; (Only matters if you want to use block 65535!) With all of the above changes, I can map out all of the bad blocks on my 40Mb Minix partition and fsck is happy. However, if I write one block more than 32Mb into the partition, things start to get screwy. The 'df' program complains that it can't find the bit maps. Fsck seems to find something wrong with every block on the partition! The superblock looks fine through all this, so the file system is not wrapping around through block zero. If the file that crossed over the 32Mb boundary is deleted, df works normally and fsck only finds a few 'missing' zones with numbers >32767. I suspect a problem with the zone bitmap but haven't been able to put my finger on it. I have a suspicion that some int's in df.c, fsck.c or fs/super.c perhaps should be unsigned, but haven't tried changing anything yet. Is anybody else working in this area? I'm running 1.3 with a couple changes for my 5-head 26-sector drive. My sources are descended from 1.1 via the 1.2 and 1.3 diffs on bugs.nosc.mil. Paul Allen pallen@atc.boeing.com ..!uw-beaver!bcsaic!pallen -- ------------------------------------------------------------------------ Paul L. Allen | pallen@atc.boeing.com Boeing Advanced Technology Center | ...!uw-beaver!bcsaic!pallen