From patchwork Wed Sep 13 16:56:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13383567 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 D4AA1EE01E0 for ; Wed, 13 Sep 2023 16:57:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EC976B01F4; Wed, 13 Sep 2023 12:57:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9998C6B01F5; Wed, 13 Sep 2023 12:57:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7EBF16B01F6; Wed, 13 Sep 2023 12:57:07 -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 6D9C16B01F4 for ; Wed, 13 Sep 2023 12:57:07 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 49460B41F6 for ; Wed, 13 Sep 2023 16:57:07 +0000 (UTC) X-FDA: 81232179294.19.E79EB7B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 8603B1A0005 for ; Wed, 13 Sep 2023 16:57:05 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZGolSBv; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694624225; a=rsa-sha256; cv=none; b=RsMgm0w76JnTtJO42sKC2B2s69e8sIBp6oBLBxZA73WvKYWkyXCQuYg3Vlf4oLnq6MUt7z uV55iuTU5YMPKBk/98buxl5f1hy+PXXbDNq+nTWdMdn735/kYEzZLqDAQV9PlBJdbqZiJ4 o+pi2xPNmu6DTgBz1jTvl5t8sFZv+/8= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZGolSBv; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1694624225; 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:in-reply-to:references:references:dkim-signature; bh=z7dUGMUCdPzyoXpN55evy5eiv8axvEjBjfUl9Q9dpbg=; b=bBQD4eSkxi3TRblCSyVl2cQJJ+ItcbDoTzC+Ryrc8CDcovwwnuOvCdgKs/OPMvn1jzbEIQ K+ee7AFV7KUnXzVLhQcwo0MC+rskmvfboCFlvTq26p2gGbSIKEcpv3zIZLjU84uMVfRro3 9tW/zsDAOu4+AyrXkHbcOGWgo8sVLYE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694624224; 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: in-reply-to:in-reply-to:references:references; bh=z7dUGMUCdPzyoXpN55evy5eiv8axvEjBjfUl9Q9dpbg=; b=OZGolSBvzk3B/YVM/aDJSgTCXUA8wJzeN5NCyALftfAaK1dkgjfO2Jae3hfwOkL1k79HsT XcOZ0GiNFP7HcM2ZHRtGDJASFlymEfAeFgVwOwiivOctz6m7umJVEhU7ETRKhv7UMW+D9Z nSVBsx6O5x5Sv0bNpI92g10vV+k4pnY= 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-354-B53T9xcDN2imp2fxxNS_HQ-1; Wed, 13 Sep 2023 12:57:01 -0400 X-MC-Unique: B53T9xcDN2imp2fxxNS_HQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A0E9C185A79C; Wed, 13 Sep 2023 16:57:00 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07E2263F9C; Wed, 13 Sep 2023 16:56:58 +0000 (UTC) From: David Howells To: Al Viro , Linus Torvalds Cc: David Howells , Jens Axboe , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/13] iov_iter: Derive user-backedness from the iterator type Date: Wed, 13 Sep 2023 17:56:38 +0100 Message-ID: <20230913165648.2570623-4-dhowells@redhat.com> In-Reply-To: <20230913165648.2570623-1-dhowells@redhat.com> References: <20230913165648.2570623-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8603B1A0005 X-Stat-Signature: yc3nnijsuub31pmbr413bss7fmzh1315 X-HE-Tag: 1694624225-566872 X-HE-Meta: U2FsdGVkX19F58oMklN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5Vqx20Sbs5EgcNYxKzbAqhNubQofr5ZyuDgYXyCLD9Sdae1cwwVSHquAUVZcgyLRHdw4NVsbWY1iiTo+xK8yunYoPJm+aqQv7eviUwOtd3RmxA+4xdIkcGhRht9ZlFEpbICIl3p/S0y/vUTZo/kOpDpYZQADpBbtqMMbLMy+gIwh5nzDebrbX0w2p0nUrbvx5QPrqrupcjfueQsCibgFbf5n4LYOC+D5aYl32BVHsXY6xynkCUrqeL6N3Pd5vKSJOJvbRY7/oMjeaqN4X8q8qeJVApi0JdoR4q7LDz6Xcdq2AwdnwiQ52pJyTJS8TpGxHPYAFR2fMy2pKujo3baPUqExMYHXg8XaH8eS/Kn4hKdifzXuOA+fCi6Qyst01Wc8xpK4S34j8DJck1pY88Yv80pcdAk/PxRc6fF2WCkCLlnMtcy5kRJF+8UaaaE2Q73hFMUpFKdPCdesmbU6ulXUU= 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: Use the iterator type to determine whether an iterator is user-backed or not rather than using a special flag for it. Now that ITER_UBUF and ITER_IOVEC are 0 and 1, they can be checked with a single comparison. Signed-off-by: David Howells cc: Alexander Viro cc: Jens Axboe cc: Christoph Hellwig cc: Christian Brauner cc: Matthew Wilcox cc: Linus Torvalds cc: David Laight cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- include/linux/uio.h | 4 +--- lib/iov_iter.c | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/uio.h b/include/linux/uio.h index d1801c46e89e..e2a248dad80b 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -43,7 +43,6 @@ struct iov_iter { bool copy_mc; bool nofault; bool data_source; - bool user_backed; union { size_t iov_offset; int last_offset; @@ -143,7 +142,7 @@ static inline unsigned char iov_iter_rw(const struct iov_iter *i) static inline bool user_backed_iter(const struct iov_iter *i) { - return i->user_backed; + return iter_is_ubuf(i) || iter_is_iovec(i); } /* @@ -383,7 +382,6 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction, *i = (struct iov_iter) { .iter_type = ITER_UBUF, .copy_mc = false, - .user_backed = true, .data_source = direction, .ubuf = buf, .count = count, diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 27234a820eeb..227c9f536b94 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -290,7 +290,6 @@ void iov_iter_init(struct iov_iter *i, unsigned int direction, .iter_type = ITER_IOVEC, .copy_mc = false, .nofault = false, - .user_backed = true, .data_source = direction, .__iov = iov, .nr_segs = nr_segs,