summaryrefslogtreecommitdiff
path: root/common/dmhugedisk
diff options
context:
space:
mode:
authorXiao Yang <yangx.jy@cn.fujitsu.com>2018-06-28 09:45:34 +0800
committerEryu Guan <guaneryu@gmail.com>2018-07-01 20:35:27 +0800
commitf86ce7cc4b2bfac490febd1b4f276dae14647355 (patch)
treea1da7800bb55d3cbc99a606d584e1cc55b3d58fb /common/dmhugedisk
parent6b6ff4a005a13310558b1682dfecf197b838be74 (diff)
common: Add _dmsetup_create and _dmsetup_remove helpers
Make sure both "$UDEV_SETTLE_PROG" and "mknodes" can always be run after a dm create or remove operation. Suggested-by: Dave Chinner <david@fromorbit.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'common/dmhugedisk')
-rw-r--r--common/dmhugedisk15
1 files changed, 6 insertions, 9 deletions
diff --git a/common/dmhugedisk b/common/dmhugedisk
index 4d0406d6..502f0243 100644
--- a/common/dmhugedisk
+++ b/common/dmhugedisk
@@ -20,8 +20,8 @@ _dmhugedisk_init()
chunk_size=512
fi
- $DMSETUP_PROG remove huge-test > /dev/null 2>&1
- $DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1
+ _dmsetup_remove huge-test
+ _dmsetup_remove huge-test-zero
local blk_dev_size=$1
@@ -31,18 +31,15 @@ _dmhugedisk_init()
DMHUGEDISK_ZERO_TABLE="0 $blk_dev_size zero"
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" || \
+ _dmsetup_create huge-test-zero --table "$DMHUGEDISK_ZERO_TABLE" || \
_fatal "failed to create dm huge zero device"
- $DMSETUP_PROG create huge-test --table "$DMHUGEDISK_DEV_TABLE" || \
+ _dmsetup_create huge-test --table "$DMHUGEDISK_DEV_TABLE" || \
_fatal "failed to create dm huge device"
}
_dmhugedisk_cleanup()
{
$UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
- # wait for device to be fully settled so that 'dmsetup remove' doesn't
- # fail due to EBUSY
- $UDEV_SETTLE_PROG >/dev/null 2>&1
- $DMSETUP_PROG remove huge-test > /dev/null 2>&1
- $DMSETUP_PROG remove huge-test-zero > /dev/null 2>&1
+ _dmsetup_remove huge-test
+ _dmsetup_remove huge-test-zero
}