]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh
Implement large_dnode pool feature
[mirror_zfs.git] / tests / zfs-tests / tests / functional / features / large_dnode / large_dnode_005_pos.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 . $STF_SUITE/include/libtest.shlib
24
25 verify_runnable "both"
26
27 TEST_SEND_FS=$TESTPOOL/send_large_dnode
28 TEST_RECV_FS=$TESTPOOL/recv_large_dnode
29 TEST_SNAP=$TEST_SEND_FS@ldnsnap
30 TEST_STREAM=$TESTDIR/ldnsnap
31 TEST_FILE=foo
32
33
34 function cleanup
35 {
36 if datasetexists $TEST_SEND_FS ; then
37 log_must $ZFS destroy -r $TEST_SEND_FS
38 fi
39
40 if datasetexists $TEST_RECV_FS ; then
41 log_must $ZFS destroy -r $TEST_RECV_FS
42 fi
43
44 rm -f $TEST_STREAM
45 }
46
47 log_onexit cleanup
48
49 log_assert "zfs send stream with large dnodes accepted by new pool"
50
51 log_must $ZFS create -o dnodesize=1k $TEST_SEND_FS
52 log_must touch /$TEST_SEND_FS/$TEST_FILE
53 log_must $ZFS umount $TEST_SEND_FS
54 log_must $ZFS snap $TEST_SNAP
55 log_must $ZFS send $TEST_SNAP > $TEST_STREAM
56
57 log_must eval "$ZFS recv $TEST_RECV_FS < $TEST_STREAM"
58 inode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}')
59 dnsize=$($ZDB -dddd $TEST_RECV_FS $inode | awk '/ZFS plain file/ {print $6}')
60 if [[ "$dnsize" != "1K" ]]; then
61 log_fail "dnode size is $dnsize (expected 1K)"
62 fi
63
64 log_pass