From owner-freebsd-current@freebsd.org Fri Jul 5 00:38:10 2019 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EABA515E15D3 for ; Fri, 5 Jul 2019 00:38:09 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670042.outbound.protection.outlook.com [40.107.67.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F91077497; Fri, 5 Jul 2019 00:38:08 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM (10.165.219.7) by YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM (10.165.219.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Fri, 5 Jul 2019 00:38:06 +0000 Received: from YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM ([fe80::9cc8:c3b7:19c2:7baf]) by YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM ([fe80::9cc8:c3b7:19c2:7baf%4]) with mapi id 15.20.2032.019; Fri, 5 Jul 2019 00:38:06 +0000 From: Rick Macklem To: "freebsd-current@FreeBSD.org" CC: Alan Somers , "kib@freebsd.org" Subject: test program for copy_file_range(2) Thread-Topic: test program for copy_file_range(2) Thread-Index: AQHVMskgzujQNZ0SzEiZ5jXklpLAxw== Date: Fri, 5 Jul 2019 00:38:06 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 914165b6-8749-47c2-da56-08d700e10c28 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(49563074)(7193020); SRVR:YTXPR01MB0285; x-ms-traffictypediagnostic: YTXPR01MB0285: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3383; x-forefront-prvs: 008960E8EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(39860400002)(136003)(376002)(396003)(189003)(199004)(6506007)(99936001)(55016002)(99286004)(53936002)(6436002)(54906003)(68736007)(7696005)(4744005)(5640700003)(2906002)(74482002)(33656002)(52536014)(71200400001)(9686003)(486006)(71190400001)(2501003)(478600001)(14454004)(76116006)(66946007)(2351001)(8936002)(25786009)(450100002)(4326008)(5660300002)(81156014)(8676002)(66476007)(786003)(476003)(46003)(64756008)(316002)(66556008)(81166006)(66616009)(66446008)(186003)(73956011)(86362001)(256004)(102836004)(74316002)(305945005)(6916009)(5024004); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0285; H:YTXPR01MB0285.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /ASv31/glGg6npIgmYkXrRfvIFH4qDB6tRe+90dYoyRuHuNDFEE+vzuHTN6h0fsMj4teMv/YsHncZ9TfpE/bPQe8Pkpay9IjBaoltVPaiDMZ0M8eniuKpGnStqvz9eI3KQY34SBEpmpLJ2gsDuB2cDyBgRFlq0EN9kGtYLgWR+76XDtRL1NwrxbqP66QSKfP5PmCt+UTHsTdY/l0X7T0rmEFplbUtCRLeOjAPrKfkkLy0UTtT2Do/+E5hqA9Hm8PEBBm2PYeRIwARz7pj1iPBvjPew1JsLKjNhKUndKjEV/ydxE5NLTMOQXvGcRaOFQIrUyyWLydRMh7wN0xWBP51eNOgttzkpPfiCsM/98Yd0Lo2/1o43vC27YBP7N0YfRH7XA5uTo/8vI8ciaOX9Xof6OLUQsWP4JH/acOnIguvzU= Content-Type: multipart/mixed; boundary="_002_YTXPR01MB02854ED77B07C7434C2F442EDDF50YTXPR01MB0285CANP_" MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: 914165b6-8749-47c2-da56-08d700e10c28 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2019 00:38:06.7409 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rmacklem@uoguelph.ca X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR01MB0285 X-Rspamd-Queue-Id: 7F91077497 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.42 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-3.02 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; MX_GOOD(-0.01)[cached: mx2.hc184-76.ca.iphmx.com]; CTYPE_MIXED_BOGUS(1.00)[]; MIME_BASE64_TEXT(0.10)[]; NEURAL_HAM_SHORT(-0.79)[-0.790,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[uoguelph.ca]; IP_SCORE(-1.03)[ipnet: 40.64.0.0/10(-2.89), asn: 8075(-2.19), country: US(-0.06)]; RCVD_IN_DNSWL_NONE(0.00)[42.67.107.40.list.dnswl.org : 127.0.3.0] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jul 2019 00:38:10 -0000 --_002_YTXPR01MB02854ED77B07C7434C2F442EDDF50YTXPR01MB0285CANP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a little program for testing the copy_file_range(2) syscall I've bee= n working on. (The current version is attached, in case anyone is interested.= ) It take a few minutes to run on a slow system and uses about 6Gbytes of dis= k space for the file system the output file is on. (It creates 2 files to use= for testing. The first one is sparse and the second is copied from it, but grows as diff= erent byte ranges get copied, since "punching holes" is done via writes of 0 bytes.) My question is.. What needs to be done to include this in FreeBSD? I see some stuff under head/tests. I could probably figure out what the macros in those files are, but I can only see tests to see if arguments are valid and similar. As such, I'm not sure if this is the corre= ct place for a test like this? Thanks for any help with this, rick --_002_YTXPR01MB02854ED77B07C7434C2F442EDDF50YTXPR01MB0285CANP_ Content-Type: text/plain; name="testcfr.c" Content-Description: testcfr.c Content-Disposition: attachment; filename="testcfr.c"; size=4281; creation-date="Fri, 05 Jul 2019 00:38:02 GMT"; modification-date="Fri, 05 Jul 2019 00:38:02 GMT" Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRib29sLmg+CiNpbmNsdWRlIDxzdGRsaWIu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