From patchwork Mon Sep 25 12:03:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13397692 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 294FBCE7A94 for ; Mon, 25 Sep 2023 12:03:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A8CC6B0143; Mon, 25 Sep 2023 08:03:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5338A6B0144; Mon, 25 Sep 2023 08:03:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 314A56B0148; Mon, 25 Sep 2023 08:03:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 176746B0143 for ; Mon, 25 Sep 2023 08:03:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D817CC0C61 for ; Mon, 25 Sep 2023 12:03:39 +0000 (UTC) X-FDA: 81274985358.21.A477BF8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 12575140022 for ; Mon, 25 Sep 2023 12:03:37 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gDctC5YI; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.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=1695643418; 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=4obcSyEH8f0LI+hqbulIObwIk6RPpIYigX0Ml5LHEtM=; b=1/X4SkXNgQMJPYrpZzb356oLxFlpU76LOvh18bmuXLldThTRSCBkQCDyfqFf3PPMyb2PDs fb8KvY0AM/8jm1YrQN0EHTul/ZxQSuxsW9RDA/8F1lyFJIKcQ+nnkHWwr8JhTYgXmigdgZ FA5MmuKr/v/XKi9/99uNBShEQKd4kBo= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gDctC5YI; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.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=1695643418; a=rsa-sha256; cv=none; b=hQxYqnBudnfdunu199Zccn4Wt8Ao2ObFe2uRH29qlqeZ0t30ipHNL0Nf7KhQGyHIqDjI81 fKO+BzjO1kXurhAZc6rXCakjm7WLEjqNL+5QWNNG2CH/nFbP8ivhA2CsAEPkDm7zURxXE4 ngZtLg1psoVlg/NPdwAUTXfGqSiE06s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643417; 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=gDctC5YITbxq4Yuw31SKhxc0+ZoejdwlUZiw8izb1s/XLjKxDsNeNuSVm6vG/gNvGXOOHZ 1JY7iNjGvrl+NQQ94HJj/wiykyHngJDf32RGQ5yH5DvcpjH9VPeAk76DFh0ys/sYk+hR0K pt+idm3O3PHC/2HgVtUF34YKWx3WFhM= 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-136-cDj4weHpMsW5nB2aWNtwwg-1; Mon, 25 Sep 2023 08:03:34 -0400 X-MC-Unique: cDj4weHpMsW5nB2aWNtwwg-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 4F33E800B35; Mon, 25 Sep 2023 12:03:33 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8F8551E3; Mon, 25 Sep 2023 12:03:31 +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 v7 06/12] iov_iter: Derive user-backedness from the iterator type Date: Mon, 25 Sep 2023 13:03:03 +0100 Message-ID: <20230925120309.1731676-7-dhowells@redhat.com> In-Reply-To: <20230925120309.1731676-1-dhowells@redhat.com> References: <20230925120309.1731676-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Rspamd-Queue-Id: 12575140022 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: xwj1omjtfq9pdi1tuchgdun8tdzjwdt6 X-HE-Tag: 1695643417-532599 X-HE-Meta: U2FsdGVkX19lLzLx/xlu4eY9ADIvYiWwecc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1LkSMROWv9Hnzcpu7oUz9/gdj77UlcCBYpBAjO6JQUtItdCEITY+K9OnLkjuE6JwctMRM6skyQ35WEjo9IbxvExrDZIZFEpE6w4AxLaZRtIKGlBiUaNp5xBsVj0cPMCakrJH2Fq6QNw5JUcD82KXdPJ4bbknGyxyu46sYJ/bvlo9bFuvKD1dps2+iF1nMllBaLvHlXEmT5zEOyLwRIaYCsLCJqUlr1CWnGXs4t+tx5GaOGSvu/7R3ys2CDsQDyqr4wOIv+4aTD5PoccS2GwB1zfn6SxthLSd84Q3QbAzxzv4Db3rK3N0Wa2xOS1FO6XVKvXJ5KcFmWSFtRQNTDacwuK1kFPWwMv3+SGsgsezyMv1yVkzVi7dWYHn1qPRY9pacuh3MtpqxIQED2GcYLS0FANCS9pCoo4cJ528hanZdmPvjoKLJpdIdEDMhoLnsxDs2uPrYund2ozwDIO5zC8= 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 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,