tech-kern archive

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

Re: File systems on 4k sector devices?



david%l8s.co.uk@localhost (David Laight) writes:

>On Thu, Jun 07, 2012 at 11:12:42AM -0400, Thor Lancelot Simon wrote:
>> On Thu, Jun 07, 2012 at 11:07:31AM +0000, Michael van Elst wrote:
>> > 
>> > To make fsck work you need to patch the superblock to reflect reality,
>> > but I fear there is no tool for that. Maybe we should invent a tunefs
>> > option to adjust the superblock.
>> 
>> Something very similar is needed for cgd.

>Surely fsck could work it out?

The major change to the kernel that makes the filesystem talk to
devices in DEV_BSIZE units instead of listening to the superblock
value is:

/* 
 * 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

Obviously you could extend this to the userland and make it ignore
the superblock values the same way. You would even get rid of some
code that makes simulates block access to a disk device which always
has used byte offset in userland.

At the same time however, you would lose compatibility with foreign
FFS filesystems.

When making the filesystem work with larger sectors, I didn't consider
this change in compatibility useful.

-- 
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index