lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a885def5-7373-28d9-6ed6-bc836864c67c@suse.de>
Date:   Wed, 27 Apr 2022 12:37:07 +0200
From:   Hannes Reinecke <hare@...e.de>
To:     Nitesh Shetty <nj.shetty@...sung.com>
Cc:     chaitanyak@...dia.com, linux-block@...r.kernel.org,
        linux-scsi@...r.kernel.org, dm-devel@...hat.com,
        linux-nvme@...ts.infradead.org, linux-fsdevel@...r.kernel.org,
        axboe@...nel.dk, msnitzer@...hat.com, bvanassche@....org,
        martin.petersen@...cle.com, kbusch@...nel.org, hch@....de,
        Frederick.Knight@...app.com, osandov@...com,
        lsf-pc@...ts.linux-foundation.org, djwong@...nel.org,
        josef@...icpanda.com, clm@...com, dsterba@...e.com, tytso@....edu,
        jack@...e.com, nitheshshetty@...il.com, gost.dev@...sung.com,
        Javier González <javier.gonz@...sung.com>,
        Arnav Dawn <arnav.dawn@...sung.com>,
        Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...nel.org>,
        Sagi Grimberg <sagi@...mberg.me>,
        James Smart <james.smart@...adcom.com>,
        Chaitanya Kulkarni <kch@...dia.com>,
        Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        Naohiro Aota <naohiro.aota@....com>,
        Johannes Thumshirn <jth@...nel.org>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 03/10] block: Introduce a new ioctl for copy

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 <nj.shetty@...sung.com>
> Signed-off-by: Javier González <javier.gonz@...sung.com>
> Signed-off-by: Arnav Dawn <arnav.dawn@...sung.com>
> ---
>   block/ioctl.c           | 32 ++++++++++++++++++++++++++++++++
>   include/uapi/linux/fs.h |  9 +++++++++
>   2 files changed, 41 insertions(+)
> 
Reviewed-by: Hannes Reinecke <hare@...e.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@...e.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ