1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# The contents of this file are subject to the terms of the 7# Common Development and Distribution License (the "License"). 8# You may not use this file except in compliance with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or https://opensource.org/licenses/CDDL-1.0. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23 24# 25# Copyright (c) 2023, Klara Inc. 26# Copyright (c) 2023, Rob Norris <robn@despairlabs.com> 27# 28 29. $STF_SUITE/include/libtest.shlib 30. $STF_SUITE/tests/functional/block_cloning/block_cloning.kshlib 31 32verify_runnable "global" 33 34claim="copy_file_range will fall back to copy when cloning on same txg" 35 36log_assert $claim 37 38typeset timeout=$(get_tunable TXG_TIMEOUT) 39 40function cleanup 41{ 42 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 43 set_tunable64 TXG_TIMEOUT $timeout 44} 45 46log_onexit cleanup 47 48log_must set_tunable64 TXG_TIMEOUT 5000 49 50log_must zpool create -o feature@block_cloning=enabled $TESTPOOL $DISKS 51 52log_must sync_pool $TESTPOOL true 53 54log_must dd if=/dev/urandom of=/$TESTPOOL/file bs=128K count=4 55log_must clonefile -f /$TESTPOOL/file /$TESTPOOL/clone 0 0 524288 56 57log_must sync_pool $TESTPOOL 58 59log_must have_same_content /$TESTPOOL/file /$TESTPOOL/clone 60 61typeset blocks=$(get_same_blocks $TESTPOOL file $TESTPOOL clone) 62log_must [ "$blocks" = "" ] 63 64log_pass $claim 65 66