linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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
@ 2021-09-22  8:27 Qu Wenruo
  2021-09-22  8:27 ` [PATCH RFC 1/3] btrfs: add btrfs_bio::bioc pointer for further modification Qu Wenruo
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Qu Wenruo @ 2021-09-22  8:27 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-10-07 11:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  8:27 [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-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

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).