Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2777011rdb; Fri, 22 Sep 2023 08:08:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFb2zDiD8bd/C6k+Ik4NOCTFVCWVxP4g5Ybe2RW6x5aVfbnXwWbdHpJ15V0aTPwJk2zHM5f X-Received: by 2002:a05:6a00:997:b0:68f:cc47:fcc8 with SMTP id u23-20020a056a00099700b0068fcc47fcc8mr10187222pfg.14.1695395287579; Fri, 22 Sep 2023 08:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695395287; cv=none; d=google.com; s=arc-20160816; b=i/HpX+M+mPwWeVOpGQaep+qnoOaU9eLbXrd0+PTFJ2h2fQjJJcsc/ef9sFHyzk9wkg TcsIuftUm8uGY9nwW1jJKMx9e41GgLditL0tT0FVaygDMcj7J2VGPZVdiBYLptOh3EAZ KcPyeZnin3qF1xY50PUrP0NqnWjMEWRpG3+/COPRRv3Akxj1SKJztOakL5IDp/L+qov7 2eiNUbtY0xgmeh1gUbGVwbxwbaFjafplGb+E+5OVz8DBWheGV/PosaQz7TnKAINCCPRt FO9j2bHW2wDkKlwiqMUriMYn5M3dTdojriPZxge83ma3faptxn+1hDOb/Ex9llr8l8wh F+3w== 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=4obcSyEH8f0LI+hqbulIObwIk6RPpIYigX0Ml5LHEtM=; fh=dzqEI/am1IoNVOMZmTOChre3TckBGjOgtLT35fkBuy0=; b=ew4Q8osxFzUKKvWTd37pg54cfoHdPZXu1ZO9Ta2T9Hz/YdUsuD6pFCZ3ebgmgnMsSK Fvv0R35qX8+Cwz1JDFOl50023YkLSBRPOT3XbRg9a5m4wqHR0nD/JdSFsRKcUkyZANhA +pcLYB1hd1Mp9TlEPGBIruzjZVV972bLxy1UmwtUwXYMB0oIVjpGioyRDupiZ4uWcZBV UuAa4ctADkhfngbh3S3Z3zJqGK+mb9XG/vtmBc7DGIjIz6UbZcmQL4/Vw5HPV4l9MhZp 85J8zXv6JBK+JIkwPq1RNck3n7on6F9SdbVF+R+QMJtNgak2VJkOs1aZ+/nQSnkBnBdl pMdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TPS5iQ50; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id f24-20020a63e318000000b00578a2da998asi3939552pgh.304.2023.09.22.08.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 08:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TPS5iQ50; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 5D98383C553B; Fri, 22 Sep 2023 05:05:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234009AbjIVMEr (ORCPT + 99 others); Fri, 22 Sep 2023 08:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234096AbjIVMES (ORCPT ); Fri, 22 Sep 2023 08:04:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5E51BB for ; Fri, 22 Sep 2023 05:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384172; 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=4obcSyEH8f0LI+hqbulIObwIk6RPpIYigX0Ml5LHEtM=; b=TPS5iQ5067BJzAECWHAtKm/kdhoCDBGEKGNd50ojZ7Y1ncBbeIfMJehG7GX9x7JZ8ccKtN jU3pnYKUYQtkT1PybKTNVedwInRq+de7Af36vjk9okQFUzQrLI0qpeDnFsRBvfcA3P2J3x KV7GmESoIw8uqrX7q4GVNUCZ1MHjRjU= 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-183-mKXZqPWoOu676PZGhvpTxw-1; Fri, 22 Sep 2023 08:02:48 -0400 X-MC-Unique: mKXZqPWoOu676PZGhvpTxw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 7EEDD185A79B; Fri, 22 Sep 2023 12:02:47 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id D33FBC15BB8; Fri, 22 Sep 2023 12:02:45 +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 v6 06/13] iov_iter: Derive user-backedness from the iterator type Date: Fri, 22 Sep 2023 13:02:20 +0100 Message-ID: <20230922120227.1173720-7-dhowells@redhat.com> In-Reply-To: <20230922120227.1173720-1-dhowells@redhat.com> References: <20230922120227.1173720-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 05:05:33 -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 bef8e56aa45c..65d9143f83c8 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; size_t iov_offset; /* * Hack alert: overlay ubuf_iovec with iovec + count, so @@ -140,7 +139,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); } /* @@ -380,7 +379,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,