From patchwork Tue Jun 8 16:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9EFDC4743E for ; Tue, 8 Jun 2021 16:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEDDA6128E for ; Tue, 8 Jun 2021 16:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231465AbhFHQIT (ORCPT ); Tue, 8 Jun 2021 12:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbhFHQIR (ORCPT ); Tue, 8 Jun 2021 12:08:17 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039A4C061787; Tue, 8 Jun 2021 09:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=mxjphJIexdyUP+LgP6QQe1/DAIfJHdL4g4Vg5OxQMzY=; b=hNgm/XKkGW6qS50D9qILkbSbA3 ag1xUOBkEaBqGY3BiVOKZGE5bCfd+z0l6QZhFmyK7gOFzLVvRsu/qsETBYA3TnzLaS+oil4N6+zTS NTQMtE/JDlzwR/trspEmleh/87WlxYX4msxtg+R1WobU8kdnPgrsEJy3QCzmAc1dkhJ2L9gNJAyLO G6CxwAp9rJckWNufxaRejzebCCFvkRMee7p07BeU94Osh3HVMv8jPxAfv7X8MPcbd7oKcH0tkJLzT 36Voi00g3IQrTciGkP9mUs3b4G/CpF92BIsdK9SLCNipoMLXYiBiraJ7HumR/oOascVon2CdJt5tP DMfEIv9A==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeF0-009Ra6-Pg; Tue, 08 Jun 2021 16:06:11 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 01/16] mm: use kmap_local_page in memzero_page Date: Tue, 8 Jun 2021 18:05:48 +0200 Message-Id: <20210608160603.1535935-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org No need for kmap_atomic here. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- include/linux/highmem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 832b49b50c7b..0dc0451cf1d1 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -334,9 +334,9 @@ static inline void memcpy_to_page(struct page *page, size_t offset, static inline void memzero_page(struct page *page, size_t offset, size_t len) { - char *addr = kmap_atomic(page); + char *addr = kmap_local_page(page); memset(addr + offset, 0, len); - kunmap_atomic(addr); + kunmap_local(addr); } #endif /* _LINUX_HIGHMEM_H */ From patchwork Tue Jun 8 16:05:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB808C47082 for ; Tue, 8 Jun 2021 16:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4A0061182 for ; Tue, 8 Jun 2021 16:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231675AbhFHQIT (ORCPT ); Tue, 8 Jun 2021 12:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbhFHQIS (ORCPT ); Tue, 8 Jun 2021 12:08:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA60C061789; Tue, 8 Jun 2021 09:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=a0gQtMimMgFZkaRSJSMQd1xbl4hg7tfa68M4/BUo4Ec=; b=23QHAQjdmpqdrgvfV2Nqv8i+pX fv36/MifQp7tIqwRmuOJQltpdBibebdN4y1g/lDPGjVJdnfFo0Ai1yX4LuFYDt51OeKYJAct22PSV MZzHh5TcHPurFnhWBjLEf36wf+0GByKkXs64SzggvDu6x4f3/9OnpvTKHFNFHgWhh1ZPt+pDYXjIG 4y+/TDZwvZOasKtW5wEa6zwG7GIVWCfEWvk6nM1/lKNL93ZO4LkGZFou98UXBH1Hw7xQm1J8CqrJg bRj2Qqokxg8x8xr0ZLvkPtNDtAsPj3sfnI7j6GhEWS75RH8teIRav9EiBeEO5oyqxpKc042L0aIbM IfF+/mzw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeF4-009Rac-8Y; Tue, 08 Jun 2021 16:06:14 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 02/16] MIPS: don't include in Date: Tue, 8 Jun 2021 18:05:49 +0200 Message-Id: <20210608160603.1535935-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org There is no need to include genhd.h from a random arch header, and not doing so prevents the possibility for nasty include loops. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- arch/mips/include/asm/mach-rc32434/rb.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/asm/mach-rc32434/rb.h index d502673a4f6c..34d179ca020b 100644 --- a/arch/mips/include/asm/mach-rc32434/rb.h +++ b/arch/mips/include/asm/mach-rc32434/rb.h @@ -7,8 +7,6 @@ #ifndef __ASM_RC32434_RB_H #define __ASM_RC32434_RB_H -#include - #define REGBASE 0x18000000 #define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(REGBASE)) #define UART0BASE 0x58000 From patchwork Tue Jun 8 16:05:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DAF5C48BE5 for ; Tue, 8 Jun 2021 16:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAAEF6135A for ; Tue, 8 Jun 2021 16:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231840AbhFHQIW (ORCPT ); Tue, 8 Jun 2021 12:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231443AbhFHQIT (ORCPT ); Tue, 8 Jun 2021 12:08:19 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2F5AC061574; Tue, 8 Jun 2021 09:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=oWZyuciTMk9Oz4llaN6cnzbuyETlAwlAW/ZL8WXrlPc=; b=fUvQPpV8AGyBRslM8FvxAa8ee0 47eWXK3dNc5ZAlrjmamJRRWC4sOdmEagVUA3hMXNZuGYGNzwXRXZmuJw5/7V0aKWpPkhyG5JQWfi8 MNcDFWT/E1QnWvENVMH2BpSW3aI00e6CVb4srdu3kf9yHi9p90PlCuCd6rcF486FXU91yUzIEyzFE nC6yga6H3TmGZfyKF58vd2+prfBps0sjiiCR+/GmO0Hy6wtuKSXPcIsPMClX6L7dDDJ4i6X5I3BMa mqe2VKbNbEqxT/t6/RJdVY6MjtQUfSxayVFScRJ93MuEoWPfuqFPvn/2D0kAPXTOgwbHuMhf1oibN KF+gHULA==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeF7-009Rb7-Hr; Tue, 08 Jun 2021 16:06:18 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 03/16] bvec: fix the include guards for bvec.h Date: Tue, 8 Jun 2021 18:05:50 +0200 Message-Id: <20210608160603.1535935-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Fix the include guards to match the file naming. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index ff832e698efb..883faf5f1523 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -4,8 +4,8 @@ * * Copyright (C) 2001 Ming Lei */ -#ifndef __LINUX_BVEC_ITER_H -#define __LINUX_BVEC_ITER_H +#ifndef __LINUX_BVEC_H +#define __LINUX_BVEC_H #include #include @@ -183,4 +183,4 @@ static inline void bvec_advance(const struct bio_vec *bvec, } } -#endif /* __LINUX_BVEC_ITER_H */ +#endif /* __LINUX_BVEC_H */ From patchwork Tue Jun 8 16:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E070CC48BE8 for ; Tue, 8 Jun 2021 16:06:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0BA66128E for ; Tue, 8 Jun 2021 16:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232112AbhFHQIX (ORCPT ); Tue, 8 Jun 2021 12:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbhFHQIW (ORCPT ); Tue, 8 Jun 2021 12:08:22 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F27C061574; Tue, 8 Jun 2021 09:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=OCSR+eGjYhLRS8RAy8MFl9s9L6IyjOgYmb7x7h5BGDk=; b=kTuZKBSrB0mFUHPruJWFctHCV/ APCqvbEWKGNzK7EdLxVNJV0M14CczA+OeObXq7gTFWEM+UR7Y5OuFNQ/wAIImIHqbGFPje+jR55eX uGpdOM39AZD3j8luBVj/ZIg+IoYLY02rBnY9ZrHB9QJujM0+SfJPD8dUlyZ2WKSsWaRjzJMftODOh YGvtp3Ki+nr06a/z7EihNPqLTmpvDCJsU8Akh19ugoeeMUP9D5BuYIi18rjTrgGA/rWw2yGsVMd5Y I3zeZctjIYm0IV9n/p/91fmdHrKyqBiB8ZIAo0nilrI8I9oWt+2YI87d9bjA1Fp/buh7NrwGbK93P EFN+gjDw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFA-009Rbt-Qe; Tue, 08 Jun 2021 16:06:21 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 04/16] bvec: add a bvec_kmap_local helper Date: Tue, 8 Jun 2021 18:05:51 +0200 Message-Id: <20210608160603.1535935-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Add a helper to call kmap_local_page on a bvec. There is no need for an unmap helper given that kunmap_local accept any address in the mapped page. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 883faf5f1523..d64d6c0ceb77 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -7,6 +7,7 @@ #ifndef __LINUX_BVEC_H #define __LINUX_BVEC_H +#include #include #include #include @@ -183,4 +184,9 @@ static inline void bvec_advance(const struct bio_vec *bvec, } } +static inline void *bvec_kmap_local(struct bio_vec *bvec) +{ + return kmap_local_page(bvec->bv_page) + bvec->bv_offset; +} + #endif /* __LINUX_BVEC_H */ From patchwork Tue Jun 8 16:05:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D76CC4743E for ; Tue, 8 Jun 2021 16:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECCBB61352 for ; Tue, 8 Jun 2021 16:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233133AbhFHQId (ORCPT ); Tue, 8 Jun 2021 12:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbhFHQI2 (ORCPT ); Tue, 8 Jun 2021 12:08:28 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A589EC061574; Tue, 8 Jun 2021 09:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=XwFsKV0wTnqrjM2zeN8AG8XOGt14/N7ay2THQ9JeNTU=; b=gAN/Fa8WhYn6iNnCWrgN61xP/7 qpzWIbLp0RYRHKw+NrnaYNk86XGlBkEyNRZLSg+GjvrOS8dmNbfGeS9TaVA0rvGZTGvYqu20webuB fT//Gqjhw5BrXJ6eG7EsymCK6M9V8oVkAIum+X29mXJKhsWauuNFnG1S8uKWQPoxx07AsAXKnHiDM eezVe5V2bDEhRbNtHqKM1THzpw5ZQMP5ng6DjhKyhuQSgWmrH8JXt8cz85Ba93BG0y+rgch2mzvYp uTW6yTIWA84hxpbqarGW1LvLqWd9BltX1o8xjsjJ6gNYQIu6J7HYcOTEWcCAf/Ps19PgmjiQKbx4M KvtAPxqw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFE-009Rci-3P; Tue, 08 Jun 2021 16:06:24 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 05/16] bvec: add memcpy_{from,to}_bvec and memzero_bvec helper Date: Tue, 8 Jun 2021 18:05:52 +0200 Message-Id: <20210608160603.1535935-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Add helpers to perform common memory operation on a bvec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index d64d6c0ceb77..ac835fa01ee3 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -189,4 +189,19 @@ static inline void *bvec_kmap_local(struct bio_vec *bvec) return kmap_local_page(bvec->bv_page) + bvec->bv_offset; } +static inline void memcpy_from_bvec(char *to, struct bio_vec *bvec) +{ + memcpy_from_page(to, bvec->bv_page, bvec->bv_offset, bvec->bv_len); +} + +static inline void memcpy_to_bvec(struct bio_vec *bvec, const char *from) +{ + memcpy_to_page(bvec->bv_page, bvec->bv_offset, from, bvec->bv_len); +} + +static inline void memzero_bvec(struct bio_vec *bvec) +{ + memzero_page(bvec->bv_page, bvec->bv_offset, bvec->bv_len); +} + #endif /* __LINUX_BVEC_H */ From patchwork Tue Jun 8 16:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0407EC47082 for ; Tue, 8 Jun 2021 16:06:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D524961182 for ; Tue, 8 Jun 2021 16:06:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232901AbhFHQIl (ORCPT ); Tue, 8 Jun 2021 12:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbhFHQIb (ORCPT ); Tue, 8 Jun 2021 12:08:31 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F7B5C06178B; Tue, 8 Jun 2021 09:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=Mk3t3cc1dVJmc2zEEZkVa9al3zsN33BpE4gHRgqtU1Y=; b=UreAwxVUP0BWUHxcCK0Vw+j4kF i/rdKptDRuzF1e7gyv7Fc6ekV13PXAzj751RmNUQOrkx+ghsgsfSlq79Qaf6aQG9bgYOHGLLTYZCi kPIizTYkVUobsAJEfm/czCSbQMCkFHv7AYncsL/QnfiBh8D4ym9oPRXaHfixspZX+aNggIeTyw4XO IBBA4dy2Xi2REUldTmpBjboCS3IOenzkMKqidQBQuCmlFZTzRNUFVCXyyDVb8QelqUSc3/7iYwd6D pOppdn0pInKXRdEkHFW3cCgKA0fJUuC0cni43YsGPmqCeNe/AJovhdD8ZVRa1JKSDrjHo+qOLKfkY aP7ec0aw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFH-009RdW-2S; Tue, 08 Jun 2021 16:06:27 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 06/16] block: use memzero_page in zero_fill_bio Date: Tue, 8 Jun 2021 18:05:53 +0200 Message-Id: <20210608160603.1535935-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use memzero_bvec to zero each segment in the bio instead of manually mapping and zeroing the data. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- block/bio.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/block/bio.c b/block/bio.c index 44205dfb6b60..1d7abdb83a39 100644 --- a/block/bio.c +++ b/block/bio.c @@ -495,16 +495,11 @@ EXPORT_SYMBOL(bio_kmalloc); void zero_fill_bio(struct bio *bio) { - unsigned long flags; struct bio_vec bv; struct bvec_iter iter; - bio_for_each_segment(bv, bio, iter) { - char *data = bvec_kmap_irq(&bv, &flags); - memset(data, 0, bv.bv_len); - flush_dcache_page(bv.bv_page); - bvec_kunmap_irq(data, &flags); - } + bio_for_each_segment(bv, bio, iter) + memzero_bvec(&bv); } EXPORT_SYMBOL(zero_fill_bio); From patchwork Tue Jun 8 16:05:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49879C47082 for ; Tue, 8 Jun 2021 16:06:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 351B76128E for ; Tue, 8 Jun 2021 16:06:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233081AbhFHQIr (ORCPT ); Tue, 8 Jun 2021 12:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233168AbhFHQIe (ORCPT ); Tue, 8 Jun 2021 12:08:34 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7346C061574; Tue, 8 Jun 2021 09:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=/XS4Id3E1gYfbkc3NHcCC3rQFr5wtYJWpAMcKY+DpCM=; b=Uk954MLZwlNWd0DBj1xd6raQnh Uw48hj+wZry3hGYe6TYWXUR/39nqTqZzEoP6cc17w7Y1G8bMzCG+0LblPw2njd6n0BJO3RWVwriJj 5ef8TWTx3URm6q037NrMHdXmHDHDnDBePZZppCfGlhZlijusYeofqZ8X35mt90FQOjmAbA0Z3YP3i Jw0UZ7zC/tw9DtI6VJkoAJSYdYQwH/dS4a1DACipCh033JCA52CBKtVxoM8h9/s5A8/JdzdPJr07G +YWPm1FnMCmEuJralo+r97PRe+DK3GfdtKQyzp6QSJgvPaxuZoyySzwIFSs1myl+U4/k1HeZq7ppf 1YpmaZGw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFK-009ReP-7t; Tue, 08 Jun 2021 16:06:30 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 07/16] rbd: use memzero_bvec Date: Tue, 8 Jun 2021 18:05:54 +0200 Message-Id: <20210608160603.1535935-8-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use memzero_bvec instead of reimplementing it. Signed-off-by: Christoph Hellwig Acked-by: Ilya Dryomov --- drivers/block/rbd.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bbb88eb009e0..eb243fc4d108 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1219,24 +1219,13 @@ static void rbd_dev_mapping_clear(struct rbd_device *rbd_dev) rbd_dev->mapping.size = 0; } -static void zero_bvec(struct bio_vec *bv) -{ - void *buf; - unsigned long flags; - - buf = bvec_kmap_irq(bv, &flags); - memset(buf, 0, bv->bv_len); - flush_dcache_page(bv->bv_page); - bvec_kunmap_irq(buf, &flags); -} - static void zero_bios(struct ceph_bio_iter *bio_pos, u32 off, u32 bytes) { struct ceph_bio_iter it = *bio_pos; ceph_bio_iter_advance(&it, off); ceph_bio_iter_advance_step(&it, bytes, ({ - zero_bvec(&bv); + memzero_bvec(&bv); })); } @@ -1246,7 +1235,7 @@ static void zero_bvecs(struct ceph_bvec_iter *bvec_pos, u32 off, u32 bytes) ceph_bvec_iter_advance(&it, off); ceph_bvec_iter_advance_step(&it, bytes, ({ - zero_bvec(&bv); + memzero_bvec(&bv); })); } From patchwork Tue Jun 8 16:05:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 337B4C47082 for ; Tue, 8 Jun 2021 16:07:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 112B561278 for ; Tue, 8 Jun 2021 16:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232948AbhFHQJX (ORCPT ); Tue, 8 Jun 2021 12:09:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbhFHQIj (ORCPT ); Tue, 8 Jun 2021 12:08:39 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22ADBC0613A2; Tue, 8 Jun 2021 09:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=VJNoOLPDvc5xu3y+i4aVzvsoJRnShX/8Sf+3m5K1BjA=; b=Ay8U/aM3HgzodlZNkVKqaH3JIW rTwNhHqPm4zx8CrV68VSyfJaD7NErjIc2oUzYjkIs9qH60mq/BMnxp8EJN08iqshI7VrR+0XMZYxK r6n+rW/nWhgNySp15k9UwrXPl6aulxl+1L0jo3+aqxnDVEzscCAdONz+1Xn3H/SVlehWIVCdTgVFm W/wh2A4yjifNnmEp5RBmlG+9cTsdu215NSyXUNM8FKf4MEG475xZLKjwhsC3M1jw5A3iT5qMR2ri4 S/cNoGCUcy6Or054gHSx3OYG4BrmEYkDMfB+2hpC1o17HO8siwvUNYNhF85F5E0B0XNl1UnBV0BOx RtiOva8A==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFN-009Rfa-Dj; Tue, 08 Jun 2021 16:06:34 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 08/16] dm-writecache: use bvec_kmap_local instead of bvec_kmap_irq Date: Tue, 8 Jun 2021 18:05:55 +0200 Message-Id: <20210608160603.1535935-9-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org There is no need to disable interrupts in bio_copy_block, and the local only mappings helps to avoid any sort of problems with stray writes into the bio data. Signed-off-by: Christoph Hellwig --- drivers/md/dm-writecache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index aecc246ade26..93ca454eaca9 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1205,14 +1205,13 @@ static void memcpy_flushcache_optimized(void *dest, void *source, size_t size) static void bio_copy_block(struct dm_writecache *wc, struct bio *bio, void *data) { void *buf; - unsigned long flags; unsigned size; int rw = bio_data_dir(bio); unsigned remaining_size = wc->block_size; do { struct bio_vec bv = bio_iter_iovec(bio, bio->bi_iter); - buf = bvec_kmap_irq(&bv, &flags); + buf = bvec_kmap_local(&bv); size = bv.bv_len; if (unlikely(size > remaining_size)) size = remaining_size; @@ -1230,7 +1229,7 @@ static void bio_copy_block(struct dm_writecache *wc, struct bio *bio, void *data memcpy_flushcache_optimized(data, buf, size); } - bvec_kunmap_irq(buf, &flags); + kunmap_local(buf); data = (char *)data + size; remaining_size -= size; From patchwork Tue Jun 8 16:05:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74D1BC48BCD for ; Tue, 8 Jun 2021 16:07:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A2C261182 for ; Tue, 8 Jun 2021 16:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233422AbhFHQJZ (ORCPT ); Tue, 8 Jun 2021 12:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232800AbhFHQIk (ORCPT ); Tue, 8 Jun 2021 12:08:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF11C061787; Tue, 8 Jun 2021 09:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=HwW7/FcNSPjoRVBBgiBQclHiHBGFA68ApXQNMgI7IuU=; b=ZySEe4D5FHucQqfuf1IfwHVuKW WEHowatN5Tz2b3Z9grV/ImybjMv//WEMk+nNaqsU/kHB1CkTwBz9uwV6tqL+NLTC16eFXX4KUjdlm KNe+VlkXw296qZipYK9wua0s0mArIUMI5dTf7VnXNQACY7jfkA0ecBfVzsyPgispTyntJziaW50av bxo55suRvkOWzp3BY6bVQf82DwObcQ9EC8uIvE37Y8razpBbm9ai7HDfedZaZTWb5CjY0Y0uFMxvS xqYCerXgjUgMWiaesg9WqaPvdlFa/PXNUX/k+E9vjO/L20OtCWESv7G+isYWlB5y2kI5cj2BK3k6N RoH6CpdA==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFQ-009Rge-Pv; Tue, 08 Jun 2021 16:06:37 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 09/16] ps3disk: use memcpy_{from,to}_bvec Date: Tue, 8 Jun 2021 18:05:56 +0200 Message-Id: <20210608160603.1535935-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use the bvec helpers instead of open coding the copy. Signed-off-by: Christoph Hellwig Signed-off-by: Ira Weiny --- drivers/block/ps3disk.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index ba3ece56cbb3..f2eb0225814f 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c @@ -84,26 +84,13 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev, unsigned int offset = 0; struct req_iterator iter; struct bio_vec bvec; - unsigned int i = 0; - size_t size; - void *buf; rq_for_each_segment(bvec, req, iter) { - unsigned long flags; - dev_dbg(&dev->sbd.core, "%s:%u: bio %u: %u sectors from %llu\n", - __func__, __LINE__, i, bio_sectors(iter.bio), - iter.bio->bi_iter.bi_sector); - - size = bvec.bv_len; - buf = bvec_kmap_irq(&bvec, &flags); if (gather) - memcpy(dev->bounce_buf+offset, buf, size); + memcpy_from_bvec(dev->bounce_buf + offset, &bvec); else - memcpy(buf, dev->bounce_buf+offset, size); - offset += size; - flush_kernel_dcache_page(bvec.bv_page); - bvec_kunmap_irq(buf, &flags); - i++; + memcpy_to_bvec(&bvec, dev->bounce_buf + offset); + offset += bvec.bv_len; } } From patchwork Tue Jun 8 16:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA89CC48BE0 for ; Tue, 8 Jun 2021 16:07:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A812B61360 for ; Tue, 8 Jun 2021 16:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233032AbhFHQJ3 (ORCPT ); Tue, 8 Jun 2021 12:09:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232541AbhFHQIp (ORCPT ); Tue, 8 Jun 2021 12:08:45 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 670F7C061789; Tue, 8 Jun 2021 09:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=C48nWYMntBNCb294th9G4NnV3ael3h9v9Uxu/7DKsAQ=; b=Txr96xyI42l6bWgyhy/NfFLZ7p wI6xYLpds+hPhxaTrtgNxZnsiJneyFLimCdskXsnDubCkPriAk27NWsJax9LORtsrDWA2C3GA/6xN 602wRe7RkZl1rmEzH+1/GncJAEJdfVch+jWMYDYmFMLh1ZGElSIhVT05QXchMevqH55gtDpet5Eez 5bhhZtmLhLjFJt41xezRVJSCSlZDzbfRO3vmIyigiuRspPpiyPum814CZmYg1wFQdl8OGjwNlZB36 YrsO9Ox/qF+JmneH2jgu1KoL2bAn/rnXh8B2EVk5sfns8NtGDYfL80iuCGjM/E/MPfGxkZGekLkLW evxV+uGg==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFU-009Rhp-30; Tue, 08 Jun 2021 16:06:40 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 10/16] block: remove bvec_kmap_irq and bvec_kunmap_irq Date: Tue, 8 Jun 2021 18:05:57 +0200 Message-Id: <20210608160603.1535935-11-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org These two helpers are entirely unused now. Signed-off-by: Christoph Hellwig --- include/linux/bio.h | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index a0b4cfdf62a4..169b14b10c16 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,7 +5,6 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H -#include #include #include /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ @@ -523,47 +522,6 @@ static inline void bio_clone_blkg_association(struct bio *dst, struct bio *src) { } #endif /* CONFIG_BLK_CGROUP */ -#ifdef CONFIG_HIGHMEM -/* - * remember never ever reenable interrupts between a bvec_kmap_irq and - * bvec_kunmap_irq! - */ -static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) -{ - unsigned long addr; - - /* - * might not be a highmem page, but the preempt/irq count - * balancing is a lot nicer this way - */ - local_irq_save(*flags); - addr = (unsigned long) kmap_atomic(bvec->bv_page); - - BUG_ON(addr & ~PAGE_MASK); - - return (char *) addr + bvec->bv_offset; -} - -static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) -{ - unsigned long ptr = (unsigned long) buffer & PAGE_MASK; - - kunmap_atomic((void *) ptr); - local_irq_restore(*flags); -} - -#else -static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) -{ - return page_address(bvec->bv_page) + bvec->bv_offset; -} - -static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) -{ - *flags = 0; -} -#endif - /* * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. * From patchwork Tue Jun 8 16:05:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68600C48BDF for ; Tue, 8 Jun 2021 16:07:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CA8161278 for ; Tue, 8 Jun 2021 16:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232773AbhFHQJ1 (ORCPT ); Tue, 8 Jun 2021 12:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbhFHQIp (ORCPT ); Tue, 8 Jun 2021 12:08:45 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76247C06178B; Tue, 8 Jun 2021 09:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=rADL90S3oRiyRdCFkcJ9oLhZvXcChQZEzORShMtqGjI=; b=fAhFUBN7Oc5BAEM6sORmoH6JDn sA7j6sp/njH1e/DfVaccAfoQX5UE5IFfNBERRtuswcYno9hlov73RUW8L80YIlgzUZJwT8ma5YmJc mExGOPVRIFR/Nc3HFgNHk6IHOsJDVHbX8oVmEjnj0LkiLvx48A2UatdpveMhgZVrfKszj04iZqH31 RehyDVGENeMdIRBKZhmU1IK/Yzlj2kaEVWh8MW2VMYwPaO2VPbLnpdl5fU9GM0J7DoPkDwUeQpPfY 9MDj2/MorS5EwuEz29zobjxozUL9M2dGB6AuzgY11N+r3k1auMeuObPi6fJn/MTove72mkACrAMy8 bUrNAULA==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFX-009RiV-I9; Tue, 08 Jun 2021 16:06:44 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 11/16] block: rewrite bio_copy_data_iter to use bvec_kmap_local and memcpy_to_bvec Date: Tue, 8 Jun 2021 18:05:58 +0200 Message-Id: <20210608160603.1535935-12-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use the proper helpers instead of open coding the copy. Signed-off-by: Christoph Hellwig --- block/bio.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/block/bio.c b/block/bio.c index 1d7abdb83a39..c14d2e66c084 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1186,27 +1186,15 @@ EXPORT_SYMBOL(bio_advance); void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, struct bio *src, struct bvec_iter *src_iter) { - struct bio_vec src_bv, dst_bv; - void *src_p, *dst_p; - unsigned bytes; - while (src_iter->bi_size && dst_iter->bi_size) { - src_bv = bio_iter_iovec(src, *src_iter); - dst_bv = bio_iter_iovec(dst, *dst_iter); - - bytes = min(src_bv.bv_len, dst_bv.bv_len); - - src_p = kmap_atomic(src_bv.bv_page); - dst_p = kmap_atomic(dst_bv.bv_page); - - memcpy(dst_p + dst_bv.bv_offset, - src_p + src_bv.bv_offset, - bytes); - - kunmap_atomic(dst_p); - kunmap_atomic(src_p); - - flush_dcache_page(dst_bv.bv_page); + struct bio_vec src_bv = bio_iter_iovec(src, *src_iter); + struct bio_vec dst_bv = bio_iter_iovec(dst, *dst_iter); + unsigned int bytes = min(src_bv.bv_len, dst_bv.bv_len); + void *src_buf; + + src_buf = bvec_kmap_local(&src_bv); + memcpy_to_bvec(&dst_bv, src_buf); + kunmap_local(src_buf); bio_advance_iter_single(src, src_iter, bytes); bio_advance_iter_single(dst, dst_iter, bytes); From patchwork Tue Jun 8 16:05:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05D48C48BE8 for ; Tue, 8 Jun 2021 16:07:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECDBE6120F for ; Tue, 8 Jun 2021 16:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233684AbhFHQJa (ORCPT ); Tue, 8 Jun 2021 12:09:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbhFHQIv (ORCPT ); Tue, 8 Jun 2021 12:08:51 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F130DC061574; Tue, 8 Jun 2021 09:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=6el1Xjjuiwoh8C5GaeWua1PePuQ0zzIn1YY3WglnD2c=; b=TR8lLAOIS9zH3xVLWrYC1kGQrQ ROk7bhb2bZD5SH4f4/jWv+orQvUCu6O+IRXa+J1jUD/m3jLMXUaQRfWEpokNpQbnjhRiIwrZHPhX6 mqTDg9EtUknw9+BRv3LMGaqTsoxZhj6anyleI8mez0H3rWdl6zeyQDKehV8SibcXYZxQqh1dJ45aP UrqbSNBFeSgMNn0L6wpo2G+b2mh2BiPBZpG7hA/S6gnshZkSIGD2I8luNyDg08Lb/CIZKzo9Cj3Uv twQB+yNrgflXuc4Ljp/nn/sL7L63WlwyhGpoeS7NAtisM+UES6NDhs5DFfhoHGgpwUw38okU/c+L4 KtOKoViA==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFa-009RjP-Qy; Tue, 08 Jun 2021 16:06:47 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 12/16] block: use memcpy_to_bvec in copy_to_high_bio_irq Date: Tue, 8 Jun 2021 18:05:59 +0200 Message-Id: <20210608160603.1535935-13-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use memcpy_to_bvec instead of opencoding the logic. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- block/bounce.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/block/bounce.c b/block/bounce.c index 94081e013c58..a2fc6326b6c9 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -67,18 +67,6 @@ static __init int init_emergency_pool(void) __initcall(init_emergency_pool); -/* - * highmem version, map in to vec - */ -static void bounce_copy_vec(struct bio_vec *to, unsigned char *vfrom) -{ - unsigned char *vto; - - vto = kmap_atomic(to->bv_page); - memcpy(vto + to->bv_offset, vfrom, to->bv_len); - kunmap_atomic(vto); -} - /* * Simple bounce buffer support for highmem pages. Depending on the * queue gfp mask set, *to may or may not be a highmem page. kmap it @@ -107,7 +95,7 @@ static void copy_to_high_bio_irq(struct bio *to, struct bio *from) vfrom = page_address(fromvec.bv_page) + tovec.bv_offset; - bounce_copy_vec(&tovec, vfrom); + memcpy_to_bvec(&tovec, vfrom); flush_dcache_page(tovec.bv_page); } bio_advance_iter(from, &from_iter, tovec.bv_len); From patchwork Tue Jun 8 16:06:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34ED1C4743F for ; Tue, 8 Jun 2021 16:08:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22CF461352 for ; Tue, 8 Jun 2021 16:08:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233871AbhFHQKS (ORCPT ); Tue, 8 Jun 2021 12:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233868AbhFHQJE (ORCPT ); Tue, 8 Jun 2021 12:09:04 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D410C061283; Tue, 8 Jun 2021 09:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=HbWeEgqptxjWNK7W80q76MsDEy7Zz/e6+B7EWMBgV8Y=; b=0nS2fsMtKYvfSlgh29sC//dKZs 2CPkEeC+4D9KSJM/UG68fYgeWCVzS3LIfSfKE/T4KK7DGJezyJ9cxLExGzI2GU3q+Cs0IpTxfyjf1 zK19+5A8xXKYYb2MI2QsaI+FP/Drq5r9lM3AoflpgPMj8vgVhY336seMuJanKdVyI/Owe1XLKxOr/ aCL4ot5L/dNSl5+TFMhbMAVxV+eFkO++1ck61ihXa0fvMJQpJpavBbsPEBa1HzvClWiWcqtKExlM0 R2i93zJVTZnYPib30u5oUeyUqB9bDPylCZpw6iHHeENdKDo//v+y6Hzm+wXHx/vEiNpkymqmra3vc I6DZNp0A==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFe-009Rk6-0p; Tue, 08 Jun 2021 16:06:50 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 13/16] block: use memcpy_from_bvec in bio_copy_kern_endio_read Date: Tue, 8 Jun 2021 18:06:00 +0200 Message-Id: <20210608160603.1535935-14-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Use memcpy_from_bvec instead of open coding the logic. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- 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 3743158ddaeb..d1448aaad980 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -400,7 +400,7 @@ static void bio_copy_kern_endio_read(struct bio *bio) struct bvec_iter_all iter_all; bio_for_each_segment_all(bvec, bio, iter_all) { - memcpy(p, page_address(bvec->bv_page), bvec->bv_len); + memcpy_from_bvec(p, bvec); p += bvec->bv_len; } From patchwork Tue Jun 8 16:06:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C263DC48BCD for ; Tue, 8 Jun 2021 16:08:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFA46613BF for ; Tue, 8 Jun 2021 16:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbhFHQKT (ORCPT ); Tue, 8 Jun 2021 12:10:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233880AbhFHQJF (ORCPT ); Tue, 8 Jun 2021 12:09:05 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544FDC0611C0; Tue, 8 Jun 2021 09:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=MyECqL7omrkh9N+zg6dzXAPF0qAslqNXJGlcR34EKvY=; b=b4Ja1PJtReL64inLe6q6cCHK2j QtsAsUGVqoXMk0uXRjtZKKxZ1KcDPFQ/2E3g7QVHWcya9I0qbV0cZ5SR6kwGsWdFU8pVgJkrBquar YxBxkAuHdDeCnhSV/aNvk9DoZDnXfzyOxprW2nqGWTXUdNdrJMmEsIP+Zgda00i5siUaPwCB1GzQY HGZo+IiuzOhYzTOjOzinhBZg2wu3GuX+/uVu52zf3xUxqxm/RYdi7Poxkf3mu42ry3kQqBBfvOmgt D9NnR40fuODEKp23cRsjGb3lOrICZfro2Zap+kPgitNZaEtEcqM5SUhVJZcVvRhvUJJ9BFQIZlJAi Ex1/l4NQ==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFh-009RlV-DI; Tue, 08 Jun 2021 16:06:54 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 14/16] block: use memcpy_from_bvec in __blk_queue_bounce Date: Tue, 8 Jun 2021 18:06:01 +0200 Message-Id: <20210608160603.1535935-15-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@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 | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/block/bounce.c b/block/bounce.c index a2fc6326b6c9..b5ad09e07bcf 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -243,24 +243,17 @@ 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); - } + if (rw == WRITE) + memcpy_from_bvec(page_address(bounce_page), to); + to->bv_page = bounce_page; } trace_block_bio_bounce(*bio_orig); From patchwork Tue Jun 8 16:06:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FBB9C4743F for ; Tue, 8 Jun 2021 16:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0981761078 for ; Tue, 8 Jun 2021 16:09:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbhFHQK5 (ORCPT ); Tue, 8 Jun 2021 12:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233966AbhFHQJS (ORCPT ); Tue, 8 Jun 2021 12:09:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A518C0611FB; Tue, 8 Jun 2021 09:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=TkXSf08FOqBmuFw/ENTFMnI+54X5dnYwOAAHKqJCH8E=; b=pkj2gwkimoVdhfqEChAYFo7k01 DnDjBy0Vy9d/v40yq3IoyAtXggh26kXheeh7Q6FS/HWWh00L9VMnx3pZTSNuEiIWOQJz53QqfcsNm R41he7jPnmOndHMbLi8GzQ2PqR2X7YKUx24DmYFyeV0jtN5cWY3DFgwVTdyQu/j5mvfY/cn5L0lv+ qwTZ52er/7pZqEAG8sFNOmS+/jQdGymKGMUkboqU4/j+dbP5ihuHIrn6U2L9Zlya2Flw0avFZ5x6P cAWC40p3z6yHiYjkHFC0cXtePrK1w6gWMd17X+w27Mh7NnZ4JJhEo9dxBwnyBMj8OE0w8ksR+yJTw akNFincA==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFk-009Rml-SV; Tue, 08 Jun 2021 16:06:57 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 15/16] block: use bvec_kmap_local in t10_pi_type1_{prepare,complete} Date: Tue, 8 Jun 2021 18:06:02 +0200 Message-Id: <20210608160603.1535935-16-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig --- block/t10-pi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/block/t10-pi.c b/block/t10-pi.c index d910534b3a41..00c203b2a921 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -147,11 +147,10 @@ static void t10_pi_type1_prepare(struct request *rq) break; bip_for_each_vec(iv, bip, iter) { - void *p, *pmap; unsigned int j; + void *p; - pmap = kmap_atomic(iv.bv_page); - p = pmap + iv.bv_offset; + p = bvec_kmap_local(&iv); for (j = 0; j < iv.bv_len; j += tuple_sz) { struct t10_pi_tuple *pi = p; @@ -161,8 +160,7 @@ static void t10_pi_type1_prepare(struct request *rq) ref_tag++; p += tuple_sz; } - - kunmap_atomic(pmap); + kunmap_local(p); } bip->bip_flags |= BIP_MAPPED_INTEGRITY; @@ -195,11 +193,10 @@ static void t10_pi_type1_complete(struct request *rq, unsigned int nr_bytes) struct bvec_iter iter; bip_for_each_vec(iv, bip, iter) { - void *p, *pmap; unsigned int j; + void *p; - pmap = kmap_atomic(iv.bv_page); - p = pmap + iv.bv_offset; + p = bvec_kmap_local(&iv); for (j = 0; j < iv.bv_len && intervals; j += tuple_sz) { struct t10_pi_tuple *pi = p; @@ -210,8 +207,7 @@ static void t10_pi_type1_complete(struct request *rq, unsigned int nr_bytes) intervals--; p += tuple_sz; } - - kunmap_atomic(pmap); + kunmap_local(p); } } } From patchwork Tue Jun 8 16:06:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12307441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E7E1C47082 for ; Tue, 8 Jun 2021 16:09:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8731661278 for ; Tue, 8 Jun 2021 16:09:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234142AbhFHQK4 (ORCPT ); Tue, 8 Jun 2021 12:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233965AbhFHQJS (ORCPT ); Tue, 8 Jun 2021 12:09:18 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C573BC0611FA; Tue, 8 Jun 2021 09:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=1vl+lJtrWoiUzzKH0COLUmHTJyPccdOEl/SXPdFbHq8=; b=0u+MxU9gFUcqqSv2kfOmfldTkp w7E+5atKEAad8wVEtQr/LZNgxJYK8mzid8YXzoNJss/ueLRaIOdg8Ffi1dL/Gr31d3tFiWQ9zGH02 r8KOpgP6fzxXgSr3Wh6luKs/H3q+6tXlPI0xf+/W0LGq/H8vmX4Aoa51z42VVKK7k0YCZcWxMj1Tt dRbFgmR1NoyJwN2S3vD5Ob9TaDuXkzdV4d2UhmdDO+ZWpixwO5QzrOmmRQRh4pj/bDkEBisgt7Y3t xHTK/IpClwmin7IxY8YmqiMy2IbAOdFj8ljzq94oVX1751YbQwmfnlpOqnpoiDcmi2lZDM5h/0VgG Fle2n2Gw==; Received: from [2001:4bb8:192:ff5f:74ed:7c4f:a5ee:8dcb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqeFo-009Rnc-4u; Tue, 08 Jun 2021 16:07:00 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Thomas Bogendoerfer , Geoff Levand , Ilya Dryomov , Dongsheng Yang , Mike Snitzer , 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 Subject: [PATCH 16/16] block: use bvec_kmap_local in bio_integrity_process Date: Tue, 8 Jun 2021 18:06:03 +0200 Message-Id: <20210608160603.1535935-17-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210608160603.1535935-1-hch@lst.de> References: <20210608160603.1535935-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig --- block/bio-integrity.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4b4eb8964a6f..8f54d49dc500 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -172,18 +172,16 @@ static blk_status_t bio_integrity_process(struct bio *bio, iter.prot_buf = prot_buf; __bio_for_each_segment(bv, bio, bviter, *proc_iter) { - void *kaddr = kmap_atomic(bv.bv_page); + void *kaddr = bvec_kmap_local(&bv); - iter.data_buf = kaddr + bv.bv_offset; + iter.data_buf = kaddr; iter.data_size = bv.bv_len; - ret = proc_fn(&iter); - if (ret) { - kunmap_atomic(kaddr); - return ret; - } + kunmap_local(kaddr); + + if (ret) + break; - kunmap_atomic(kaddr); } return ret; }