From: Omar Sandoval <osandov@osandov.com>
To: Nick Terrell <terrelln@fb.com>
Cc: kernel-team@fb.com, Omar Sandoval <osandov@fb.com>,
linux-btrfs@vger.kernel.org, Jennifer Liu <jenniferliu620@fb.com>
Subject: Re: [PATCH] btrfs: add zstd compression level support
Date: Tue, 30 Oct 2018 14:40:32 -0700 [thread overview]
Message-ID: <20181030214032.GA31980@vader> (raw)
In-Reply-To: <20181030190621.716013-1-terrelln@fb.com>
On Tue, Oct 30, 2018 at 12:06:21PM -0700, Nick Terrell wrote:
> From: Jennifer Liu <jenniferliu620@fb.com>
>
> Adds zstd compression level support to btrfs. Zstd requires
> different amounts of memory for each level, so the design had
> to be modified to allow set_level() to allocate memory. We
> preallocate one workspace of the maximum size to guarantee
> forward progress. This feature is expected to be useful for
> read-mostly filesystems, or when creating images.
>
> Benchmarks run in qemu on Intel x86 with a single core.
> The benchmark measures the time to copy the Silesia corpus [0] to
> a btrfs filesystem 10 times, then read it back.
>
> The two important things to note are:
> - The decompression speed and memory remains constant.
> The memory required to decompress is the same as level 1.
> - The compression speed and ratio will vary based on the source.
>
> Level Ratio Compression Decompression Compression Memory
> 1 2.59 153 MB/s 112 MB/s 0.8 MB
> 2 2.67 136 MB/s 113 MB/s 1.0 MB
> 3 2.72 106 MB/s 115 MB/s 1.3 MB
> 4 2.78 86 MB/s 109 MB/s 0.9 MB
> 5 2.83 69 MB/s 109 MB/s 1.4 MB
> 6 2.89 53 MB/s 110 MB/s 1.5 MB
> 7 2.91 40 MB/s 112 MB/s 1.4 MB
> 8 2.92 34 MB/s 110 MB/s 1.8 MB
> 9 2.93 27 MB/s 109 MB/s 1.8 MB
> 10 2.94 22 MB/s 109 MB/s 1.8 MB
> 11 2.95 17 MB/s 114 MB/s 1.8 MB
> 12 2.95 13 MB/s 113 MB/s 1.8 MB
> 13 2.95 10 MB/s 111 MB/s 2.3 MB
> 14 2.99 7 MB/s 110 MB/s 2.6 MB
> 15 3.03 6 MB/s 110 MB/s 2.6 MB
>
> [0] http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
Reviewed-by: Omar Sandoval <osandov@fb.com>
> Signed-off-by: Jennifer Liu <jenniferliu620@fb.com>
> Signed-off-by: Nick Terrell <terrelln@fb.com>
> ---
> fs/btrfs/compression.c | 172 +++++++++++++++++++++++++----------------
> fs/btrfs/compression.h | 18 +++--
> fs/btrfs/lzo.c | 5 +-
> fs/btrfs/super.c | 7 +-
> fs/btrfs/zlib.c | 33 ++++----
> fs/btrfs/zstd.c | 74 ++++++++++++++----
> 6 files changed, 204 insertions(+), 105 deletions(-)
>
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 2955a4ea2fa8..bd8e69381dc9 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -822,11 +822,15 @@ void __init btrfs_init_compress(void)
>
> /*
> * Preallocate one workspace for each compression type so
> - * we can guarantee forward progress in the worst case
> + * we can guarantee forward progress in the worst case.
> + * Provide the maximum compression level to guarantee large
> + * enough workspace.
> */
> - workspace = btrfs_compress_op[i]->alloc_workspace();
> + workspace = btrfs_compress_op[i]->alloc_workspace(
> + btrfs_compress_op[i]->max_level);
> if (IS_ERR(workspace)) {
> - pr_warn("BTRFS: cannot preallocate compression workspace, will try later\n");
> + pr_warn("BTRFS: cannot preallocate compression "
> + "workspace, will try later\n");
Nit: since you didn't change this line, don't rewrap it.
prev parent reply other threads:[~2018-10-30 21:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 19:06 [PATCH] btrfs: add zstd compression level support Nick Terrell
2018-10-30 21:40 ` Omar Sandoval [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181030214032.GA31980@vader \
--to=osandov@osandov.com \
--cc=jenniferliu620@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=osandov@fb.com \
--cc=terrelln@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.