From patchwork Fri Jun 30 15:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13298345 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 BDF92EB64D7 for ; Fri, 30 Jun 2023 15:16:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 393F78E0019; Fri, 30 Jun 2023 11:16:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 344458E000F; Fri, 30 Jun 2023 11:16:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E64E8E0019; Fri, 30 Jun 2023 11:16:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0BB668E000F for ; Fri, 30 Jun 2023 11:16:59 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B7B8BC0E54 for ; Fri, 30 Jun 2023 15:16:58 +0000 (UTC) X-FDA: 80959766916.23.EDD68F3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id F0EE2100002 for ; Fri, 30 Jun 2023 15:16:56 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iJALoKwq; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1688138217; 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=JEgBY1rayWUUjFqYjyVcBzhOlyxqqvg2cGGfw280Ldg=; b=tdf5OfipMGtjY2nPAZyDzWBWEzR+TLt//BABRxs360/QpDWL0Zux+LmZ9X/YW+uJkX4gF1 bIzBh+Li3LF2aC/jmZMEkvOFT3oghshbx2OEVDUk5bCdBmZrtnbRQheom/Lqj+pRbWYBAz +KDGFfecXFLmdqmWwU2WOYOzKt6vNQ8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688138217; a=rsa-sha256; cv=none; b=f/ZQZvm6XiOZNrNrPk1aic561sFKcScVkO5x/URLrjn4yLjetedMNjkgI/6wKeRyQmrIb8 G0z/w+A2/9Isyk8RCyhLW8oTHAQDfnuLnboSKYgQisz+5ca6BqDh+gVvM99UuCZOxyka8B aT3mbpjkr7nRpTVrr0UZvNnuuN812+s= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iJALoKwq; spf=pass (imf05.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688138216; 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=JEgBY1rayWUUjFqYjyVcBzhOlyxqqvg2cGGfw280Ldg=; b=iJALoKwqt908jQ86Tf9HJI1s6SZzjXFF5N0ub+JQf8OskYPRhANlsBuRoaEmcPTwaCMdl8 XT2VDLpiMW/VfbMBcwm8HWE3p3orenOzK0IQwpi6mzsteSOQwKNo7TwX0oCBWR/E7L2Cp1 j5k7en7wf7U0rUwuZE1/9QM/BoUVmdo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-83-1-9z3ay5Oh2dbjXrEd96KQ-1; Fri, 30 Jun 2023 11:16:53 -0400 X-MC-Unique: 1-9z3ay5Oh2dbjXrEd96KQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4508B3814959; Fri, 30 Jun 2023 15:16:52 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.39.192.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED78740C6CCD; Fri, 30 Jun 2023 15:16:37 +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 , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 00/11] iov_iter: Use I/O direction from kiocb, iomap & request rather than iov_iter Date: Fri, 30 Jun 2023 16:16:17 +0100 Message-ID: <20230630151628.660343-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Queue-Id: F0EE2100002 X-Rspam-User: X-Stat-Signature: o5ecrhzk6t6a15kbaiytwy5wjukcniu8 X-Rspamd-Server: rspam03 X-HE-Tag: 1688138216-986416 X-HE-Meta: U2FsdGVkX192JFNqvZtNMJa6C75FU7YxiPr9Okd6xBJNhQHESuYxd1NHyiVJTk2Lukb+mqoXSu1KSMRaDIygzVUdM5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4BSpTvbG8RiCPVExZGRQJ4JcfgFFwda8k+ek7UML0sq5Rfx+ZOwympLv3cSdml5BL 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, Christoph, Here are some patches to switch from using the I/O direction indication in the iov_iter struct to using the I/O direction flags to be found in the kiocb struct, the iomap_iter struct and the request struct. The iterator's I/O direction is then only used in some internal checks. The patches also add direction flags into iov_iter_extract_pages() so that it can perform some checks. New constants are defined rather than using READ and WRITE so that a check can be made that one of them is specified. The problem with the READ constant is that it is zero and is thus the same as no direction being specified - but if we're modifying the buffer contents (ie. reading into it), we need to know to set FOLL_WRITE. Granted this would be the default if unspecified, but it seems better that this case should be explicit. There are also patches to make 9P and SCSI use iov_iter_extract_pages(). I've pushed the patches here also: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-extract David David Howells (11): iov_iter: Fix comment refs to iov_iter_get_pages/pages_alloc() vfs: Set IOCB_WRITE in iocbs that we're going to write from vfs: Use init_kiocb() to initialise new IOCBs iov_iter: Use IOCB_WRITE rather than iterator direction iov_iter: Use IOMAP_WRITE rather than iterator direction iov_iter: Use op_is_write() rather than iterator direction cifs: Drop the check using iov_iter_rw() iov_iter: Drop iov_iter_rw() and fold in last user iov_iter: Use I/O dir flags with iov_iter_extract_pages() 9p: Pin pages rather than ref'ing if appropriate scsi: Use extract_iter_to_sg() block/bio.c | 6 ++ block/blk-map.c | 5 +- block/fops.c | 8 +-- crypto/af_alg.c | 5 +- crypto/algif_hash.c | 3 +- drivers/block/loop.c | 11 ++-- drivers/nvme/target/io-cmd-file.c | 5 +- drivers/target/target_core_file.c | 2 +- drivers/vhost/scsi.c | 79 ++++++++------------------ fs/9p/vfs_addr.c | 2 +- fs/affs/file.c | 4 +- fs/aio.c | 9 ++- fs/btrfs/ioctl.c | 4 +- fs/cachefiles/io.c | 10 ++-- fs/ceph/file.c | 6 +- fs/dax.c | 6 +- fs/direct-io.c | 28 ++++++---- fs/exfat/inode.c | 6 +- fs/ext2/inode.c | 2 +- fs/f2fs/file.c | 10 ++-- fs/fat/inode.c | 4 +- fs/fuse/dax.c | 2 +- fs/fuse/file.c | 8 +-- fs/hfs/inode.c | 2 +- fs/hfsplus/inode.c | 2 +- fs/iomap/direct-io.c | 4 +- fs/jfs/inode.c | 2 +- fs/nfs/direct.c | 2 +- fs/nilfs2/inode.c | 2 +- fs/ntfs3/inode.c | 2 +- fs/ocfs2/aops.c | 2 +- fs/orangefs/inode.c | 2 +- fs/read_write.c | 10 ++-- fs/reiserfs/inode.c | 2 +- fs/seq_file.c | 2 +- fs/smb/client/smbdirect.c | 9 --- fs/splice.c | 2 +- fs/udf/inode.c | 2 +- include/linux/bio.h | 18 +++++- include/linux/fs.h | 16 +++++- include/linux/mm_types.h | 2 +- include/linux/uio.h | 10 ++-- io_uring/rw.c | 10 ++-- lib/iov_iter.c | 14 ++++- lib/scatterlist.c | 12 +++- mm/filemap.c | 2 +- mm/page_io.c | 4 +- net/9p/trans_common.c | 8 +-- net/9p/trans_common.h | 2 +- net/9p/trans_virtio.c | 92 ++++++++++--------------------- 50 files changed, 221 insertions(+), 241 deletions(-)