tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: blocksizes



> 
> >To translate file system block size (i.e. unit of fragment size)
> >into raw I/O size, we can ignore fsbtodb.
> 
> I have now committed changes to msdofs, ext2fs and ffs to support
> disks with non-512-byte sectors.
> 
> Part of that change is a common function to query disk and sector
> sizes that replaces individual ioctl queries. Unlike the latter
> this will fail if the ioctls fail. The old code just assumed that
> DEV_BSIZE was correct.

---
diff -u src/sys/ufs/ffs/fs.h:1.54 src/sys/ufs/ffs/fs.h:1.55
 :
@@ -599,8 +599,13 @@
  * Turn file system block numbers into disk block addresses.
  * This maps file system blocks to device size blocks.
  */
+#if defined (_KERNEL)
+#define        fsbtodb(fs, b)  ((b) << ((fs)->fs_fshift - DEV_BSHIFT))
+#define        dbtofsb(fs, b)  ((b) >> ((fs)->fs_fshift - DEV_BSHIFT))
+#else
 #define        fsbtodb(fs, b)  ((b) << (fs)->fs_fsbtodb)
 #define        dbtofsb(fs, b)  ((b) >> (fs)->fs_fsbtodb)
+#endif
---

I doubt this would work properly. Isn't it better to have new macros
for raw I/O size and to replace old ones with them for bread(9)
or blkno etc?

I think fsbtodb()/dbtofsb() should be left as is because
they are for the "FFS disk block size stored in superblock"
which is still used in dinode and it could be different from
raw I/O size.

> Can you please test with your 2K MO?

It's not easy to test it without working newfs(8) command.
(if you need hardware I can send the drive and media..)

> N.B. newfs doesn't yet know how to deduce sector sizes, you need
> to use the -S option.

newfs(8) doesn't work even with -S 2048 option.
(probably it tries to write data at offset not sectorsize aligned)
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index