[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH parted 1/7] linux: Fixup phys_sector_size setting
From: |
Hans de Goede |
Subject: |
[PATCH parted 1/7] linux: Fixup phys_sector_size setting |
Date: |
Wed, 10 Feb 2010 14:12:55 +0100 |
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
- [PATCH parted 1/7] linux: Fixup phys_sector_size setting,
Hans de Goede <=
- [PATCH parted 3/7] linux: handle incomplete topology information, Hans de Goede, 2010/02/10
- [PATCH parted 6/7] parted: Change default alignment to optimal, Hans de Goede, 2010/02/10
- [PATCH parted 4/7] parted: Honor --align option also in mkpartfs, resize and print cmds, Hans de Goede, 2010/02/10
- [PATCH parted 7/7] dasd: Fix NULL pointer dereference in dasd_read, Hans de Goede, 2010/02/10
- [PATCH parted 5/7] parted: change warnings when initial constrained mkpart fails, Hans de Goede, 2010/02/10
- [PATCH parted 2/7] libparted: Give device_get_*_alignment sane defaults, Hans de Goede, 2010/02/10
- Re: [PATCH parted 1/7] linux: Fixup phys_sector_size setting, Jim Meyering, 2010/02/10