[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/54470: Adapt FFS to work with HP-UX UFS1 variant
The following reply was made to PR kern/54470; it has been noted by GNATS.
From: mlelstv%serpens.de@localhost (Michael van Elst)
Subject: Re: kern/54470: Adapt FFS to work with HP-UX UFS1 variant
Date: Sat, 17 Aug 2019 11:15:28 -0000 (UTC)
perseant%hhhh.org@localhost (Konrad Schroder) writes:
>Can you be more specific?Â It gives the right values for my HP-UX image,
>and for existing NetBSD file systems.
>> >+#define BTODB(fs, size) ((size) >> ((fs)->fs_fshift - (fs)->fs_fsbtodb))
>> >+#define DBTOB(fs, bc) ((bc) << ((fs)->fs_fshift - (fs)->fs_fsbtodb))
The original BSD code used definitions like these above as a 'disk offset'
referred to physical block numbers. This is still used that way in
NetBSD disk drivers always use logical block numbers for a block size
of 512 bytes (DEV_BSIZE) and filesystems ignore the superblock values when
translating between filesystem block numbers and disk block numbers.
For FFS the macros FFS_FSBTODB / FFS_DBTOFSB are used to do this conversion.
They are differently defined for kernel and userland to address the different
btodb / dbtob are originally MD macros (then unified) that always used
a platform specific unit, i.e. DEV_BSIZE, to specify disk offsets. This
unit is independent of a particular filesystem and the physical blocks of
a specific device.
Now what unit does di_blocks use, it's only used for reporting and quota
calculations ? The original code used btodb(file_length), i.e. the values
used the platform-wide DEV_BSIZE as a unit and that's what we still use
Your patch changes that and di_blocks is now using the physical block
size of the particular disk (recorded in the superblock) as the unit.
Apparently that's what HP-UX is doing.
I see two issues: you added another view on disk offsets and you break
existing filesystems that use a physical sector size != 512.
Apparently we need conditional code to handle di_blocks for the
Michael van Elst
"A potential Snark may lurk in every tree."
Main Index |
Thread Index |