[PATCH] mkfs: custom agcount that renders AG size < XFS_AG_MIN_BYTES gives "Assertion failed. Aborted"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For a 2GB FS we have
$ mkfs.xfs -f -d agcount=129 test.img
mkfs.xfs: xfs_mkfs.c:3021: align_ag_geometry: Assertion `!cli_opt_set(&dopts, D_AGCOUNT)' failed.
Aborted

With this change we have
$ mkfs.xfs -f -d agcount=129 test.img
Invalid value 129 for -d agcount option. Value is too large.

Signed-off-by: Srikanth C S <srikanth.c.s@xxxxxxxxxx>
---
 mkfs/xfs_mkfs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 057b3b09..32dcbfff 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -2897,6 +2897,13 @@ _("agsize (%s) not a multiple of fs blk size (%d)\n"),
 		cfg->agcount = cli->agcount;
 		cfg->agsize = cfg->dblocks / cfg->agcount +
 				(cfg->dblocks % cfg->agcount != 0);
+		if (cfg->agsize < XFS_AG_MIN_BYTES >> cfg->blocklog)
+		{
+			fprintf(stderr,
+_("Invalid value %lld for -d agcount option. Value is too large.\n"),
+				(long long)cli->agcount);
+			usage();	
+		}
 	} else {
 		calc_default_ag_geometry(cfg->blocklog, cfg->dblocks,
 					 cfg->dsunit, &cfg->agsize,
-- 
2.25.1



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux