Skip to content

Commit

Permalink
dmhugedisk: Allow specifying of chunk size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jankara authored and guaneryu committed Jun 3, 2018
1 parent 141bd37 commit 828f12b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion common/dmhugedisk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit 828f12b

Please sign in to comment.