From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT 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 3B554C04AB5 for ; Mon, 3 Jun 2019 16:49:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0FFF827410 for ; Mon, 3 Jun 2019 16:49:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbfFCQto (ORCPT ); Mon, 3 Jun 2019 12:49:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:55688 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725974AbfFCQto (ORCPT ); Mon, 3 Jun 2019 12:49:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7CE5EAF1B; Mon, 3 Jun 2019 16:49:43 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 7EC09DA85E; Mon, 3 Jun 2019 18:50:35 +0200 (CEST) Date: Mon, 3 Jun 2019 18:50:34 +0200 From: David Sterba To: Johannes Thumshirn Cc: David Sterba , Linux BTRFS Mailinglist , Chris Mason , Richard Weinberger , David Gstir , Nikolay Borisov Subject: Re: [PATCH v4 11/13] btrfs: directly call into crypto framework for checsumming Message-ID: <20190603165034.GR15290@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Johannes Thumshirn , David Sterba , Linux BTRFS Mailinglist , Chris Mason , Richard Weinberger , David Gstir , Nikolay Borisov References: <20190603145859.7176-1-jthumshirn@suse.de> <20190603145859.7176-12-jthumshirn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190603145859.7176-12-jthumshirn@suse.de> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Jun 03, 2019 at 04:58:57PM +0200, Johannes Thumshirn wrote: > + crypto_shash_init(shash); > > kaddr = kmap_atomic(page); > - csum = btrfs_csum_data(kaddr, csum, PAGE_SIZE); > - btrfs_csum_final(csum, (u8 *)&csum); > + crypto_shash_update(shash, kaddr, PAGE_SIZE); > + crypto_shash_final(shash, (u8 *)&csum); > kunmap_atomic(kaddr); I've noticed the code below doing the kmap/hash/kunmap places the mapping just around the update phase so I reordered it in this function too like: crypto_shash_init(shash); kaddr = kmap_atomic(page); crypto_shash_update(shash, kaddr, PAGE_SIZE); kunmap_atomic(kaddr); crypto_shash_final(shash, (u8 *)&csum);