Description of problem: In my test system I created a FS where the default allocation groups size happened to be of about 1 GiB: [root@localhost ~]# mkfs.xfs -L nss6_1 -f -d su=512k,sw=20 -l sunit=512,size=64m /dev/sdc meta-data=/dev/sdc isize=256 agcount=37, agsize=268435328 blks = sectsz=512 attr=2 data = bsize=4096 blocks=9764864000, imaxpct=5 = sunit=128 swidth=2560 blks naming =version 2 bsize=4096 ascii-ci=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=64 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 However if I specify less allocation groups then the default, instead of getting a message complaining of AG size too big I get this error message: [root@localhost ~]# mkfs.xfs -L nss6_1 -f -d agcount=31,su=512k,sw=20 -l sunit=512,size=64m ${dev1} Allocation group size (314995613) is not a multiple of the stripe unit (128) Version-Release number of selected component (if applicable): I am using a RHEL 6.1 server with kernel 2.6.32-131.0.15.el6.x86_64 and XFS packages: xfsprogs-devel-3.1.1-4.el6.x86_64 xfsprogs-3.1.1-4.el6.x86_64 xfsdump-3.0.4-2.el6.x86_64 xfsprogs-qa-devel-3.1.1-4.el6.x86_64 LANG=en_US.UTF-8 How reproducible: 100% Steps to Reproduce: 1. Create a XFS FS where allocation groups size is over 1 TiB. 2. Inspect the misleading error message. 3. Actual results: "Allocation group size (314995613) is not a multiple of the stripe unit (128)" Expected results: "Allocation group size (314995613 blks) is over maximum allocation groups size of 1 TiB (268435328 blks)" Or a message related to the AG size being over maximum allowed. Also a nice improvement is to add the units for values displayed in the message (blocks in this case). Note. I opened also a Red Hat bug: Bug 730433 - Error message when allocation group size too big is misleading
Closing - RHEL bug not upstream kernel tested
Bug exists upstream too, but anyway, RHEL bug at https://bugzilla.redhat.com/show_bug.cgi?id=730433 Fixed by commit ddf12ea5dc56a728f24d24c5d7403c3412b40b86 Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Mar 28 22:23:11 2012 -0500 mkfs.xfs: print std info if agcount makes agsize out of bounds When specifying a too-small agcount with stripe geometry, mkfs.xfs can fail with a somewhat unexpected message: $ mkfs.xfs -f -d file,name=fsfile,size=9764864000b,agcount=31,su=512k,sw=20 Allocation group size (314995613) is not a multiple of the stripe unit (128) This strikes me as especially odd because normally, mkfs.xfs tries to fix up the agsize to be a stripe multiple. The only way we get to the above error message is if ag _size_ is out of bounds; exiting with an error about alignment rather than about size seems odd. Maybe below is too clever, but if by the time we've decided that agsize is out of bounds after rounding it both up and down, as necessary, to get to a stripe-width multiple, calling validate_ag_geometry() will give us the same standard message as if we had specified no stripe geometry: $ mkfs/mkfs.xfs -f -d file,name=fsfile,size=9764864000b,agcount=31,su=512k,sw=20 agsize (314995613b) too big, maximum is 268435455 blocks Usage: mkfs.xfs ... $ mkfs/mkfs.xfs -f -d file,name=fsfile,size=9764864000b,agcount=31 agsize (314995613b) too big, maximum is 268435455 blocks Usage: mkfs.xfs ... Also, tidy up error message to explicitly state "blocks" not "b" Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>