From patchwork Fri Jun 30 15:25:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13298351 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 6C4C8EB64D7 for ; Fri, 30 Jun 2023 15:25:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABC838E001D; Fri, 30 Jun 2023 11:25:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A6CC48E000F; Fri, 30 Jun 2023 11:25:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 934998E001D; Fri, 30 Jun 2023 11:25:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 806398E000F for ; Fri, 30 Jun 2023 11:25:35 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 32C3D1C9214 for ; Fri, 30 Jun 2023 15:25:35 +0000 (UTC) X-FDA: 80959788630.13.EC30AC9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 6FE1418000F for ; Fri, 30 Jun 2023 15:25:33 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NDe2oPkJ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688138733; a=rsa-sha256; cv=none; b=JQRprxBbJo6ubC/vIxkkG3xAEdislxw5c/iEOtPyuuIgmcQWVMe3BsaFHbaf045AF1Vc4j nPrvMdr9t1lEGt5WWOttEGnBQ3PjoPPgVFg8sc41Y+4rRd9pJzyZek7wM44FViwxSTLJTE tn4STn3UZSDZUfd8VCCQmyGGz5cHfF0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NDe2oPkJ; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf06.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688138733; 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=mthXo3mgP7U+daoZuZFZnhRN3B6pNdnA/TCl+mKtp+A=; b=RmOng1/rKNi1M/xhyRl1ye2UXuOKFn5ALcQpxtIGbV7QLIeAT5KHiPoYcWAqGoCyvhXKDG e4n+Tgx+lTzOIhpQE+F8VfLgw6YNIwIgyDvewk36O3YZGHeVWl8Y7rDd6va9Gz3qPpxnPD cC4dbYNCJYcCVyW/ITNeRPqPJKspHNQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688138732; 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=mthXo3mgP7U+daoZuZFZnhRN3B6pNdnA/TCl+mKtp+A=; b=NDe2oPkJ6HlSGfTcaxsh5MxfgHUH8z7Z6fdMKINWprImdTbvGL5oJGb0wmfoQvdDrgDazz sJmnupmq7gTt/hB7pArM1U4LWRLPYiVExBOaMXHH7X+i40gDvY9ugMd3SHoEaZ+wgJWITt QtlLaj2tijhTanW068X+NqkViFzu4NI= 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-657-U7PU7gZfOQ2IVzmMF0LTDg-1; Fri, 30 Jun 2023 11:25:29 -0400 X-MC-Unique: U7PU7gZfOQ2IVzmMF0LTDg-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 9FE6F8631DB; Fri, 30 Jun 2023 15:25:28 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D6DD492B02; Fri, 30 Jun 2023 15:25:26 +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:25:13 +0100 Message-ID: <20230630152524.661208-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: rspam06 X-Rspamd-Queue-Id: 6FE1418000F X-Stat-Signature: o5ecrhzk6t6a15kbaiytwy5wjukcniu8 X-HE-Tag: 1688138733-52129 X-HE-Meta: U2FsdGVkX1+wNhASFPj9b8mD4f9PsdYmiHhCud7Km61Wlp23V+ZMIT+bbyUUXAHjzPeB1eSPRBUcVL2u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newN4Ml/3OECbKtLXNdOAc5o56z/nvt3fJ7gU6PRD3ih6RNOBY1cQRv7q3KxnRxqmSfF3K9fUsZiudJ5nHIpJFnTvIT 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(-)