From: David Sterba <dsterba@suse.cz>
To: Nick Terrell <terrelln@fb.com>
Cc: kernel-team@fb.com, Chris Mason <clm@fb.com>,
Yann Collet <cyan@fb.com>, Adam Borowski <kilobyte@angband.pl>,
David Sterba <dsterba@suse.cz>,
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
Date: Tue, 18 Jul 2017 20:21:11 +0200 [thread overview]
Message-ID: <20170718182111.GA2866@twin.jikos.cz> (raw)
In-Reply-To: <20170629194108.1674498-4-terrelln@fb.com>
On Thu, Jun 29, 2017 at 12:41:07PM -0700, Nick Terrell wrote:
> +static void zstd_free_workspace(struct list_head *ws)
> +{
> + struct workspace *workspace = list_entry(ws, struct workspace, list);
> +
> + vfree(workspace->mem);
> + kfree(workspace->buf);
> + kfree(workspace);
> +}
> +
> +static struct list_head *zstd_alloc_workspace(void)
> +{
> + ZSTD_parameters params =
> + zstd_get_btrfs_parameters(ZSTD_BTRFS_MAX_INPUT);
> + struct workspace *workspace;
> +
> + workspace = kzalloc(sizeof(*workspace), GFP_NOFS);
> + if (!workspace)
> + return ERR_PTR(-ENOMEM);
> +
> + workspace->size = max_t(size_t,
> + ZSTD_CStreamWorkspaceBound(params.cParams),
> + ZSTD_DStreamWorkspaceBound(ZSTD_BTRFS_MAX_INPUT));
> + workspace->mem = vmalloc(workspace->size);
> + workspace->buf = kmalloc(PAGE_SIZE, GFP_NOFS);
> + if (!workspace->mem || !workspace->buf)
> + goto fail;
> +
> + INIT_LIST_HEAD(&workspace->list);
> +
> + return &workspace->list;
> +fail:
> + zstd_free_workspace(&workspace->list);
> + return ERR_PTR(-ENOMEM);
> +}
In the next iteration, please update the workspace allocations so that
they use kvmalloc/kvfree and GFP_KERNEL (eg. 6acafd1eff426).
next prev parent reply other threads:[~2017-07-18 18:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 19:41 [PATCH v2 0/4] Add xxhash and zstd modules Nick Terrell
2017-06-29 19:41 ` [PATCH v2 1/4] lib: Add xxhash module Nick Terrell
2017-06-29 19:41 ` [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell
2017-06-30 3:24 ` Adam Borowski
2017-06-30 12:16 ` E V
2017-06-30 14:21 ` David Sterba
2017-06-30 18:25 ` Austin S. Hemmelgarn
2017-06-30 23:01 ` Nick Terrell
2017-07-05 11:43 ` Austin S. Hemmelgarn
2017-07-05 18:18 ` Adam Borowski
2017-07-05 18:45 ` Austin S. Hemmelgarn
2017-07-05 19:35 ` Nick Terrell
2017-07-05 19:57 ` Austin S. Hemmelgarn
2017-07-06 0:25 ` Nick Terrell
2017-07-06 11:59 ` Austin S. Hemmelgarn
2017-07-06 12:09 ` Lionel Bouton
2017-07-06 12:27 ` Austin S. Hemmelgarn
2017-07-10 21:11 ` Clemens Eisserer
2017-07-06 16:32 ` Adam Borowski
2017-07-07 23:17 ` Nick Terrell
2017-07-07 23:40 ` Adam Borowski
2017-07-08 3:07 ` Adam Borowski
2017-07-10 12:36 ` Austin S. Hemmelgarn
2017-07-10 20:57 ` Nick Terrell
2017-07-11 4:57 ` Nick Terrell
2017-07-11 6:01 ` Nick Terrell
2017-07-12 3:38 ` Adam Borowski
2017-07-18 18:21 ` David Sterba [this message]
2017-06-29 19:41 ` [PATCH v2 4/4] squashfs: " Nick Terrell
2017-06-30 7:36 ` [PATCH v2 0/4] Add xxhash and zstd modules David Sterba
2017-06-30 16:46 ` Timofey Titovets
2017-06-30 19:52 ` Nick Terrell
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=20170718182111.GA2866@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=cyan@fb.com \
--cc=kernel-team@fb.com \
--cc=kilobyte@angband.pl \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=squashfs-devel@lists.sourceforge.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).