On 15/08/17(Tue) 17:20, Stefan Fritsch wrote: > Hi, > > this is another try at making read clustering work for msdosfs. > > Last year, mpi@ implemented VFS read clustering for MSDOSFS in > > sys/msdosfs/denode.h 1.28 > sys/msdosfs/msdosfs_vnops.c 1.105 > > This caused regressions when doing seeks past the end of the file and had. > to be reverted. Then I tried to fix that in > > denode.h,v 1.31 > msdosfs_vnops.c,v 1.114 > > But that caused different problems and had to be reverted, too. I have > another test for that that I will commit soon. > > It seems that while netbsd uses DEV_BSIZE as base for the logical block > numbers even in files, openbsd is more like freebsd and uses > mnt_stat.f_iosize in that case. However, if the file system does accesses > for metadata on the disk, it has to use DEV_BSIZE for accesses. So the > fixes in 1.31/1.114 were wrong and the following diff is again based on > 1.28/1.105 with some fixes in extendfile() to make seeks past the end of > the file work. > > > Testers/reviews/OKs welcome. Especially people who need msdosfs for > booting via uefi. In any case, I won't commit until I get home again in a > week.
Thanks for taking care of that. The diff does solve the clustering problem. However it introduces an inconsistency which is also present in FreeBSD where the logic comes from. With this diff, cluster numbers are now sometimes used as logical block numbers, via bread(9). This is due to historical artifacts, ws@NetBSD decided at some point to always use device block numbers for logical block numbers, but FreeBSD didn't pick this change. I'm afraid this inconsistency can cause problems at the VFS/buffer cache layer, because the same block could be buffered twice with different logical block numbers. Would it be possible to keep device block numbers as logical block numbers? Or should we move to cluster numbers everywhere? Or is there a flaw in my understanding?