Jason Thorpe wrote: > On Jan 13, 2010, at 3:57 AM, Izumi Tsutsui wrote: > > > As I wrote first, we should make a decision of buffercache(9) > > and physio(9) APIs for !512bytes/sector disks. > > Fixing file systems or disk drivers without it just generates > > yet another random inconsisntent patch because there is no "right" fix. > > We have to consider which should be used hardware sector size or > > min I/O size everywhere DEV_BSIZE and "disk block (fsbtodb, blkno etc)" > > are referred. > > My preference would be to have the devices themselves report > the physical block size to be used, and to refer to that value > throughout the storage stack when performing I/O do that device. > I think the DEV_BSIZE constant should go away.
I also prefer it, but an annoying problem is that we already have too many sources that assume I/O size is DEV_BSIZE constant. How do you think about disk_blocksize() in kern/subr_disk.c and DK_BSIZE2BBLKSHIFT() macro in <sys/disk.h>, for example? What about "if (lp->d_secsize == DEV_BSIZE)" checks in sys/dev/scsipi/sd.c:sdstrategy() and sys/dev/ata/wd.c:wdstrategy() etc? What should we do for all use of btodb() and dbtob() macro in file system code? Does "disk block" in file system sources mean unit of physical block size (that would be variable), or logical one (I/O size defined by the OS)? > Perhaps you should write up a proposal to float by Core? Well, I think it was proposed and asked in PR 3790, 3791, and 3792 by the late Koji Imada, back in 1997. I discussed with him about this issue, but I didn't have knowledge about kernel development at all in those days.. I just re-read them bacause I encountered the DEV_BSIZE problem on cross environment on Cygwin where DEV_BSIZE == 1024, as mentioned in PR 42555, 42573, and 42574. The simple solution for them is #undef DEV_BSIZE rather than #ifndef DEV_BSIZE in src/tools/compat/compat_defs.h, but... --- Izumi Tsutsui
