Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp881515lqh; Fri, 31 May 2024 23:38:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLuEx1lEwqVKlt7oHRrk6XTMjuuK/L28p5ulbH70Hgo/8KS2Ra7wd/EwXZsOzCl9C1Q1prGkZxd83rXw1/QN6FrQHaruzSwE1yIIOxPg== X-Google-Smtp-Source: AGHT+IEuDdSIYFuW43zYG8dqmBu/MRAPGIEhNVQvWyg4GC+pTEciVrZ15DsA2chdJR8yHk/gv+pA X-Received: by 2002:a05:6a00:2d14:b0:702:5b3c:a3e9 with SMTP id d2e1a72fcca58-7025b3ca758mr243956b3a.23.1717223933026; Fri, 31 May 2024 23:38:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717223933; cv=pass; d=google.com; s=arc-20160816; b=r9Fvk99S07T33AZTPGXgm4lI7XlOEGCyY6UprRB0eb0F82fUcgmJg50h0horq8mwvL z+asxNtHEKaIeK4DsoefwKlXujajfGc8IkY8MC4+K/xcFHPO0fB6Mr06qcNe3jJ3QDVa R4JGrvslsMhDyX8kwbTmJ1wZGNvIa15GD6LVl6nzzrJye8Tz/SfRl+3KbBd45oULyXfV yTXvRdgrh7JpkQW3ZsIOu02OLTQgm1wnsCQ+tbHJSIZWg+hU7F8mgk7XtYRXkHtmkYwJ LT/RDNUsmvJk+Hp+V6JNRyOgj3MgXVJ4mo1+veLXVTup5u41LTJR+YgzSglhmI2IUav9 OLKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=EQuicQSLamDh1HGStdR683oi7ookXZdfWjJggp3b3/0=; fh=lRxxUaiPcju3iXuSgC0tYpq/WwF6rOokg0AcX+Y3WJM=; b=xCKyAXBd1WwuuZLyllnbVHFsC3JAWYOKEJLOcYJRvN+Ma3PURkkiTTXxXiEmzMeueb sWxyGyV3lYQ3tacnZtpBvm4EJr9y8mN3kIjgBAcJKCk5q8ILvT9Ora9jA1Li3sgtTws9 SdDKW9ja++JOTXPjF4s7jtId89Yw+Ke3QJ19sIlqaCcFAoO6A21ZIi2dp+J/7Q0wBu8K M809PZ1aECnC/Fkrodn2XctUF5CPFJGkk69VL/IYKzgrAIa6zMxG490HalyPvJJUnIEa yvB531AbxtxuvHHvf24q38Ikwj0pjx0ygvrRZ00noLeL12Ac3GVIa6ikJ6kOpBrVF6TL 42Hw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-197721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197721-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35cb0f219si2752537a12.771.2024.05.31.23.38.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 23:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-kernel+bounces-197721-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197721-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6EB95B26CDE for ; Sat, 1 Jun 2024 06:19:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42A4D1B812; Sat, 1 Jun 2024 06:18:47 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB9BE14A8F; Sat, 1 Jun 2024 06:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717222726; cv=none; b=Y+FsIgD41+krr5XzI5a4kQw/0uD9BSlQFa7KmTzPTEtDmt1AUDkSBJJdXesg/VmCWCvwrFrJg+0FClJ2PCAanXM1Oo0M5/vQMK33dp02yWQDHBRZ/u/abPbBwb5C2e8SYG9Yp/RTgjEzoGa/Dg2lBBnwTM46gDIiK3EuGNP3nxk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717222726; c=relaxed/simple; bh=rrBjQRF40NCxkbGV+C8UNlmDmwTUguMTPm33YC2RW1w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AunoQjkmJFDRo/1IdxFOeDaIbD0rNYdTo+vXiiFs/H4CQUtjOzThWLgI0llfmIIUFN5IUCSerhBoNDtcxGzLm8cCMeIMxdjS3e/EG2vXWXsZMz2OuMDoa+KzemAsF4Aaff8P1JZj+zJpovxBjXExc9mkRMz8NhlRJU1c2mqekWs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id C5AF668D17; Sat, 1 Jun 2024 08:18:39 +0200 (CEST) Date: Sat, 1 Jun 2024 08:18:39 +0200 From: Christoph Hellwig To: Nitesh Shetty Cc: Jens Axboe , Jonathan Corbet , Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Keith Busch , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Alexander Viro , Christian Brauner , Jan Kara , martin.petersen@oracle.com, bvanassche@acm.org, david@fromorbit.com, hare@suse.de, damien.lemoal@opensource.wdc.com, anuj20.g@samsung.com, joshi.k@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com, Vincent Fu , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, dm-devel@lists.linux.dev, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v20 04/12] block: add emulation for copy Message-ID: <20240601061839.GA6221@lst.de> References: <20240520102033.9361-1-nj.shetty@samsung.com> <20240520102033.9361-5-nj.shetty@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240520102033.9361-5-nj.shetty@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) 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.