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.
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.
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]
24 # Copyright (c) 2016 by Lawrence Livermore National Security, LLC.
25 # Use is subject to license terms.
28 . $STF_SUITE/include/libtest.shlib
32 # Verify that the dnode sizes of newly created files are consistent
33 # with the dnodesize dataset property.
36 # 1. Create a file system
37 # 2. Set dnodesize to a legal literal value
39 # 4. Repeat 2-3 for all legal literal values of dnodesize values
40 # 5. Unmount the file system
41 # 6. Use zdb to check expected dnode sizes
44 TEST_FS=$TESTPOOL/large_dnode
46 verify_runnable "both"
50 datasetexists $TEST_FS && log_must zfs destroy $TEST_FS
54 log_assert "dnode sizes are consistent with dnodesize dataset property"
56 log_must zfs create $TEST_FS
58 set -A dnsizes "512" "1k" "2k" "4k" "8k" "16k"
61 for ((i=0; i < ${#dnsizes[*]}; i++)) ; do
63 if [[ $size == "512" ]] ; then
66 file=/$TEST_FS/file.$size
67 log_must zfs set dnsize=$size $TEST_FS
69 inodes[$i]=$(ls -li $file | awk '{print $1}')
72 log_must zfs umount $TEST_FS
74 for ((i=0; i < ${#dnsizes[*]}; i++)) ; do
75 dnsize=$(zdb -dddd $TEST_FS ${inodes[$i]} |
76 awk '/ZFS plain file/ {print $6}' | tr K k)
77 if [[ "$dnsize" != "${dnsizes[$i]}" ]]; then
78 log_fail "dnode size is $dnsize (expected ${dnsizes[$i]})"
82 log_pass "dnode sizes are consistent with dnodesize dataset property"