lsunit was already tested, but lsu was not. So a thing like -l su=4097 was possible. This commit adds a check to catch this, and moves the entire lsu/lsunit block size testing to calc_stripe_factors(), where already is some logic w.r.t. lsu/lsunit. Signed-off-by: Jan Tulak <jtulak@xxxxxxxxxx> --- UPDATE: Moving the checks to calc_stripe_factors(). An example of previously failing options: mkfs.xfs -f -dfile,name=fsfile,size=128m -l su=16385 --- mkfs/xfs_mkfs.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 6059d91..b8f6b89 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -726,6 +726,9 @@ struct opt_params mopts = { */ #define WHACK_SIZE (128 * 1024) +/* + * Convert lsu to lsunit for 512 bytes blocks and check validity of the values. + */ static void calc_stripe_factors( int dsu, @@ -775,6 +778,20 @@ calc_stripe_factors( if (lsu) *lsunit = (int)BTOBBT(lsu); + + /* verify if lsu/lsunit is a multiple block size */ + if (lsu % blocksize != 0) { + fprintf(stderr, +_("log stripe unit (%d) must be a multiple of the block size (%d)\n"), + lsu, blocksize); + exit(1); + } + if ((BBTOB(*lsunit) % blocksize != 0)) { + fprintf(stderr, +_("log stripe unit (%d) must be a multiple of the block size (%d)\n"), + BBTOB(*lsunit), blocksize); + exit(1); + } } /* @@ -2862,12 +2879,6 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), */ if (lsunit) { - if ((BBTOB(lsunit) % blocksize != 0)) { - fprintf(stderr, - _("log stripe unit (%d) must be a multiple of the block size (%d)\n"), - BBTOB(lsunit), blocksize); - exit(1); - } /* convert from 512 byte blocks to fs blocks */ lsunit = DTOBT(lsunit); } else if (sb_feat.log_version == 2 && loginternal && dsunit) { -- 2.5.5 _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs