aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-05-29 18:55:56 +0200
committerEryu Guan <guaneryu@gmail.com>2018-06-03 22:16:15 +0800
commit828f12b965d9bdaa2871b72ae86e443974b0a9b0 (patch)
tree54c80a0330c08e9f19aea20740684b82e86d6325
parent141bd37a36857984bb80f8534810951002dcdf13 (diff)
downloadxfstests-dev-828f12b965d9bdaa2871b72ae86e443974b0a9b0.tar.gz
dmhugedisk: Allow specifying of chunk size
Ext4 will want to use dmhugedisk infrastructure for testing resize bugs. Ext4 fs images are rather sparse (especially with smaller block sizes) so the current chunk size of 512 sectors leads to large space consumption. Allow test to specify chunk size. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/dmhugedisk7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/dmhugedisk b/common/dmhugedisk
index 4d3b63fcfc..733b10cd22 100644
--- a/common/dmhugedisk
+++ b/common/dmhugedisk
@@ -31,6 +31,11 @@ _dmhugedisk_init()
{
test -z "$1" && _fatal "must specify sector count to _dmhugedisk_init"
local dm_backing_dev=$SCRATCH_DEV
+ local chunk_size="$2"
+
+ if [ -z "$chunk_size" ]; then
+ chunk_size=512
+ fi
$DMSETUP_PROG remove huge-test > /dev/null 2>&1
$DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1
@@ -41,7 +46,7 @@ _dmhugedisk_init()
DMHUGEDISK_DEV='/dev/mapper/huge-test'
DMHUGEDISK_ZERO_TABLE="0 $blk_dev_size zero"
- DMHUGEDISK_DEV_TABLE="0 $blk_dev_size snapshot $DMHUGEDISK_ZERO $SCRATCH_DEV N 512"
+ DMHUGEDISK_DEV_TABLE="0 $blk_dev_size snapshot $DMHUGEDISK_ZERO $SCRATCH_DEV N $chunk_size"
$DMSETUP_PROG create huge-test-zero --table "$DMHUGEDISK_ZERO_TABLE" || \
_fatal "failed to create dm huge zero device"