From patchwork Fri Jun 30 03:24:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Borowski X-Patchwork-Id: 9818345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB85260224 for ; Fri, 30 Jun 2017 03:25:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A91F285A5 for ; Fri, 30 Jun 2017 03:25:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DD55285B3; Fri, 30 Jun 2017 03:25:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15F25285A5 for ; Fri, 30 Jun 2017 03:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751976AbdF3DYv (ORCPT ); Thu, 29 Jun 2017 23:24:51 -0400 Received: from tartarus.angband.pl ([89.206.35.136]:41979 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbdF3DYv (ORCPT ); Thu, 29 Jun 2017 23:24:51 -0400 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.89) (envelope-from ) id 1dQmXz-0007qN-Hi; Fri, 30 Jun 2017 05:24:43 +0200 Date: Fri, 30 Jun 2017 05:24:43 +0200 From: Adam Borowski To: Nick Terrell Cc: kernel-team@fb.com, Chris Mason , Yann Collet , David Sterba , squashfs-devel@lists.sourceforge.net, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] btrfs: Add zstd support Message-ID: <20170630032443.nji7n5kwk7bxopzp@angband.pl> References: <20170629194108.1674498-1-terrelln@fb.com> <20170629194108.1674498-4-terrelln@fb.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170629194108.1674498-4-terrelln@fb.com> X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jun 29, 2017 at 12:41:07PM -0700, Nick Terrell wrote: > Add zstd compression and decompression support to BtrFS. zstd at its > fastest level compresses almost as well as zlib, while offering much > faster compression and decompression, approaching lzo speeds. > +static int zstd_decompress_bio(struct list_head *ws, struct page **pages_in, > + u64 disk_start, > + struct bio *orig_bio, > + size_t srclen) Note that this fails to build if e1ddce71 is applied, and it'll be in mainline in just a few days from now. Fixing that is obvious, but to avoid duplicating the effort: diff --git a/fs/btrfs/zstd.c b/fs/btrfs/zstd.c index 838741b3732c..e9403e569d8e 100644 --- a/fs/btrfs/zstd.c +++ b/fs/btrfs/zstd.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "compression.h" #define ZSTD_BTRFS_MAX_WINDOWLOG 17 @@ -262,17 +263,18 @@ static int zstd_compress_pages(struct list_head *ws, return ret; } -static int zstd_decompress_bio(struct list_head *ws, struct page **pages_in, - u64 disk_start, - struct bio *orig_bio, - size_t srclen) +static int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb) { struct workspace *workspace = list_entry(ws, struct workspace, list); ZSTD_DStream *stream; int ret = 0; unsigned long page_in_index = 0; + size_t srclen = cb->compressed_len; unsigned long total_pages_in = DIV_ROUND_UP(srclen, PAGE_SIZE); unsigned long buf_start; + struct page **pages_in = cb->compressed_pages; + u64 disk_start = cb->start; + struct bio *orig_bio = cb->orig_bio; unsigned long total_out = 0; ZSTD_inBuffer in_buf = { NULL, 0, 0 }; ZSTD_outBuffer out_buf = { NULL, 0, 0 };