From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH RFC 0/3] btrfs: refactor how we handle btrfs_io_context and slightly reduce memory usage for both btrfs_bio and btrfs_io_context
Date: Wed, 22 Sep 2021 16:27:03 +0800 [thread overview]
Message-ID: <20210922082706.55650-1-wqu@suse.com> (raw)
Currently btrfs_io_context is utilized as both bio->bi_private for
mirrored stripes, and stripes mapping for RAID56.
This makes some members like btrfs_io_context::private to be there.
But in fact, since almost all bios in btrfs have btrfs_bio structure
appended, we don't really need to reuse bio::bi_private for mirrored
profiles.
So this patchset will:
- Introduce btrfs_bio::bioc member
So that btrfs_io_context don't need to hold @private.
This modification is still a net increase for memory usage, just
a trade-off between btrfs_io_context and btrfs_bio.
- Replace btrfs_bio::device with btrfs_bio::stripe_num
This reclaim the memory usage increase for btrfs_bio.
But unfortunately, due to the short life time of btrfs_io_context,
we don't have as good device status accounting as the old code.
Now for csum error, we can no longer distinguish source and target
device of dev-replace.
This is the biggest blockage, and that's why it's RFC.
The result of the patchset is:
btrfs_bio: size: 240 -> 240
btrfs_io_context: size: 88 -> 80
Although to really reduce btrfs_bio, the main target should be
csum_inline.
Qu Wenruo (3):
btrfs: add btrfs_bio::bioc pointer for further modification
btrfs: remove redundant parameters for submit_stripe_bio()
btrfs: replace btrfs_bio::device member with stripe_num
fs/btrfs/compression.c | 6 ++----
fs/btrfs/ctree.h | 2 ++
fs/btrfs/extent_io.c | 2 --
fs/btrfs/inode.c | 30 +++++++++++++++++++++++++++---
fs/btrfs/raid56.c | 1 -
fs/btrfs/volumes.c | 23 +++++++++++++----------
fs/btrfs/volumes.h | 11 ++++++++---
7 files changed, 52 insertions(+), 23 deletions(-)
--
2.33.0
next reply other threads:[~2021-09-22 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 8:27 Qu Wenruo [this message]
2021-09-22 8:27 ` [PATCH RFC 1/3] btrfs: add btrfs_bio::bioc pointer for further modification Qu Wenruo
2021-09-22 8:27 ` [PATCH RFC 2/3] btrfs: remove redundant parameters for submit_stripe_bio() Qu Wenruo
2021-09-22 8:27 ` [PATCH RFC 3/3] btrfs: replace btrfs_bio::device member with stripe_num Qu Wenruo
2021-09-22 9:57 ` [PATCH RFC 0/3] btrfs: refactor how we handle btrfs_io_context and slightly reduce memory usage for both btrfs_bio and btrfs_io_context Qu Wenruo
2021-10-06 19:38 ` David Sterba
2021-10-07 2:24 ` Qu Wenruo
2021-10-07 11:04 ` 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=20210922082706.55650-1-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