From patchwork Fri Mar 17 19:52:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9631561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB20960245 for ; Fri, 17 Mar 2017 20:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AB6028527 for ; Fri, 17 Mar 2017 20:21:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D0A1285D4; Fri, 17 Mar 2017 20:21:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1C7D28527 for ; Fri, 17 Mar 2017 20:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751174AbdCQUVf (ORCPT ); Fri, 17 Mar 2017 16:21:35 -0400 Received: from mx144.netapp.com ([216.240.21.25]:36377 "EHLO mx144.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdCQUVd (ORCPT ); Fri, 17 Mar 2017 16:21:33 -0400 X-IronPort-AV: E=Sophos;i="5.36,178,1486454400"; d="scan'208";a="182789177" Received: from hioexcmbx05-prd.hq.netapp.com ([10.122.105.38]) by mx144-out.netapp.com with ESMTP; 17 Mar 2017 12:41:18 -0700 Received: from VMWEXCCAS11-PRD.hq.netapp.com (10.122.105.29) by hioexcmbx05-prd.hq.netapp.com (10.122.105.38) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 17 Mar 2017 12:52:42 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS11-PRD.hq.netapp.com (10.122.105.29) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Fri, 17 Mar 2017 12:52:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IB8aqm09fL6Jt7yDwf/wDydOIF74VQZb/qbwo3sEbFU=; b=R5SvOMbEmeMd7vyiq9aqtR/DihDfiQ1CZWeZve5/oNZ+ZX2+C9MyE/ea4Cyx4boz2b7IlGJA713N/jKGjdPL78hski+93J9zO0jhTmfrHa93UOiXVfO6yQuWVrbELf1k6FS+6YfPru9J/Zdg/vAFmiO9RWFizhEfXPwsKWivmvY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=Netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (68.40.188.1) by MWHPR06MB2479.namprd06.prod.outlook.com (10.168.248.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 17 Mar 2017 19:52:41 +0000 From: Anna Schumaker To: CC: , , Subject: [PATCH v5 1/5] generic/416: Add copy to new file test Date: Fri, 17 Mar 2017 15:52:29 -0400 Message-ID: <20170317195233.4042-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170317195233.4042-1-Anna.Schumaker@Netapp.com> References: <20170317195233.4042-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [68.40.188.1] X-ClientProxiedBy: MWHPR08CA0031.namprd08.prod.outlook.com (10.174.103.172) To MWHPR06MB2479.namprd06.prod.outlook.com (10.168.248.15) X-MS-Office365-Filtering-Correlation-Id: b916c1e1-0c2d-41ef-3b78-08d46d6f2c94 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 3:sPB/qmhorfedqD4BF0hcFosoBj4qvllWvlwrIUiOK+zX0UWN8YxrqhR3Tb8ZeHFJosRW4qEq4yfBRB5idT/PmuX2LWdfIDLQP/1sV1wFpj5dLKrA0jm6cwuNmQb/B28u2KJeR8OCD7DOI/HPld1IsQnySWCeFz4f7LSBiFXsvJPOI5pfyWQ8ptIJ/ZPJakIy9Y23QpqIU3oLfXT6cvuECQHL3WVvNtBuGkAxSZXQdHpBcu1gz0wr+Ta922WvoakUdQRO7wR49dWULimK+u2ocA==; 25:PaD4h6nL8ujaDv4h0WeE7Psbpj3nPUI4Rgo50qPdqIHDmnFVkipgluGYrP6piYqcYhZlcdVGwkbDYL/HzJdREFRRSKlxnC6Ohk5fobxE01iXsrRfAQPZ66RQ5v4N4sGNSLysPJ4xzyBqNkkZCBONDE+BDFl6MO7n4+36CKgf39S1KcJt6xx8pDVJiB+Lr0+qX7QRghvzZ+RurbylKbS9+28weOd6B3ktl5c0GlX4gVI1CPX6hTcc5iySYYcZnbNN8ZKaS4+SN0t2hV6r2pu2cknwEOKStGliXtXnF1Y14cjVjkAu7pCgwKj2THlqaFq2EjEYD/8OFQVw0TYHP548rsWM1KTnaM90awR0AnxiTzZt5T6+G2c9QOzZbOLX4XYTRentpmrZefdHCVXw0S/LHCWtHMwWdQLTxXp7xs8ftQCuOQQi3+Qcftfxkl1+rMM7rXml0op5GoFdR5sXDK1Qfw== X-LD-Processed: 4b0911a0-929b-4715-944b-c03745165b3a,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 31:DexAReKgMv4Eo+W7FxOLFKGacdYc9dJjmQQzVJHrAiCnkLEwTl1E953MQuC44Jd/be1LfPaxl875xuj4wKZJ7GoLL0GntD3fDD4nJXVFRmfnL7lViDc6IvuGGeXbij/S7pjmeSvDiDi9Pdxt8BarZIUPMmMsHDCXnQssJKBhNRwWCumi17YYDsPF/7cC1s7dgaf+TS6alV4ZUFU037YYPwvfQ9+neaxnD8hmR0PBuUCG5EnVwnA3xZnqCelJ4DT3; 20:SOAingLt2GQBXkOxfzRLEuVRhlc9/fnXNdVBLxNnyp85/SNcxn3jj65iYi7E85cJT80zYe2BqCBp6OEGcA5hXkDR89OayYd2WY1leZLB+uomwod8HcajG5Z+aM13SBTBE0iUwheBqctOEXzI9KDyA3hauKXpODTvVorDlIgYKJ37Doarg8BpsJRlo6QhN+y1qPkboqAjXsIBPRZ0OI3mgnNA5UjxEm7Ux14YVcyGJCT4C/GgJu1ZTO4Pm7U75f5Jq6CLdFx9dFyw6tcuu1x+GIWT9MKzAKA6ZXG9gCJ4UqDPlteaDQJontL5czWX2wFEwpSOlt/eZPytS2CsExu+x1Sj6EEBNuzQjv8tdH3G13UtZTB9UOmUrL+bXEygZqeGVATVBvMWQ1cDm4YcThSeOfKxftdv7bjbF2n3l9fcXOXrgSE9Y23jW5vqDyxQ7iur3tL08VIxlyChNSskswxM6YPf7mrEO13Y93Y6ImD1gayA9Rt/SKam8kvNf/+BwRqG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123558025)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:MWHPR06MB2479; BCL:0; PCL:0; RULEID:; SRVR:MWHPR06MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 4:eJ5pfgXdlksChGESrxb2RSNqlMHysCgIJpVDQPpfbOocAHTDgFwnCTs0oU1S7J15TlEOzKxb5aUuOvsP2u/a5BecuZIDuT3n07jrL81DJiyq7WfjI/apn6Fps9yfazTPqhC+1X5w2vlcffm55XGkDI3e3Hj8GljXmAHZ9G4Vy/692TauGKYC+c36u6SZWJKRyWjw7jI18y5ZzehC9teYkWIIO2+pEHbfI8FQK9uag6nHCUbraE+R2IhSUJsdmBjSlhp2p16YAR0qteL2qiPlOhvjrdyD33kVmc5oHC4mgPwxwP75W3es66kWG3z2KzSItaVpmKFknzCw5q34tm7OMOxTl8gkzoMCPxfUO8lWb59ajxyheobAwtk4kikOVd/VwGM4RTFWD6Vw+kBKja5B4ao35RlRW/8MzobPNkvQ7ac3zvIv+vAZHSPd+M3f6i5fG0VCdPZaHAx/OcSi0Lj4EdOb62YiG8q3XBFdst/ZZlcKdmhZ+ycu9/HznLFW6Xp8aTI0LeIh0Raqk+PKj9b63bGPWVIa6UR8x2MW3u/m7ATU/9n4hjbK8cxXyqHVX4olf95dN3n7P038C/zLX4TBlTrj8Q0Cj7/pbpdpn7PKAVXnYGShGlSIXl894BOjZHn4 X-Forefront-PRVS: 0249EFCB0B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(4326008)(50986999)(81166006)(86362001)(2906002)(575784001)(76176999)(1076002)(6116002)(48376002)(189998001)(2351001)(8676002)(50466002)(38730400002)(110136004)(305945005)(6666003)(6486002)(42186005)(36756003)(6512007)(47776003)(6916009)(2950100002)(54906002)(6506006)(66066001)(25786008)(5660300001)(7736002)(50226002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR06MB2479; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 23:1P+4AuM0ViEzyI+crAtFd4gzBCaytIlZYkSy5N+/k5Hjgi9Gzoe9YgYTR0QWMA67BzpxdahLyw5xL9g+oXBYpe1KDKZshenACshF+JCSwKdgqLh6vpTTxdj5ZybOjwSQbw0gwkPC/i1XgJK0oxX6hR9imBaKEmGmhFWcb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T0E5YXQMK3nO8Qx7PK60E2HJ8dglVBgwj+wRERY9JtXEEXCirOXj6YFkk05PseZHc3yR7DYx2bOlyIzE0NaHrdFMy3ekjpareOg==; 5:errOG50gQMYvPQZeGSATeOitB8zw22Z35snVi5qhuGf+f03s+FZPcoCxcRLZJj2pxmEhSnALg8po1gxIluY9/tnrXeMzcdL7q60p5V6x7dOiw416UJowi3Zg7N0fYKSstCiqjiaEbNIWypJHtDyTsQ==; 24:EkDVpLnI3ENnLRzuwnGKAL/6A5Simh+s/UG6M0CksiOzTyI3tjEvtqOdI29gQvvYTN8Nmwc/Z/kVIbeBqzKV+QjI94LC8gDiPauGaj+sKW8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR06MB2479; 7:m3u38vCxMSkkoF7EgAiuyV61bZphuH3/e1/EwBretyIFHbLlDsiedTie809+I5TTkOZ0BRN0o9wp3GBHzjEaqCiXL+CowKfbdY8BM0ojpz6uZyxISHxPxmugHABd6KrgMtgZp8ijBy7yRae9dIuZ5APIGH1s89y7tVXhJd+P8JxCclKQrkfGmhxgg7nhIF1lF1Jll06dLzwAHshSF6dKByziSXoZntJkilwNirEX5brls1YOgCMD1PHF05sh1XZQchwgqqJORZi++u+vIPKALTuEF4WU1Mp2aLPzuXHf7ZHLVoKKITiAEaXXmTVza6JEHbXtID8Cmm9Mbq2igl9e/w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 19:52:41.8548 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR06MB2479 X-OriginatorOrg: netapp.com Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test copies data from various points in a source file to a new file. This is useful for testing the basics of copy_file_range(). Signed-off-by: Anna Schumaker --- common/rc | 6 +++ tests/generic/416 | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/416.out | 26 +++++++++++++ tests/generic/group | 1 + 4 files changed, 135 insertions(+) create mode 100755 tests/generic/416 create mode 100644 tests/generic/416.out diff --git a/common/rc b/common/rc index 109325df..98552a99 100644 --- a/common/rc +++ b/common/rc @@ -1976,6 +1976,12 @@ _require_xfs_io_command() "chproj") testio=`$XFS_IO_PROG -F -f -c "chproj 0" $testfile 2>&1` ;; + "copy_range") + testcopy=$TEST_DIR/$$.copy.xfs_io + $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile 2>&1 > /dev/null + testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` + rm -f $testcopy 2>&1 > /dev/null + ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc 0 1m" $testfile 2>&1` ;; diff --git a/tests/generic/416 b/tests/generic/416 new file mode 100755 index 00000000..a669a6e7 --- /dev/null +++ b/tests/generic/416 @@ -0,0 +1,102 @@ +#!/bin/bash +# FS QA Test No. 416 +# +# Tests vfs_copy_file_range(): +# - Copy a file +# - Copy beginning of original to new file +# - Copy middle of original to a new file +# - Copy end of original to new file +# - Copy middle of original to a new file, creating a hole +#----------------------------------------------------------------------- +# Copyright (c) 2016 Netapp, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* +} + +# get standard environment +. common/rc +. common/filter + +# real QA test starts here +_supported_fs generic +_supported_os Linux + +_require_xfs_io_command "copy_range" +_require_test + +testdir=$TEST_DIR/test-$seq +rm -rf $testdir +mkdir $testdir +rm -f $seqres.full + +echo "Create the original file and then copy" +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x62 1000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x63 2000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x64 3000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c 'pwrite -S 0x65 4000 1000' $testdir/file >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c "copy_range $testdir/file" "$testdir/copy" +cmp $testdir/file $testdir/copy +echo "Original md5sums:" +md5sum $testdir/{file,copy} | _filter_test_dir + +echo "Copy beginning of original file" +$XFS_IO_PROG -f -c "copy_range -l 1000 $testdir/file" "$testdir/beginning" 2>&1 +cmp -n 1000 $testdir/file $testdir/beginning +echo "md5sums after copying beginning:" +md5sum $testdir/{file,beginning} | _filter_test_dir + +echo "Copy middle of original file" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 $testdir/file" "$testdir/middle" 2>&1 +cmp -n 3000 $testdir/file $testdir/middle 1000 +echo "md5sums after copying middle:" +md5sum $testdir/{file,middle} | _filter_test_dir + +echo "Copy end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 1000 $testdir/file" "$testdir/end" 2>&1 +cmp -n 1000 $testdir/file $testdir/end 4000 +echo "md5sums after copying end:" +md5sum $testdir/{file,end} | _filter_test_dir + +echo "Copy beyond end of original file" +$XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond" 2>&1 +cmp -n 1000 $testdir/file $testdir/end 4000 +echo "md5sums after copying beyond:" +md5sum $testdir/{file,beyond} | _filter_test_dir + +echo "Copy creates hole in target file" +$XFS_IO_PROG -f -c "copy_range -s 1000 -l 3000 -d 1000 $testdir/file" "$testdir/hole" 2>&1 +cmp -n 3000 $testdir/file $testdir/hole 1000 1000 +echo "md5sums after creating hole:" +md5sum $testdir/{file,hole} | _filter_test_dir + +#success, all done +status=0 +exit diff --git a/tests/generic/416.out b/tests/generic/416.out new file mode 100644 index 00000000..107a156b --- /dev/null +++ b/tests/generic/416.out @@ -0,0 +1,26 @@ +QA output created by 416 +Create the original file and then copy +Original md5sums: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/copy +Copy beginning of original file +md5sums after copying beginning: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +cabe45dcc9ae5b66ba86600cca6b8ba8 TEST_DIR/test-416/beginning +Copy middle of original file +md5sums after copying middle: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +4197de9da5badfc302715486b82bcdf1 TEST_DIR/test-416/middle +Copy end of original file +md5sums after copying end: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-416/end +Copy beyond end of original file +copy_range: Invalid argument +md5sums after copying beyond: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +e68d4a150c4e42f4f9ea3ffe4c9cf4ed TEST_DIR/test-416/beyond +Copy creates hole in target file +md5sums after creating hole: +e11fbace556cba26bf0076e74cab90a3 TEST_DIR/test-416/file +3ae9aef0992f8cb51c90c9a0ff2dd9d2 TEST_DIR/test-416/hole diff --git a/tests/generic/group b/tests/generic/group index b510d410..9541fff5 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -418,3 +418,4 @@ 413 auto quick 414 auto quick clone 415 auto clone +416 auto quick copy