]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/arc/dbufstats_002_pos.ksh
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) 2017, Lawrence Livermore National Security, LLC.
27 .
$STF_SUITE/include
/libtest.shlib
28 .
$STF_SUITE/include
/math.shlib
32 # Ensure that dbufs move from mru to mfu as expected.
35 # 1. Set dbuf cache size to a small size (10M for this test)
36 # 2. Generate a file with random data (small enough to fit in cache)
37 # 3. zpool sync to remove dbufs from anon list in ARC
38 # 4. Obtain the object ID using linux stat command
39 # 5. Ensure that all dbufs are on the mru list in the ARC
40 # 6. Generate another random file large enough to flush dbuf cache
41 # 7. cat the first generated file
42 # 8. Ensure that at least some dbufs moved to the mfu list in the ARC
45 DBUFS_FILE
=$
(mktemp
$TEST_BASE_DIR/dbufs.out.XXXXXX
)
49 log_must
rm -f $TESTDIR/file $TESTDIR/file2
$DBUFS_FILE
52 verify_runnable
"both"
54 log_assert
"dbufs move from mru to mfu list"
58 log_must file_write
-o create
-f "$TESTDIR/file" -b 1048576 -c 1 -d R
61 objid
=$
(get_objnum
"$TESTDIR/file")
62 log_note
"Object ID for $TESTDIR/file is $objid"
64 log_must
eval "kstat dbufs > $DBUFS_FILE"
65 dbuf
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid" |
wc -l)
66 mru
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid,list=1" |
wc -l)
67 mfu
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid,list=3" |
wc -l)
68 log_note
"dbuf count is $dbuf, mru count is $mru, mfu count is $mfu"
69 verify_ne
"0" "$mru" "mru count"
70 verify_eq
"0" "$mfu" "mfu count"
72 log_must
eval "cat $TESTDIR/file > /dev/null"
73 log_must
eval "kstat dbufs > $DBUFS_FILE"
74 dbuf
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid" |
wc -l)
75 mru
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid,list=1" |
wc -l)
76 mfu
=$
(dbufstat
-bxn -i "$DBUFS_FILE" -F "object=$objid,list=3" |
wc -l)
77 log_note
"dbuf count is $dbuf, mru count is $mru, mfu count is $mfu"
78 verify_ne
"0" "$mfu" "mfu count"
80 log_pass
"dbufs move from mru to mfu list passed"