From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/7] btrfs: per-fs compression workspace manager
Date: Thu, 14 Aug 2025 15:03:19 +0930 [thread overview]
Message-ID: <cover.1755148754.git.wqu@suse.com> (raw)
Currently btrfs utilizes the following components at a per-module basis:
- Folios pool
A per-module pool for compressed data.
All folios in the pool are page sized.
- Workspace
A workspace is a compression algorithm specific structure, providing
things like extra memory buffer and compression level handling.
- Workspace manager
The workspace manager is managing the above workspaces for each
algorithm.
All the folio pool/workspaces are using the fixed PAGE_SIZE buffer size,
this is fine for now as even for block size (bs) < page size (ps) cases,
a larger buffer size won't cause huge problems except wasting memories.
However if we're going to support bs > ps, this fixed PAGE_SIZE buffer
and per-module shared folios pool/workspaces will not work at all.
To address this problem, this series will move the workspace and
workspace manager into a per-fs basis, so that different fses (with
different block size) can have their own workspaces.
This brings a small memory usage reduce for bs < ps cases.
Now zlib/lzo/zstd will only allocate buffer using block size.
This is especially useful for lzo compression algorithm, as lzo is an
one-short compression algorithm, it doesn't support multi-shot (aka,
swapping input/output buffer halfway) compress/decompress.
Thus btrfs goes per-block compression for LZO, and compressed result
will never go larger than a block (or btrfs will just give up).
In that case, a 64K page sized buffer will waste 7/8th of the buffer.
This is part 1 of the preparation for btrfs bs > ps support.
Qu Wenruo (7):
btrfs: add an fs_info parameter for compression workspace manager
btrfs: add workspace manager initialization for zstd
btrfs: add generic workspace manager initialization
btrfs: migrate to use per-fs workspace manager
btrfs: cleanup the per-module workspace managers
btrfs: rename btrfs_compress_op to btrfs_compress_levels
btrfs: reduce workspace buffer space to block size
fs/btrfs/compression.c | 186 ++++++++++++++++++++++++-----------------
fs/btrfs/compression.h | 49 +++++------
fs/btrfs/disk-io.c | 4 +
fs/btrfs/fs.h | 13 +++
fs/btrfs/lzo.c | 25 +++---
fs/btrfs/zlib.c | 16 ++--
fs/btrfs/zstd.c | 143 ++++++++++++++++---------------
7 files changed, 248 insertions(+), 188 deletions(-)
--
2.50.1
next reply other threads:[~2025-08-14 5:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 5:33 Qu Wenruo [this message]
2025-08-14 5:33 ` [PATCH 1/7] btrfs: add an fs_info parameter for compression workspace manager Qu Wenruo
2025-08-14 5:33 ` [PATCH 2/7] btrfs: add workspace manager initialization for zstd Qu Wenruo
2025-08-18 15:08 ` David Sterba
2025-08-18 22:14 ` Qu Wenruo
2025-08-14 5:33 ` [PATCH 3/7] btrfs: add generic workspace manager initialization Qu Wenruo
2025-08-18 15:12 ` David Sterba
2025-08-14 5:33 ` [PATCH 4/7] btrfs: migrate to use per-fs workspace manager Qu Wenruo
2025-08-14 5:33 ` [PATCH 5/7] btrfs: cleanup the per-module workspace managers Qu Wenruo
2025-08-14 5:33 ` [PATCH 6/7] btrfs: rename btrfs_compress_op to btrfs_compress_levels Qu Wenruo
2025-08-14 5:33 ` [PATCH 7/7] btrfs: reduce workspace buffer space to block size Qu Wenruo
2025-08-18 15:13 ` [PATCH 0/7] btrfs: per-fs compression workspace manager David Sterba
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=cover.1755148754.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/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