From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E42D3C433F5 for ; Wed, 27 Apr 2022 10:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231701AbiD0LAW (ORCPT ); Wed, 27 Apr 2022 07:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbiD0K72 (ORCPT ); Wed, 27 Apr 2022 06:59:28 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7036D22C3C1; Wed, 27 Apr 2022 03:37:09 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DE5591F747; Wed, 27 Apr 2022 10:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651055827; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwRuU3lN9KI8hyzt5BRGcUdxQu2aFhndVDrcib1zzbI=; b=feYJC2od1AKLT8mJSoDbAoyzHedIgJQwZvNS3KNVkgnc7RzT6txrdyC7qHmbKtqm0eHZ1C nwtyIUFNi9tG48N+Y74qTSYSX6kwlgGkYQd3TgrHBB36BxazEEJwyWSiqJG/CA/Henk0as Q442kgxgzolK1QTcIhmgJfFSnVSSaYE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651055827; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwRuU3lN9KI8hyzt5BRGcUdxQu2aFhndVDrcib1zzbI=; b=Z5DGjHUwr8LqYy6Y4hmCD5vvVYHZlNaZpZ9cOR3X70LSGdN3HKPIIQ+uUPD5pElrFfGesW b/jCF0GqeLUhBNBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 942411323E; Wed, 27 Apr 2022 10:37:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VQRnI9McaWJTBQAAMHmgww (envelope-from ); Wed, 27 Apr 2022 10:37:07 +0000 Message-ID: Date: Wed, 27 Apr 2022 12:37:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Nitesh Shetty Cc: chaitanyak@nvidia.com, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, axboe@kernel.dk, msnitzer@redhat.com, bvanassche@acm.org, martin.petersen@oracle.com, kbusch@kernel.org, hch@lst.de, Frederick.Knight@netapp.com, osandov@fb.com, lsf-pc@lists.linux-foundation.org, djwong@kernel.org, josef@toxicpanda.com, clm@fb.com, dsterba@suse.com, tytso@mit.edu, jack@suse.com, nitheshshetty@gmail.com, gost.dev@samsung.com, =?UTF-8?Q?Javier_Gonz=c3=a1lez?= , Arnav Dawn , Alasdair Kergon , Mike Snitzer , Sagi Grimberg , James Smart , Chaitanya Kulkarni , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , Alexander Viro , linux-kernel@vger.kernel.org References: <20220426101241.30100-1-nj.shetty@samsung.com> <20220426101241.30100-4-nj.shetty@samsung.com> From: Hannes Reinecke Subject: Re: [PATCH v4 03/10] block: Introduce a new ioctl for copy In-Reply-To: <20220426101241.30100-4-nj.shetty@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/26/22 12:12, Nitesh Shetty wrote: > Add new BLKCOPY ioctl that offloads copying of one or more sources ranges > to one or more destination in a device. COPY ioctl accepts a 'copy_range' > structure that contains no of range, a reserved field , followed by an > array of ranges. Each source range is represented by 'range_entry' that > contains source start offset, destination start offset and length of > source ranges (in bytes) > > MAX_COPY_NR_RANGE, limits the number of entries for the IOCTL and > MAX_COPY_TOTAL_LENGTH limits the total copy length, IOCTL can handle. > > Example code, to issue BLKCOPY: > /* Sample example to copy three entries with [dest,src,len], > * [32768, 0, 4096] [36864, 4096, 4096] [40960,8192,4096] on same device */ > > int main(void) > { > int i, ret, fd; > unsigned long src = 0, dst = 32768, len = 4096; > struct copy_range *cr; > cr = (struct copy_range *)malloc(sizeof(*cr)+ > (sizeof(struct range_entry)*3)); > cr->nr_range = 3; > cr->reserved = 0; > for (i = 0; i< cr->nr_range; i++, src += len, dst += len) { > cr->range_list[i].dst = dst; > cr->range_list[i].src = src; > cr->range_list[i].len = len; > cr->range_list[i].comp_len = 0; > } > fd = open("/dev/nvme0n1", O_RDWR); > if (fd < 0) return 1; > ret = ioctl(fd, BLKCOPY, cr); > if (ret != 0) > printf("copy failed, ret= %d\n", ret); > for (i=0; i< cr->nr_range; i++) > if (cr->range_list[i].len != cr->range_list[i].comp_len) > printf("Partial copy for entry %d: requested %llu, completed %llu\n", > i, cr->range_list[i].len, > cr->range_list[i].comp_len); > close(fd); > free(cr); > return ret; > } > > Signed-off-by: Nitesh Shetty > Signed-off-by: Javier González > Signed-off-by: Arnav Dawn > --- > block/ioctl.c | 32 ++++++++++++++++++++++++++++++++ > include/uapi/linux/fs.h | 9 +++++++++ > 2 files changed, 41 insertions(+) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer