Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3686367pxj; Tue, 15 Jun 2021 06:34:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8G55l8XSJRgTQDB4Ewp8Gv/ZQIp0OCn4MVNE408QHlAbCaNl7ar9yfQ9kkgrzGK3zxhkX X-Received: by 2002:a17:906:a890:: with SMTP id ha16mr20359066ejb.159.1623764072010; Tue, 15 Jun 2021 06:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623764072; cv=none; d=google.com; s=arc-20160816; b=P0S8VNDyt6aKJN8FIMkGSemLAURnxsEshYEP3L41XaYztLUYUCEUFVv6EA6cEr4PQg T/0eb8hXVmG92p1qi/en/6fx4Ino45lgfswIr/gisQOs44qDZbphesv0PvvOVvD8Vgl7 To8l5AwfS8j6yBs9sewlHofbMYXteU9X2b6LbAC0sZt0LaoxmMX7SA78Vh46gmjGtQqG FczL8Y23gCN7fKal7SUaIU2wqh28uLQh4PbdtCb4Ra7kWoZ++6zlDn9K1/QmIZt3OFHW PXnqNylOaqRjNYcyC5uEK6F4KqxuxqauEXJVFaKkLvcq/N7NCV7zBWpsxlDViXDhWTmD zJ8Q== 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=TkXSf08FOqBmuFw/ENTFMnI+54X5dnYwOAAHKqJCH8E=; b=v4G5L4f14WvmDZFV7b+4d6aulQO7cigEIwabaPoR8o7NYp1OOhOZTHdvQ7FDPhs9Fs 1ceIKO33GG6c1Hl6hlA0Oi39TjNRqMecYKhQ2hbMoPg1BlEtzQhdT9BJ6yYpMjK9HFBo GcvZgy3hMQaofCyVA+koRByYTYCmfuip2qozlWZSegDm8eacpLg4gUebMZ+BeJfiVIyH zZkFldV+G6DD0ks4FyfS03U5GXn/fNYhnXrNkIEccvzlqHe3qRh1FhuJ/YH3iUmUcW7A P2lgTyPmBB39AtgUlQZLn6fcZcJzTOGsKRO7yF2mJGNIs8lJc7k+jzIiNsxUni/a/YNs gRCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CF4bPchC; 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 12si15170530ejm.512.2021.06.15.06.34.08; Tue, 15 Jun 2021 06:34:31 -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=CF4bPchC; 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 S231556AbhFONfQ (ORCPT + 99 others); Tue, 15 Jun 2021 09:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231516AbhFONfE (ORCPT ); Tue, 15 Jun 2021 09:35:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34BB2C06175F; Tue, 15 Jun 2021 06:32:58 -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=TkXSf08FOqBmuFw/ENTFMnI+54X5dnYwOAAHKqJCH8E=; b=CF4bPchCcntLIdgwuA73fSGqoL CPS3fQuYUKaLRCxaRuISI8rYvkunPe3L3qLYZfp8IbIdqrPdOJoLJmMFGMrfNvrDuSd9rrOJ8ticU HOHKToAGKepuk28gNDa8kgIMvi2tGbuE8ETzHYv+aTcJZDuhduC5rtrtg4rQrLko8qFJnhN4UwXSd v7kpTzhxbFjmJ6by+BFkqpc41IdDP4ZfUbVdj9590DWAu2pahuuenl9ejwozavyUUiH2fLWtEfw2t 4VJTnq3h4hHcvfl+KARolYZAc7o2MENvekQO4Nwu0BKdk77cO7vhffP8yoXpIiz27DqkVVb1JBWtl kKD+sNTg==; 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 1lt9AS-006oXq-Ny; Tue, 15 Jun 2021 13:31:51 +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 17/18] block: use bvec_kmap_local in t10_pi_type1_{prepare,complete} Date: Tue, 15 Jun 2021 15:24:55 +0200 Message-Id: <20210615132456.753241-18-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 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); } } } -- 2.30.2