Blame SOURCES/bz1698858-mkfs_gfs2_Improve_alignment_of_first_resource_group.patch

7aadc5
commit 12a82c8661b003736a0cb14fe042605f2412c329
7aadc5
Author: Andrew Price <anprice@redhat.com>
7aadc5
Date:   Thu Apr 25 11:21:22 2019 +0100
7aadc5
7aadc5
    mkfs.gfs2: Improve alignment of first resource group
7aadc5
    
7aadc5
    Currently the first rgrp is aligned to the whole stripe width and the
7aadc5
    second rgrp is aligned to (stripe width + 1 stripe unit) and so on, to
7aadc5
    spread them across an array. However, that means that there could be a
7aadc5
    large amount of space wasted between the superblock and the first
7aadc5
    resource group, and can result in the iovec used to zero that space
7aadc5
    exceeding IOV_MAX and failing mkfs.gfs2 (since 6cefaf33d5) if the array
7aadc5
    has a sufficiently large number of LUNs. Instead, align the first
7aadc5
    resource group to a stripe unit so that the gap is minimised. Resource
7aadc5
    groups are still spread across the array as the alignment of subsequent
7aadc5
    ones are handled separately.
7aadc5
    
7aadc5
    Resolves: rhbz#1698858
7aadc5
    
7aadc5
    Signed-off-by: Andrew Price <anprice@redhat.com>
7aadc5
7aadc5
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
7aadc5
index 3cdaccae..20ce5807 100644
7aadc5
--- a/gfs2/libgfs2/rgrp.c
7aadc5
+++ b/gfs2/libgfs2/rgrp.c
7aadc5
@@ -332,7 +332,7 @@ static uint64_t align_block(const uint64_t base, const uint64_t align)
7aadc5
  */
7aadc5
 uint64_t lgfs2_rgrp_align_addr(const lgfs2_rgrps_t rgs, uint64_t addr)
7aadc5
 {
7aadc5
-	return align_block(addr, rgs->align);
7aadc5
+	return align_block(addr, rgs->align_off);
7aadc5
 }
7aadc5
 
7aadc5
 /**
7aadc5
diff --git a/tests/mkfs.at b/tests/mkfs.at
7aadc5
index 2739561f..57785a0d 100644
7aadc5
--- a/tests/mkfs.at
7aadc5
+++ b/tests/mkfs.at
7aadc5
@@ -122,6 +122,8 @@ AT_KEYWORDS(mkfs.gfs2 mkfs)
7aadc5
 AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:65536:393216:512 $GFS_TGT], 0, [ignore], [ignore])
7aadc5
 # Check rgrp alignment to minimum_io_size: 65536 / 4096 == 16
7aadc5
 AT_CHECK([gfs2_edit -p rindex $GFS_TGT | grep ri_addr | awk '{print $2, $2 % 16; if ($2 % 16 != 0) { exit 1 }}'], 0, [ignore], [ignore])
7aadc5
+# rhbz#1698858
7aadc5
+AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:131072:6291456:512 $GFS_TGT], 0, [ignore], [ignore])
7aadc5
 AT_CLEANUP
7aadc5
 
7aadc5
 AT_SETUP([Values of rg_skip])