Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1912840rdb; Thu, 21 Sep 2023 03:24:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6nO2GxLjRGXitczimDNahkdi99UCmK3sJGpn15gSAX2K9TaQ7PQQL0iuMPgcSZTwMlPs6 X-Received: by 2002:a17:902:ec82:b0:1bc:7441:d81a with SMTP id x2-20020a170902ec8200b001bc7441d81amr5098714plg.6.1695291855446; Thu, 21 Sep 2023 03:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695291855; cv=none; d=google.com; s=arc-20160816; b=R7TC4iyJ0v7L0CfWgg6D8BQugXFa5LOMzOOHf36kKa/Mo20Pw+5A412r7yI0msSk8Z eOreYzLl6kyjSTyEMS8i/2elc+oQlo8es8ef5r9IXPVIinjsVQChqhnU/ZjZzaSjGu/8 bMr8/lpXtAjfrBTse7BNouALtUJTKA4wcljHkFrtRAR2k7ddLtDPlv4nG2ntXSi3hjsC iZoaV4rhdk/Ln/6GF0auptFK4UgeMDiBjAjQ/HDdkOIGQkB68HWpLxaVn56994OJy8UE VBn1xpZpoUBPCPT8fMk1zrc4JVlKY4vpXHpQeMs2mjsgMUGW8jLulcNDYNeo7aO3Wqe5 AgQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z7dUGMUCdPzyoXpN55evy5eiv8axvEjBjfUl9Q9dpbg=; fh=dzqEI/am1IoNVOMZmTOChre3TckBGjOgtLT35fkBuy0=; b=wLcSg0GN9od0l1LSvoqOqHLUNEeocTaowGDIOMIdCDna7duh4FrDfJgVh4EUsO+j9+ FoIc3d5DzydeVByQCVzNuvDEbGjLfOAlTAuFdSdoRox+cSd+huYY1rL8YeqBqGhjHPbB Rukok58xnQz6KoTw9/2mSWW1HChdF2LWenECMUT/njUEKKEYyT5/neXkaT9VusS9blve pqmVy76qeVcST8s94LCKlC1FO0EvD3YnY6VZ962+MAXWY2CFjFtzhjkHZfxvohzV3lRB X/hggRMNFL8WSP3IfbSDbS+Bhqi79tO3Fj/B+AVj++hkFfsXnOcTTHnWZCUfT4L6gRUu MCNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hSkauMZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id f13-20020a170902ce8d00b001bdad5f0f0bsi1094839plg.543.2023.09.21.03.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 03:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hSkauMZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 301BB82A68AD; Wed, 20 Sep 2023 15:24:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbjITWYa (ORCPT + 99 others); Wed, 20 Sep 2023 18:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjITWYX (ORCPT ); Wed, 20 Sep 2023 18:24:23 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7217F3 for ; Wed, 20 Sep 2023 15:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248572; 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=hSkauMZcDNlbnPQdUUsapjPS1uiK/ycmlUXkhlyBiyujqTatEygYiPw1hRGwjJdPmCoanx BidCHQlepqRXOiftnmBmxxFxRfv08dvhD7K2Qf2sr7heQIJx65mC1EQuJGBf3p3lgLcw6K JAcFkXKz5bjDZY9WXS4fIfu+AaU0GdE= Received: from mimecast-mx02.redhat.com (mx-ext.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-630-R2WmEFWxPlGwwyO8nYc--A-1; Wed, 20 Sep 2023 18:22:49 -0400 X-MC-Unique: R2WmEFWxPlGwwyO8nYc--A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 E9CE12932493; Wed, 20 Sep 2023 22:22:48 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FC2840C6EC0; Wed, 20 Sep 2023 22:22:47 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , 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 v5 04/11] iov_iter: Derive user-backedness from the iterator type Date: Wed, 20 Sep 2023 23:22:24 +0100 Message-ID: <20230920222231.686275-5-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-dhowells@redhat.com> References: <20230920222231.686275-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 15:24:35 -0700 (PDT) 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,