From patchwork Tue Feb 14 08:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13139671 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50137C61DA4 for ; Tue, 14 Feb 2023 08:37:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5454280001; Tue, 14 Feb 2023 03:37:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C04606B0074; Tue, 14 Feb 2023 03:37:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF3C9280001; Tue, 14 Feb 2023 03:37:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9F10C6B0073 for ; Tue, 14 Feb 2023 03:37:21 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3951D80D3F for ; Tue, 14 Feb 2023 08:37:21 +0000 (UTC) X-FDA: 80465243082.20.D217C7E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 804A4140003 for ; Tue, 14 Feb 2023 08:37:19 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iH+nUlBC; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676363839; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=Vq3Sj7rlsNdLjcqHDgs0XkW5jVa94T8TrtK6zXmHKG4=; b=JsZ4zRZ+4sAh4pV7nGwuXAatYBTS9D+w8NIuQrZtHvw48c5OzTkgLdYL60P/fmgYJOschc oSqAjV0vZqJ58KcdjEMkDMV16D93bUTdBIYr5nTrnsrbKldi6rkwA952oon6Q8+ELgFrah 44Slrmx79Jv8e9KiluV13FRv9lwARP4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iH+nUlBC; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676363839; a=rsa-sha256; cv=none; b=uvKz2TdEnu9VNQCaJ5TJhttPavqga/WNMndbMc+ToNHR3n1kT+pi0IbKKebrNMc3VbdkQ1 ru8lGrBz17suAa+uFvOAzcdWr6Pe2QNr3nSQpOTtm8Nseh2fJcw6w0hGYX5gv7d9dL2Cjt GWLUos5xmI8vYeqDEjTdd6wZ/DCPiCM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676363838; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Vq3Sj7rlsNdLjcqHDgs0XkW5jVa94T8TrtK6zXmHKG4=; b=iH+nUlBCZ76lKU4+M3HxJ8XomuUkNywbP86qwv/9jfjS+iqk77wQi924pmsWNX9Smyoeq2 vZhRHdMbPlxHm9SooBdbJOaKq9nw5wLyxx77o2eNTq2IQkub7eZVJ2XIs+PHcMaQhmAmhI oWPvoUHx+URqL4olDosTgOlK8wFEVDQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-bCtj-sb0O7-xSZu8Wwp9jg-1; Tue, 14 Feb 2023 03:37:15 -0500 X-MC-Unique: bCtj-sb0O7-xSZu8Wwp9jg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 52454857A93; Tue, 14 Feb 2023 08:37:14 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4236A492B03; Tue, 14 Feb 2023 08:37:12 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 0/5] iov_iter: Adjust styling/location of new splice functions Date: Tue, 14 Feb 2023 08:37:05 +0000 Message-Id: <20230214083710.2547248-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: jks6asja6f4mou4uajh9rpjhx5snpyeu X-Rspamd-Queue-Id: 804A4140003 X-HE-Tag: 1676363839-331305 X-HE-Meta: U2FsdGVkX18BKsfIfn+LV0CeOu1UWGFY7r0I5YUT+NZSXiVA2O4T9mmw5xWYJ1BAdbv3MhXEwtPYpDDlWSZ8B/zihW/LaZWBJxSSJLaClcmhyxw7tLyWlYKb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CrHGrn3QRZPRfq1y18OigVOiaC4msYOp7oO3hbPVigH39npggPCCe7J6V0Efyw/gKiziPYkOWWAMAkTgnoaeE5sMW76Wh02B8byIhZDqgd87HXgosaCSbVQzSeWokzeMLEwMnCPq523/bMfO3sUNzSzX5KbB5A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Jens, Al, Christoph, Here are patches to make some changes that Christoph requested[1] to the new generic file splice functions that I implemented[2]. Apart from one functional change, they just altering the styling and move one of the functions to a different file: (1) Rename the main functions: generic_file_buffered_splice_read() -> filemap_splice_read() generic_file_direct_splice_read() -> direct_splice_read() (2) Abstract out the calculation of the location of the head pipe buffer into a helper function in linux/pipe_fs_i.h. (3) Use init_sync_kiocb() in filemap_splice_read(). This is where the functional change is. Some kiocb fields are then filled in where they were set to 0 before, including setting ki_flags from f_iocb_flags. (4) Move filemap_splice_read() to mm/filemap.c. filemap_get_pages() can then be made static again. (5) Fix splice-read for a number of filesystems that don't provide a ->read_folio() op and for which filemap_get_pages() cannot be used. I've pushed the patches here also: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-extract-3 I've also updated worked the changes into the commits on my iov-extract branch if that would be preferable, though that means Jens would need to update his for-6.3/iov-extract again. David Link: https://lore.kernel.org/r/Y+n0n2UE8BQa/OwW@infradead.org/ [1] Link: https://lore.kernel.org/r/20230207171305.3716974-1-dhowells@redhat.com/ [2] Changes ======= ver #3) - Fix filesystems/drivers that don't have ->read_folio(). ver #2) - Don't attempt to filter IOCB_* flags in filemap_splice_read(). Link: https://lore.kernel.org/r/20230213134619.2198965-1-dhowells@redhat.com/ # v1 David Howells (5): splice: Rename new splice functions splice: Provide pipe_head_buf() helper splice: Use init_sync_kiocb() in filemap_splice_read() splice: Move filemap_read_splice() to mm/filemap.c shmem, overlayfs, coda, tty, proc, kernfs, random: Fix splice-read drivers/char/random.c | 4 +- drivers/tty/tty_io.c | 4 +- fs/coda/file.c | 36 +++++++++- fs/kernfs/file.c | 2 +- fs/overlayfs/file.c | 36 +++++++++- fs/proc/inode.c | 4 +- fs/proc/proc_sysctl.c | 2 +- fs/proc_namespace.c | 6 +- fs/splice.c | 146 ++------------------------------------ include/linux/fs.h | 6 ++ include/linux/pagemap.h | 2 - include/linux/pipe_fs_i.h | 20 ++++++ mm/filemap.c | 136 +++++++++++++++++++++++++++++++++-- mm/internal.h | 6 ++ mm/shmem.c | 124 +++++++++++++++++++++++++++++++- 15 files changed, 373 insertions(+), 161 deletions(-)