]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / features / large_dnode / large_dnode_009_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 #
24 # Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
25 # Use is subject to license terms.
26 #
27
28 . $STF_SUITE/include/libtest.shlib
29
30 #
31 # DESCRIPTION:
32 # Run many xattrtests on a dataset with large dnodes and xattr=sa to
33 # stress concurrent allocation of large dnodes.
34 #
35
36 TEST_FS=$TESTPOOL/large_dnode
37
38 verify_runnable "both"
39
40 function cleanup
41 {
42         datasetexists $TEST_FS && log_must zfs destroy $TEST_FS
43 }
44
45 log_onexit cleanup
46 log_assert "xattrtest runs concurrently on dataset with large dnodes"
47
48 log_must zfs create $TEST_FS
49 log_must zfs set dnsize=auto $TEST_FS
50 log_must zfs set xattr=sa $TEST_FS
51
52 for ((i=0; i < 100; i++)); do
53         dir="/$TEST_FS/dir.$i"
54         log_must mkdir "$dir"
55
56         do_unlink=""
57         if [ $((RANDOM % 2)) -eq 0 ]; then
58                 do_unlink="-k -f 1024"
59         else
60                 do_unlink="-f $((RANDOM % 1024))"
61         fi
62         log_must eval "xattrtest -R -r -y -x 1 $do_unlink -p $dir >/dev/null 2>&1 &"
63 done
64
65 log_must wait
66
67 log_must zpool export $TESTPOOL
68 log_must zpool import $TESTPOOL
69 log_must ls -lR "/$TEST_FS/" >/dev/null 2>&1
70 log_must zdb -d $TESTPOOL
71 log_pass