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);

Reply via email to