Blame SOURCES/bz1436772-gfs2_grow_Disable_rgrp_alignment_when_dev_topology_is_unsuitable.patch

a440e7
commit ae565c82568a8b8068c225d8534c68c9989ccbe3
a440e7
Author: Andrew Price <anprice@redhat.com>
a440e7
Date:   Tue Mar 28 21:32:42 2017 +0100
a440e7
a440e7
    gfs2_grow: Disable rgrp alignment when dev topology is unsuitable
a440e7
    
a440e7
    If optimal_io_size is not a multiple of minimum_io_size then the values
a440e7
    are not reliable swidth and sunit values, so disable rgrp stripe
a440e7
    alignment in that case.
a440e7
    
a440e7
    Resolves: rhbz#1436772
a440e7
    
a440e7
    Signed-off-by: Andrew Price <anprice@redhat.com>
a440e7
a440e7
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
a440e7
index 173466c..66ba057 100644
a440e7
--- a/gfs2/mkfs/main_grow.c
a440e7
+++ b/gfs2/mkfs/main_grow.c
a440e7
@@ -169,8 +169,12 @@ static lgfs2_rgrps_t rgrps_init(struct gfs2_sbd *sdp)
a440e7
 			unsigned long min_io_sz = blkid_topology_get_minimum_io_size(tp);
a440e7
 			unsigned long opt_io_sz = blkid_topology_get_optimal_io_size(tp);
a440e7
 			unsigned long phy_sector_sz = blkid_topology_get_physical_sector_size(tp);
a440e7
+			/* If optimal_io_size is not a multiple of minimum_io_size then
a440e7
+			   the values are not reliable swidth and sunit values, so don't
a440e7
+			   attempt rgrp alignment */
a440e7
 			if ((min_io_sz > phy_sector_sz) &&
a440e7
-			    (opt_io_sz > phy_sector_sz)) {
a440e7
+			    (opt_io_sz > phy_sector_sz) &&
a440e7
+			    (opt_io_sz % min_io_sz == 0)) {
a440e7
 					al_base = opt_io_sz / sdp->bsize;
a440e7
 					al_off = min_io_sz / sdp->bsize;
a440e7
 			}