[parted-devel] RFC: Define PedSector to be 512 bytes
Jim Meyering
jim at meyering.net
Mon Jan 26 14:36:28 UTC 2009
Matt Domsch <Matt_Domsch at dell.com> wrote:
> After a long hiatus, I've started looking at GPT and 4k-sector-size
> disks again.
>
>
> Conveniently, Matthew Wilcox has done work on the ATA layer, and wrote
> an 'ata_ram' module which emulates an ATA disk, complete with letting
> the user specify the reported logical block size.
> http://git.kernel.org/?p=linux/kernel/git/willy/misc.git;a=summary
> (see the ata-ram and ata-large-sectors branches; some minor fixups
> needed to work on current Linus kernels which I'll work with Matthew
> to get pushed).
>
> The patch below (on top of Fedora's source RPM) is necessary to get
> GPT tables written and read properly on 4k disks. But, it's not
> sufficient...
>
> The next challenge is that anything calling ped_device_{read,write}()
> does so using "PedSector count" as the implicit length of the buffer.
>
> extern int ped_device_read (const PedDevice* dev, void* buffer,
> PedSector start, PedSector count);
> extern int ped_device_write (PedDevice* dev, const void* buffer,
> PedSector start, PedSector count);
>
> With only the patch below, the ext2/3 probe() code dies immediately by
> reading a 4k PedSector into a 512b buffer.
>
> Either we'll have to each every caller of these functions that buffer
> needs to be arbitrarily large (to allow for PedSector to be of
> variable length) and do the math to munge "PedSector start", or we're
> going to have to define PedSector to be 512 bytes, and inside these
> functions, adjust on a per-device basis. I believe the latter is the
> right choice, as it puts the complications in exactly one place.
I began that tedious process about 18 months ago.
Have a look at the next branch.
http://git.debian.org/?p=parted/parted.git;a=shortlog;h=refs/heads/next
I think I got GPT support mostly working, but that was using
only a newly-added option to simulate sector size != 512.
If you can test with real devices, that's even better.
And it's not thoroughly tested, though I have been trying
to add tests as I go.
I've just rebased it against master.
More information about the parted-devel
mailing list