bug-parted
[Top][All Lists]
Advanced

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

[PATCH parted 2/2] linux: Don't return bogus device alignment info


From: Hans de Goede
Subject: [PATCH parted 2/2] linux: Don't return bogus device alignment info
Date: Fri, 30 Oct 2009 11:46:23 +0100

* libparted/arch/linux.c (linux_get_xxx_alignment): blkid's topology io size
may be 0 when blkid could not get the minimum / optimum iosize. Return NULL
in this case instead of returning a bogus (grain_size == 0) alignment.
---
 libparted/arch/linux.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 7908c46..9566db8 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2529,7 +2529,7 @@ linux_get_minimum_alignment(const PedDevice *dev)
 {
         blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
 
-        if (!tp)
+        if (!tp || blkid_topology_get_minimum_io_size(tp) == 0)
                 return NULL; /* ped_alignment_none */
 
         return ped_alignment_new(
@@ -2542,7 +2542,7 @@ linux_get_optimum_alignment(const PedDevice *dev)
 {
         blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
 
-        if (!tp)
+        if (!tp || blkid_topology_get_optimal_io_size(tp) == 0)
                 return NULL; /* ped_alignment_none */
 
         return ped_alignment_new(
-- 
1.6.5.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]