1) Use the logical sector size as physical sector size instead of 512 when not compiled with libblkid support, this fixes problems with logical sector size > physical sector size. 2) blkid_topology_get_physical_sector_size() can return 0 when it could not determine the physical sector size, handle this. * libparted/arch/linux.c (_device_set_sector_size): Fixup phys_sector_size setting. --- NEWS | 2 ++ libparted/arch/linux.c | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS index e6a491c..c031018 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,8 @@ GNU parted NEWS -*- outline -*- "make install" no longer installs tests programs named disk and label + Fix physical sector size being 0 or smaller then the logical sector size. + * Noteworthy changes in release 2.1 (2009-12-20) [stable] diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index f3b54f0..4b7b9f5 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -654,22 +654,27 @@ _device_set_sector_size (PedDevice* dev) dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT); } else { dev->sector_size = (long long)sector_size; + dev->phys_sector_size = dev->sector_size; } #if USE_BLKID get_blkid_topology(arch_specific); if (!arch_specific->topology) { - ped_exception_throw ( - PED_EXCEPTION_WARNING, - PED_EXCEPTION_OK, - _("Could not determine minimum io size for %s: %s.\n" - "Using the default size (%lld)."), - dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT); + dev->phys_sector_size = 0; } else { dev->phys_sector_size = blkid_topology_get_physical_sector_size( arch_specific->topology); } + if (dev->phys_sector_size == 0) { + ped_exception_throw ( + PED_EXCEPTION_WARNING, + PED_EXCEPTION_OK, + _("Could not determine physical sector size for %s.\n" + "Using the logical sector size (%lld)."), + dev->path, dev->sector_size); + dev->phys_sector_size = dev->sector_size; + } #endif #if defined __s390__ || defined __s390x__ -- 1.6.6 _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted