Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3686966pxj; Tue, 15 Jun 2021 06:35:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWK9pTDH79VGkf0AbqaPbjuzpqlSsssSOe1mqXJWlpivCjzadAoTw7/gkGRU2N35CiqZkN X-Received: by 2002:aa7:c349:: with SMTP id j9mr23465098edr.21.1623764114581; Tue, 15 Jun 2021 06:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623764114; cv=none; d=google.com; s=arc-20160816; b=Fc0Tw3kp/Wm/rcfXGjLm1TOEunGm972SSUQV/rOdmZ+mLmO2iEKvh3rBjkXJLYRTpw ajMZnqvrWkofn3nB41tIsZokCaLP4cArUhdmoQxLL/uaHLV/66/WcW16x7JQrjhlb/gZ aloRlS5ufW089UBW5o/4fxuSgSXddH1IiROc6u/UIs76OCDP2T50s1taD5Ejr5FSO41S Vg9friPTpAtdnf6miqKONNISBF4ihgitmdBLKDQJcpdGH3LQXY0hSJOV/rQKnwTrInh6 ulD2lz9zLi5cxen0Qnm2yK5Bm3G5QTsvqqvWzOTuC4G4giUXNy1nbKY/e0hAk3/Gb15l rwEA== 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=YPtwLUw8PRAicYLQ1GdhSCihX8di0cio1kNet5uOMPc=; b=ZiZTHyiTdaUKXHHwF6rp6BqJeoODnSdGNs0acl8FIwhWYxUBjNmYGCvvaJAaNHc5eM 6NdA07eS9tzOA0Zinapiz5bEJ2+4GJeHrlcvo88bgNL4zK1YL0zfKWpT7XOXm9l7XdOk q73FgQw919u7wxITzPLZjmAIIlhPJ06Smjf+afoKcqEe9EFS+qyKiqL9/diIacrkq46l I/UbCAJdhkSVwjHy5QAeDLlavkoBj2YhpqYBp6oZnycoB7FBOGLkvB3LxRNXLxcNFTlY /Tt44IqMLp3vtuW7zCC1q630lA43CC+hFLfSJyUDpmlOOMNDpGSnmABh4BIWlQ4zWr16 MqKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=N4Kpqras; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si13595678edd.2.2021.06.15.06.34.50; Tue, 15 Jun 2021 06:35:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=N4Kpqras; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231196AbhFONeq (ORCPT + 99 others); Tue, 15 Jun 2021 09:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbhFONeo (ORCPT ); Tue, 15 Jun 2021 09:34:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C05C061574; Tue, 15 Jun 2021 06:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=YPtwLUw8PRAicYLQ1GdhSCihX8di0cio1kNet5uOMPc=; b=N4KpqrasiZK2eUA6ugnp8O0mRP YqrAAtYCEOld1CdrqazF0Zs6zFfrFQmZ8iFSRkQ6z+3q+Ym0UikedZA0yfVihTFkcboWn82l+keTk PaGQJOydY8xs8JdbjqpcsQjYXeAluZ/ATE5Na0pZoNXk6rsShx9vv5MRo8z1gvMGjEeyw+If3uUgC DKZ69DrTTVSF6HtafaJB9XYDsHxoxXqwX6xfBnmz44I824EBhrisKN1uDs6XEc3yxTllqhx2h83vG TAJLynC8N9bTqSZLDrkUtbpP65WMKdHhQ/ke3wiR00wrOde0Rn9GwiL5Vcg9JK/wokRG3AfO5juGm 1dbCvDkg==; Received: from [2001:4bb8:19b:fdce:9045:1e63:20f0:ca9] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lt99u-006oV9-Uk; Tue, 15 Jun 2021 13:31:25 +0000 From: Christoph Hellwig To: Jens Axboe , Thomas Gleixner Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , "James E.J. Bottomley" , Ira Weiny , dm-devel@redhat.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, ceph-devel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH 16/18] block: use memcpy_from_bvec in __blk_queue_bounce Date: Tue, 15 Jun 2021 15:24:54 +0200 Message-Id: <20210615132456.753241-17-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210615132456.753241-1-hch@lst.de> References: <20210615132456.753241-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rewrite the actual bounce buffering loop in __blk_queue_bounce to that the memcpy_to_bvec helper can be used to perform the data copies. Signed-off-by: Christoph Hellwig --- block/bounce.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/block/bounce.c b/block/bounce.c index 7e9e666c04dc..05fc7148489d 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -239,24 +239,19 @@ void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig) * because the 'bio' is single-page bvec. */ for (i = 0, to = bio->bi_io_vec; i < bio->bi_vcnt; to++, i++) { - struct page *page = to->bv_page; + struct page *bounce_page; - if (!PageHighMem(page)) + if (!PageHighMem(to->bv_page)) continue; - to->bv_page = mempool_alloc(&page_pool, GFP_NOIO); - inc_zone_page_state(to->bv_page, NR_BOUNCE); + bounce_page = mempool_alloc(&page_pool, GFP_NOIO); + inc_zone_page_state(bounce_page, NR_BOUNCE); if (rw == WRITE) { - char *vto, *vfrom; - - flush_dcache_page(page); - - vto = page_address(to->bv_page) + to->bv_offset; - vfrom = kmap_atomic(page) + to->bv_offset; - memcpy(vto, vfrom, to->bv_len); - kunmap_atomic(vfrom); + flush_dcache_page(to->bv_page); + memcpy_from_bvec(page_address(bounce_page), to); } + to->bv_page = bounce_page; } trace_block_bio_bounce(*bio_orig); -- 2.30.2