All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkfs.xfs: print std info if agcount makes agsize out of bounds
@ 2012-03-28 20:35 Eric Sandeen
  2012-03-29  1:24 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2012-03-28 20:35 UTC (permalink / raw)
  To: xfs-oss

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
...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 5445b6f..1f829c5 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2174,9 +2174,12 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
 				if (nodsflag) {
 					dsunit = dswidth = 0;
 				} else {
-					fprintf(stderr,
-_("Allocation group size (%lld) is not a multiple of the stripe unit (%d)\n"),
-						(long long)agsize, dsunit);
+					/*
+					 * agsize is out of bounds, this will
+					 * print nice details & exit.
+					 */
+					validate_ag_geometry(blocklog, dblocks,
+							    agsize, agcount);
 					exit(1);
 				}
 			}

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mkfs.xfs: print std info if agcount makes agsize out of bounds
  2012-03-28 20:35 [PATCH] mkfs.xfs: print std info if agcount makes agsize out of bounds Eric Sandeen
@ 2012-03-29  1:24 ` Dave Chinner
  2012-03-29  1:53   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2012-03-29  1:24 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Wed, Mar 28, 2012 at 03:35:03PM -0500, Eric Sandeen wrote:
> 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
> ...
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Makes sense. Consider it:

Reviewed-by: Dave Chinner <dchinner@redhat.com>

As an aside, do you want to touch that error message:

agsize (314995613b) too big, maximum is 268435455 blocks

so that it uses the same notation for blocks for both numbers. i.e.
something like:

agsize (314995613 blocks) too big, maximum is 268435455 blocks

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mkfs.xfs: print std info if agcount makes agsize out of bounds
  2012-03-29  1:24 ` Dave Chinner
@ 2012-03-29  1:53   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2012-03-29  1:53 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs-oss

On 3/28/12 8:24 PM, Dave Chinner wrote:
> On Wed, Mar 28, 2012 at 03:35:03PM -0500, Eric Sandeen wrote:
>> 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
>> ...
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> Makes sense. Consider it:
> 
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> 
> As an aside, do you want to touch that error message:
> 
> agsize (314995613b) too big, maximum is 268435455 blocks
> 
> so that it uses the same notation for blocks for both numbers. i.e.
> something like:
> 
> agsize (314995613 blocks) too big, maximum is 268435455 blocks

Good idea, will do.

-Eric

> Cheers,
> 
> Dave.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-29  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28 20:35 [PATCH] mkfs.xfs: print std info if agcount makes agsize out of bounds Eric Sandeen
2012-03-29  1:24 ` Dave Chinner
2012-03-29  1:53   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.