Blame SOURCES/xfsprogs-4.13.0-mkfs.xfs-Don-t-stagger-AG-for-a-single-disk.patch

cbb4b9
From 9a106b5fbb88342f0ee02891d1bbb0e3c5a93d03 Mon Sep 17 00:00:00 2001
cbb4b9
From: Donald Douwsma <ddouwsma@redhat.com>
cbb4b9
Date: Fri, 15 Sep 2017 08:33:42 -0500
cbb4b9
Subject: [PATCH] mkfs.xfs: Don't stagger AG for a single disk
cbb4b9
cbb4b9
When sunit and swidth are used mkfs.xfs tries to avoid all allocation
cbb4b9
groups aligning on the same stripe and will attempt to stagger them
cbb4b9
across the stripes that make up swidth.  If there is only one stripe
cbb4b9
then there is no benefit in this optimisation.
cbb4b9
cbb4b9
$ truncate -s10G xfs_10G_su256k_sw1.image
cbb4b9
$ mkfs.xfs -d su=256k,sw=1 xfs_10G_su256k_sw1.image
cbb4b9
meta-data=xfs_10G_su256k_sw1.image isize=512    agcount=16, agsize=163776 blks
cbb4b9
         =                       sectsz=512   attr=2, projid32bit=1
cbb4b9
         =                       crc=1        finobt=0, sparse=0
cbb4b9
data     =                       bsize=4096   blocks=2620416, imaxpct=25
cbb4b9
         =                       sunit=64     swidth=64 blks
cbb4b9
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
cbb4b9
log      =internal log           bsize=4096   blocks=2560, version=2
cbb4b9
         =                       sectsz=512   sunit=64 blks, lazy-count=1
cbb4b9
realtime =none                   extsz=4096   blocks=0, rtextents=0
cbb4b9
cbb4b9
A side effect of the optimisation is that the size adjustment used to stager
cbb4b9
the allocation groups causes the last sunit of storage to be unused.
cbb4b9
cbb4b9
$ echo $((2620416*4096))
cbb4b9
10733223936
cbb4b9
$ ls -l xfs_10G_su256k_sw1.image
cbb4b9
-rw-rw-r--. 1 test test 10737418240 Aug 30 10:54 xfs_10G_su256k_sw1.image
cbb4b9
cbb4b9
Skip this optimisation when sunit == swidth.
cbb4b9
cbb4b9
Signed-off-by: Donald Douwsma <ddouwsma@redhat.com>
cbb4b9
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
cbb4b9
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
cbb4b9
---
cbb4b9
 mkfs/xfs_mkfs.c | 4 +++-
cbb4b9
 1 file changed, 3 insertions(+), 1 deletion(-)
cbb4b9
cbb4b9
Index: xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
cbb4b9
===================================================================
cbb4b9
--- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c
cbb4b9
+++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
cbb4b9
@@ -2308,7 +2308,9 @@ reported by the device (%u).\n"),
cbb4b9
 				}
cbb4b9
 			}
cbb4b9
 		}
cbb4b9
-		if (dswidth && ((agsize % dswidth) == 0) && (agcount > 1)) {
cbb4b9
+		if (dswidth && ((agsize % dswidth) == 0)
cbb4b9
+			    && (dswidth != dsunit)
cbb4b9
+			    && (agcount > 1)) {
cbb4b9
 			/* This is a non-optimal configuration because all AGs
cbb4b9
 			 * start on the same disk in the stripe.  Changing
cbb4b9
 			 * the AG size by one sunit will guarantee that this