3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2018 by Delphix. All rights reserved.
18 # Verify that livelists tracking remapped blocks can be
22 # 1. Create a pool with disk1 and create a filesystem, snapshot
23 # and clone. Write several files to the clone.
24 # 2. Add disk2 to the pool and then remove disk1, triggering a
25 # remap of the blkptrs tracked in the livelist.
28 . $STF_SUITE/include/libtest.shlib
29 . $STF_SUITE/tests/functional/removal/removal.kshlib
33 poolexists $TESTPOOL2 && zpool destroy $TESTPOOL2
34 [[ -f $VIRTUAL_DISK1 ]] && log_must rm $VIRTUAL_DISK1
35 [[ -f $VIRTUAL_DISK2 ]] && log_must rm $VIRTUAL_DISK2
40 VIRTUAL_DISK1=$TEST_BASE_DIR/disk1
41 VIRTUAL_DISK2=$TEST_BASE_DIR/disk2
42 log_must truncate -s $(($MINVDEVSIZE * 8)) $VIRTUAL_DISK1
43 log_must truncate -s $(($MINVDEVSIZE * 16)) $VIRTUAL_DISK2
45 log_must zpool create $TESTPOOL2 $VIRTUAL_DISK1
46 log_must poolexists $TESTPOOL2
48 log_must zfs create $TESTPOOL2/$TESTFS
49 log_must mkfile 25m /$TESTPOOL2/$TESTFS/atestfile
50 log_must zfs snapshot $TESTPOOL2/$TESTFS@snap
52 log_must zfs clone $TESTPOOL2/$TESTFS@snap $TESTPOOL2/$TESTCLONE
54 log_must mkfile 1m /$TESTPOOL2/$TESTCLONE/$TESTFILE0
55 log_must mkfile 1m /$TESTPOOL2/$TESTCLONE/$TESTFILE1
56 log_must mkfile 1m /$TESTPOOL2/$TESTCLONE/$TESTFILE2
58 log_must zpool add $TESTPOOL2 $VIRTUAL_DISK2
59 log_must zpool remove $TESTPOOL2 $VIRTUAL_DISK1
60 wait_for_removal $TESTPOOL2
62 log_must rm /$TESTPOOL2/$TESTCLONE/$TESTFILE0
63 log_must rm /$TESTPOOL2/$TESTCLONE/$TESTFILE1
65 log_must zfs destroy $TESTPOOL2/$TESTCLONE
67 log_pass "Clone with the livelist feature and remapped blocks," \