From patchwork Fri Jun 30 15:25:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13298357 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 0A32BEB64D7 for ; Fri, 30 Jun 2023 15:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A21DD8E0023; Fri, 30 Jun 2023 11:25:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D0988E000F; Fri, 30 Jun 2023 11:25:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8727C8E0023; Fri, 30 Jun 2023 11:25:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 719F18E000F for ; Fri, 30 Jun 2023 11:25:55 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 41B424056C for ; Fri, 30 Jun 2023 15:25:55 +0000 (UTC) X-FDA: 80959789470.06.FEE3E12 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 07B1F40014 for ; Fri, 30 Jun 2023 15:25:52 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M6aDf7kB; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1688138753; 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=A03JyOO/f7iAqHJBZB+sdm2rxbR0PVujtNmj3kIoBeA=; b=XwdAYvu5mSXKa2BfE5OxRjfKfcfoOZk2GF2Cd+MZJwRTDiHCLIMNU3Ctnm7a9V0V8dqJY6 /GmNt0qiJ4FARkT+QQJt7RzqSqLCsud6Dax2Uy0VBRRO8wGc4szsNZGYgFE2LwMNnCdPCF mTqqUtDBA3Zp9imTjlde7uEB4+EcSy4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=M6aDf7kB; spf=pass (imf11.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688138753; a=rsa-sha256; cv=none; b=AMVvKHE1iefV8rKGvKas3EQmJzZ4h4L35JA7E2qniNzbl0NJ2Bl/h2xhv/sd5+VLUj1V+f zNEmUTrOuX9/zwXzGCFodXIc8OXu99qvrO/jz2OkSOkCTgw4w5W8ZIHCSXVubU5QRZT4Df BGnujUqAGtC2yWK70PJNNCKW+YEvO9Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688138752; 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=A03JyOO/f7iAqHJBZB+sdm2rxbR0PVujtNmj3kIoBeA=; b=M6aDf7kBczJIeMtD3t1Y5pAIEnykXo6DE3kXJZreacxQ5/3LWbV+kNRJp1OyAwwMJtIP4k S2IzoK4RNmkjHOTKasXtgqRrPIqNQU8g9dQQIONxDjoZEXKLYHFo/qUV817WsXTAP2RbbO +15xSM7+NV68+elYFZ8hH8DrPJx+Ttw= 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-601-N6FLg4pXOKyVIzUdiDErog-1; Fri, 30 Jun 2023 11:25:47 -0400 X-MC-Unique: N6FLg4pXOKyVIzUdiDErog-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2467A185A793; Fri, 30 Jun 2023 15:25:45 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.195]) by smtp.corp.redhat.com (Postfix) with ESMTP id 187E348FB01; Fri, 30 Jun 2023 15:25:43 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Christian Brauner Subject: [RFC PATCH 06/11] iov_iter: Use op_is_write() rather than iterator direction Date: Fri, 30 Jun 2023 16:25:19 +0100 Message-ID: <20230630152524.661208-7-dhowells@redhat.com> In-Reply-To: <20230630152524.661208-1-dhowells@redhat.com> References: <20230630152524.661208-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Queue-Id: 07B1F40014 X-Rspam-User: X-Stat-Signature: to8a7a946z8gybad1qdbiy5qmwxi3316 X-Rspamd-Server: rspam01 X-HE-Tag: 1688138752-619745 X-H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jxFz8YZ/Y7FMlnmPM3X8Uc+As4QCa70Pc2nlRCqHpNZ3e40A8P0wg+SCr9cEaVxFERxHTBs+TjGEP33tUYAyPiHqDXGFkqzY8AGcx5HoJHQxBT2bxjrxHWtda+rMY6mQuUSRPgCUchwnPUk23b+uvozVe9S5PZ76Y0otdsiiNfE4mgOivsAtTZw8YDfAQhh1YjX71UoSfHVmCca4ASAjcEjN27zIgXU85Bh7U9WC0kWKhsLCJpZaHQNWHPoQymJrA== 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: If a request struct is available, use op_is_write() instead of the iterator direction. Signed-off-by: David Howells cc: Christoph Hellwig cc: Jens Axboe cc: Christian Brauner cc: Alexander Viro cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- block/blk-map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-map.c b/block/blk-map.c index 44d74a30ddac..f8fe114ae433 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -205,7 +205,7 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data, /* * success */ - if ((iov_iter_rw(iter) == WRITE && + if ((op_is_write(rq->cmd_flags) && (!map_data || !map_data->null_mapped)) || (map_data && map_data->from_user)) { ret = bio_copy_from_iter(bio, iter);