[comp.os.minix] Bug with dosread on half-bad blocks

evans@ditsyda.oz (Bruce Evans) (04/06/90)

I just noticed a problem with dosread. Block 4003 on my DOS partition is
bad. More precisely, sector 8007 is bad. Unfortunately, sector 8006 is
OK so DOS has only marked half the block as bad. So a DOS file that used
sector 8006 was not accessible to dosread, because the Minix file system
works with whole blocks.

The difference between blocks and sectors has already caused a lot of
trouble from partitions starting on odd sectors and having odd sizes.

It should be possible for dosread to use the raw disk devices to get
around these problems. The raw devices are made much like the block
devices, e.g. "mknod /dev/hd1 c 3 1" and almost work as it is. There are
several things to be fixed before they work right.

a) Consistency with the cache for the block devices.
b) The drivers reject odd sector addresses. I think only the floppy driver
   has a good reason for this - its multi-sector requests will fail when
   a track boundary is crossed. Minix would probably not work on single-
   sided disks, or with 4 sectors/block, because then track boundaries
   *would* be crossed for most disk geometries.
c) The drivers reject sector counts other than 2. The floppy driver has
   the same excuse as in b).
d) The drivers panic when a DMA boundary is crossed. They think it is a
   fatal bug in FS, but in fact it is easy for a user to supply a bad
   address if the raw devices are exposed.

Another reason for using the raw devices is that with block devices,
doswrite may be slowed down a lot by pre-reading of half-blocks into
the cache.
-- 
Please reply to the address in this .signature and not the one in the header.

Bruce Evans		evans@ditsyda.oz.au