on 12/02/2008 13:47 Poul-Henning Kamp said the following: > In message <[EMAIL PROTECTED]>, Andriy Gapon writes: > >> 2.3. this code passes to bread blkno that is calculated as 4*sector, >> where sector is a number of a physical 2048-byte sector. [**] >> [**] - I think that this is a requirement of buffcache system, because >> internally it performs many calculations that seem to assume that block >> size is always 512. > > Yes, the buf-cache works in 512 bytes units throughout. > >> 3.1. for a fresh buf getlbk would assign the following: >> bsize = bo->bo_bsize; >> offset = blkno * bsize; > > That's clearly wrong. > > We need to assert that the blkno is aligned to the start of a sector > and use the 512 byte units, so I guess it would be: > > offset = dbtob(blkno); > KASSERT(!(offset & (bsize - 1)), ("suitable diagnostic")); > >
Thank you for this very insightful and neat suggestion! I think that it must work but I will try test it tonight on whatever media and FS-s I have available. Thank you again! P.S. hope to not get '"suitable diagnostic"' from something like msdosfs :-) -- Andriy Gapon _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"