Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1678432

Re: [PATCH v2 3/4] btrfs: Add zstd support

From Adam Borowski <kilobyte@angband.pl>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/4] btrfs: Add zstd support
Date 2017-06-30 05:30 +0200
Message-ID <tXUN3-8mO-9@gated-at.bofh.it> (permalink)
References <tXNBU-3jC-9@gated-at.bofh.it> <tXO4W-3Qo-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <linux/pagemap.h>
 #include <linux/bio.h>
 #include <linux/zstd.h>
+#include <linux/refcount.h>
 #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 };


-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ A dumb species has no way to open a tuna can.
⢿⡄⠘⠷⠚⠋⠀ A smart species invents a can opener.
⠈⠳⣄⠀⠀⠀⠀ A master species delegates.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] Add xxhash and zstd modules Nick Terrell <terrelln@fb.com> - 2017-06-29 21:50 +0200
  [PATCH v2 4/4] squashfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-06-29 22:10 +0200
  [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-06-29 22:20 +0200
    Re: [PATCH v2 3/4] btrfs: Add zstd support Adam Borowski <kilobyte@angband.pl> - 2017-06-30 05:30 +0200
  Re: [PATCH v2 0/4] Add xxhash and zstd modules David Sterba <dsterba@suse.cz> - 2017-06-30 09:40 +0200
  Re: [PATCH v2 0/4] Add xxhash and zstd modules Timofey Titovets <nefelim4ag@gmail.com> - 2017-06-30 18:50 +0200
    Re: [PATCH v2 0/4] Add xxhash and zstd modules Nick Terrell <terrelln@fb.com> - 2017-06-30 22:00 +0200

csiph-web