Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3497875rdb; Wed, 13 Sep 2023 14:02:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2gceoBvrSaNFKyKLkBOxqvuKLZMUf1Y9IzOG1u8pm+3WcGZPBs2HYCq7Io2DEC472XrUT X-Received: by 2002:a17:903:24f:b0:1c3:5159:af00 with SMTP id j15-20020a170903024f00b001c35159af00mr4382948plh.44.1694638973466; Wed, 13 Sep 2023 14:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694638973; cv=none; d=google.com; s=arc-20160816; b=q1FclwzJIUxrASGtbuBbdPVxlUUK02RJmiCmjduegdkd6KNjUJAhv79b9EliNt81Bs sgOvlqyPfma3ueCfNVKgJ0tzCXQn6SlxwoQs4lXBIPrN9HiSQnTg0Qwd9Y7gR441KyBD Yp+iMGZBAFIDUiLWPjwcKIp47jh6dLKtBcsufiDbr4UaXwvrEV497la/wnfxmtAH3i4c 5Pw0RmhTmCxLK2SgKvJAKBfSQQhN33cILVkf58ltnUMet/kd4+7/VF+/3dDCsyxAAoTg 1sErBlQETzxq8msObrHjYUx0nB9X0Vn727MVbqBliDUwr5BzO9sTkgpqRfX4chwTbIUp msnA== 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=JMFAeSz7Gk3tUajr4TCvrb0uYdtniI0MVPhc5ULEcNg=; b=DxqKjCRLGCsJy/TW+wb8tMsc1vYbDJygpAW1/ogWp5B6RkxOlIHM/nsfQF7447KcQ4 rbo2Zd5hP9RD0xIJN8rmh2ErzIahm1aPcmjJ963nt2K6I9JmLlqCgYxSLb0Y/6c7aZoO X7IZ0NGr3CNmrCwXA+V5dr1qDznseurgIVhSq1BTqxGiOfEZde+2YCplx6wy0jNnCz5X 0IT3TfGBPS58Q4Mky+t63viMITWnE3J0GSsq7HqlOHKfj0UFGIDWNJQJgTQAxoC+L5/v /k6q4b3lpa647Gx++2T0XT4ardYXRvakRSfb+LcdQ/SmIKRT8SISFOBlENjsZ2zGKsmr QD+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OZGolSBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id c13-20020a170902d48d00b001b7d2b55d8asi100428plg.626.2023.09.13.14.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OZGolSBv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id F2F4881DC61F; Wed, 13 Sep 2023 09:58:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbjIMQ6A (ORCPT + 99 others); Wed, 13 Sep 2023 12:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbjIMQ5x (ORCPT ); Wed, 13 Sep 2023 12:57:53 -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 ESMTP id 995E31BD0 for ; Wed, 13 Sep 2023 09:57:05 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:58:22 -0700 (PDT) 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 lipwig.vger.email 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,