]>
Commit | Line | Data |
---|---|---|
92f095a9 RN |
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 https://opensource.org/licenses/CDDL-1.0. | |
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) 2023, Klara Inc. | |
25 | # Copyright (c) 2023, Rob Norris <robn@despairlabs.com> | |
26 | # | |
27 | ||
28 | . $STF_SUITE/include/libtest.shlib | |
29 | . $STF_SUITE/tests/functional/block_cloning/block_cloning.kshlib | |
30 | ||
31 | verify_runnable "global" | |
32 | ||
33 | if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then | |
34 | log_unsupported "copy_file_range not available before Linux 4.5" | |
35 | fi | |
36 | ||
37 | claim="copy_file_range will fall back to copy when cloning on same txg" | |
38 | ||
39 | log_assert $claim | |
40 | ||
41 | typeset timeout=$(get_tunable TXG_TIMEOUT) | |
42 | ||
43 | function cleanup | |
44 | { | |
45 | datasetexists $TESTPOOL && destroy_pool $TESTPOOL | |
46 | set_tunable64 TXG_TIMEOUT $timeout | |
47 | } | |
48 | ||
49 | log_onexit cleanup | |
50 | ||
92f095a9 RN |
51 | log_must set_tunable64 TXG_TIMEOUT 5000 |
52 | ||
8526b12f PD |
53 | log_must zpool create -o feature@block_cloning=enabled $TESTPOOL $DISKS |
54 | ||
bf54da84 RN |
55 | log_must sync_pool $TESTPOOL true |
56 | ||
92f095a9 RN |
57 | log_must dd if=/dev/urandom of=/$TESTPOOL/file bs=128K count=4 |
58 | log_must clonefile -f /$TESTPOOL/file /$TESTPOOL/clone 0 0 524288 | |
59 | ||
60 | log_must sync_pool $TESTPOOL | |
61 | ||
62 | log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone | |
63 | ||
084ff4ab | 64 | typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone) |
92f095a9 RN |
65 | log_must [ "$blocks" = "" ] |
66 | ||
67 | log_pass $claim | |
68 |