2 # Routines for creating huge (fake) disks
3 #-----------------------------------------------------------------------
4 # Copyright (c) 2016 Oracle. All Rights Reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 # Contact information: Oracle Corporation, 500 Oracle Parkway,
21 # Redwood Shores, CA 94065, USA, or: http://www.oracle.com/
22 #-----------------------------------------------------------------------
26 _require_dm_target zero
27 _require_dm_target snapshot
32 test -z "$1" && _fatal "must specify sector count to _dmhugedisk_init"
33 local dm_backing_dev=$SCRATCH_DEV
35 $DMSETUP_PROG remove huge-test > /dev/null 2>&1
36 $DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1
40 DMHUGEDISK_ZERO='/dev/mapper/huge-test-zero'
41 DMHUGEDISK_DEV='/dev/mapper/huge-test'
43 DMHUGEDISK_ZERO_TABLE="0 $blk_dev_size zero"
44 DMHUGEDISK_DEV_TABLE="0 $blk_dev_size snapshot $DMHUGEDISK_ZERO $SCRATCH_DEV N 512"
46 $DMSETUP_PROG create huge-test-zero --table "$DMHUGEDISK_ZERO_TABLE" || \
47 _fatal "failed to create dm huge zero device"
48 $DMSETUP_PROG create huge-test --table "$DMHUGEDISK_DEV_TABLE" || \
49 _fatal "failed to create dm huge device"
54 $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
55 # wait for device to be fully settled so that 'dmsetup remove' doesn't
57 $UDEV_SETTLE_PROG >/dev/null 2>&1
58 $DMSETUP_PROG remove huge-test > /dev/null 2>&1
59 $DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1