[parted-devel] [PATCH] linux.c: use ioctl(BLKSSZGET) and ioctl(BLKBSZGET) appropriately

Matt Domsch Matt_Domsch at dell.com
Wed Jan 28 06:15:40 UTC 2009


On Tue, Jan 27, 2009 at 09:52:51AM -0600, Matt Domsch wrote:
> From 6119af38a3f22540376d5a2a93490f6e228a2e02 Mon Sep 17 00:00:00 2001
> From: Matt Domsch <Matt_Domsch at dell.com>
> Date: Tue, 27 Jan 2009 09:42:07 -0600
> Subject: [PATCH] linux.c: use ioctl(BLKSSZGET) and ioctl(BLKBSZGET) appropriately
> 
> BLKSSZGET is for physical sector size, BLKBSZGET is for logical sector
> size.  Parted has until now been using a physical sector size of
> PED_SECTOR_SIZE_DEFAULT, and using the kernel-reported physical sector
> size as the logical sector size.

belay that.  BLKBSZGET is the kernel's chosen block size it will use
to access the device (for normal disks turns out this is 1k, for
ata_ram this is 4k), which is not the underlying disk's logical block
size. :-( So we will likely need another ioctl() to get the right
value from the kernel, and BLKSSZGET may wind up being the disks's
logical block size, while a new ioctl() exports the disk's physical
sector size.  ugh.

-- 
Matt Domsch
Linux Technology Strategist, Dell Office of the CTO
linux.dell.com & www.dell.com/linux



More information about the parted-devel mailing list