From patchwork Wed Sep 20 22:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13393497 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 3C082C2FC0C for ; Wed, 20 Sep 2023 22:22:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C02186B01A1; Wed, 20 Sep 2023 18:22:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB2796B01A4; Wed, 20 Sep 2023 18:22:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A53776B01A5; Wed, 20 Sep 2023 18:22:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 92BA56B01A1 for ; Wed, 20 Sep 2023 18:22:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6DF3740DF4 for ; Wed, 20 Sep 2023 22:22:56 +0000 (UTC) X-FDA: 81258401952.10.6DFFDFC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id BD8B34002D for ; Wed, 20 Sep 2023 22:22:53 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GW2zw02b; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695248573; 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=cFMFcQrZfpXYmcvTT8YZiSFLEmzNW1nbBOVy5Y0mlvYeydHqSkd0y/joEgwL229Gb8eSSh 7gJOchLQINeQ2q1z/xES7o2Lhr0efe+qveCgm81ioQFFCU9ihFjL/LBWlER27QvXV8AlVi dXwxm4AqWrerOu67cNRTffwke7RAoGU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695248573; a=rsa-sha256; cv=none; b=zZRjpjMMn1Nx+A10GPBpaFcJLWFwLVSKlUOW7xjUJxoj8M02TEE3osV5BlduLNXIKt5Ior nfY1AAvo8dhBFfi3c/wF8pNwSZAp83A6rjB5W7CRYZcLzc1To1ySHoLhUsL7MADQoWBCjx IlsYOqyWXJ/7eAjW/Peh3fhyB3npZpg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GW2zw02b; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248573; 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=GW2zw02b/vWqm1yMQUMeQAqnbXPLV0y7AdFlXGUhaG86ejFbv2LjJlddoYyjXFM7n7DG6Y 0+cV5vRqsPfItLj19k7l1msr0hm4J80QRDpfT0hpjxZbw7hic+m8AWcHOqsLsQaaQi7+3w DtdYeOyGryAYPQB4o+T08LlA51Z/C68= 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 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Queue-Id: BD8B34002D X-Rspam-User: X-Stat-Signature: 7ke3yzxk669m71gp1ax1jbkeu1n5ujog X-Rspamd-Server: rspam03 X-HE-Tag: 1695248573-526864 X-HE-Meta: U2FsdGVkX1/gUUsloeQ/vk414VQZ1ppOid9Agn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bFQiFH/ieKQh1v1CK4RxwoThmtI5EjdgJjWjph6VapdI4h9+nVpuJWnxSV+qcd7Pr83kIX8kx6ky9vmye2586UCs7eW3dS1ZexmoFrW43En16FAkF/fLqlc8pAkN8RjykM6C6UNHcYN31pUuxXu09FM5n5lEV+uLN6s/r1DdXbSa7rHXxgthBVmI7tJhm598N9GV32MstLoIyoqDBDDDGB2nnqYyqZYT8H90qek+qhOTw0dJmvt/u9Wi+sNFcOZzKamVW+0206fBEYeirl1WEGxAEQGlup9LUaEGACiJmx6o6kmrJJErlU1o75Y1YNoLIiSbEeFTsEQ/paiDJG+r3g2mWKAUXeA5/lVHtzXkUCYmtkF8tgqzbGwnoOTMDdYZZIB5WmUchaoWmmg6sfpIBt7SDorN0OUcx41xnqMUUSa/ll/FPyAASXDBe1Rxk0ef0bgggdM3XRbqWx08tn0I= 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,