[parted-devel] [PATCH] libparted: fix optimal IO alignment

Phillip Susi phillsusi at gmail.com
Thu Jan 5 20:40:47 UTC 2012


There were several apparently incorrect tests that would
cause the kernel supplied optimal io size to be discarded in
favor of the default 1MB alignment.  As written, it would
only accept the kernel alignment if it was both greater than
and not an even multiple of the default.  Remove these
tests and accept the kernel value if it is non zero.
---
 libparted/arch/linux.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index e2c4139..f560451 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2948,15 +2948,7 @@ linux_get_optimum_alignment(const PedDevice *dev)
            previous logic. */
         unsigned long optimal_io = blkid_topology_get_optimal_io_size(tp);
         unsigned long minimum_io = blkid_topology_get_minimum_io_size(tp);
-        if (
-            (!optimal_io && !minimum_io)
-	    || (optimal_io && PED_DEFAULT_ALIGNMENT % optimal_io == 0
-		&& minimum_io && PED_DEFAULT_ALIGNMENT % minimum_io == 0)
-	    || (!minimum_io && optimal_io
-		&& PED_DEFAULT_ALIGNMENT % optimal_io == 0)
-	    || (!optimal_io && minimum_io
-		&& PED_DEFAULT_ALIGNMENT % minimum_io == 0)
-           ) {
+        if (!optimal_io) {
             /* DASD needs to use minimum alignment */
             if (dev->type == PED_DEVICE_DASD)
                 return linux_get_minimum_alignment(dev);
-- 
1.7.5.4




More information about the parted-devel mailing list