[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240601061839.GA6221@lst.de>
Date: Sat, 1 Jun 2024 08:18:39 +0200
From: Christoph Hellwig <hch@....de>
To: Nitesh Shetty <nj.shetty@...sung.com>
Cc: Jens Axboe <axboe@...nel.dk>, Jonathan Corbet <corbet@....net>,
Alasdair Kergon <agk@...hat.com>, Mike Snitzer <snitzer@...nel.org>,
Mikulas Patocka <mpatocka@...hat.com>,
Keith Busch <kbusch@...nel.org>, Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Chaitanya Kulkarni <kch@...dia.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
martin.petersen@...cle.com, bvanassche@....org, david@...morbit.com,
hare@...e.de, damien.lemoal@...nsource.wdc.com,
anuj20.g@...sung.com, joshi.k@...sung.com, nitheshshetty@...il.com,
gost.dev@...sung.com, Vincent Fu <vincent.fu@...sung.com>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, dm-devel@...ts.linux.dev,
linux-nvme@...ts.infradead.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v20 04/12] block: add emulation for copy
On Mon, May 20, 2024 at 03:50:17PM +0530, Nitesh Shetty wrote:
> For the devices which does not support copy, copy emulation is added.
> It is required for in-kernel users like fabrics, where file descriptor is
> not available and hence they can't use copy_file_range.
> Copy-emulation is implemented by reading from source into memory and
> writing to the corresponding destination.
> At present in kernel user of emulation is fabrics.
I still don't see the point of offering this in the block layer,
at least in this form. Caller usually can pre-allocate a buffer
if they need regular copies instead of doing constant allocation
and freeing which puts a lot of stress on the page allocator.
> +static void *blkdev_copy_alloc_buf(ssize_t req_size, ssize_t *alloc_size,
> + gfp_t gfp)
> +{
> + int min_size = PAGE_SIZE;
> + char *buf;
> +
> + while (req_size >= min_size) {
> + buf = kvmalloc(req_size, gfp);
> + if (buf) {
> + *alloc_size = req_size;
> + return buf;
> + }
> + req_size >>= 1;
> + }
> +
> + return NULL;
And requiring a kernel mapping for data is is never used through the
kernel mapping is pretty silly as well.
Powered by blists - more mailing lists