public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] btrfs: introduce btrfs_bio::async_csum
@ 2025-10-29  5:34 Qu Wenruo
  2025-10-29  5:34 ` [PATCH v2 1/7] btrfs: replace BTRFS_MAX_BIO_SECTORS with BIO_MAX_VECS Qu Wenruo
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Qu Wenruo @ 2025-10-29  5:34 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v2:
- Fix a race where csum generation can be completely skipped
  If the lower storage layer advanced the bi_iter before we finished
  calculating the checksum, bio_one_bio() may skip generating csum
  completely.

  Unfortunately to solve this, a new bvec_iter must be introduced and
  cause the size of btrfs_bio to increase.

- Remove btrfs_bio::fs_info by always requireing btrfs_bio::inode
  For scrub, use btree inode instead, and for the only function that
  requires to be called by scrub, btrfs_submit_repair_write(), use
  a new member, btrfs_bio::is_scrub, to check the callers.

- Add a new patch to cleanup the recursive including problems
  The idea is to keep the btrfs headers inside .h files to minimal,
  thus lower risk of recursive including.

- Remove BTRFS_MAX_BIO_SECTORS macro
  It's the same as BIO_MAX_VECS, and only utilized once.

The new async_csum feature will allow btrfs to calculate checksum for
data write bios and submit them in parallel.

This will reduce latency and improve write throughput when data checksum
is utilized.

This will slightly reclaim the performance drop after commit
968f19c5b1b7 ("btrfs: always fallback to buffered write if the inode
requires checksum").

Patch 1 is a minor cleanup to remove a single-used macro.
Patch 2 is a preparation to remove btrfs_bio::fs_info, the core
is to avoid recursive including.
Patch 3 is to remove btrfs_bio::fs_info, as soon we will
increase the size of btrfs_bio by 16 bytes.

Patch 4~6 are preparations to make sure btrfs_bio::end_io() is called in
task context.

Patch 7 enables the async checksum generation for data writes, under
experimental flags.

The series will increase btrfs_bio size by 8 bytes (+16 for the new
structurs, -8 for the removal of btrfs_bio::fs_info).

Since the new async_csum should be better than the csum offload anyway,
we may want to deprecate the csum offload feature completely in the
future.
Thankfully csum offload feature is still behind the experimental flag,
thus it should not affect end users.

Qu Wenruo (7):
  btrfs: replace BTRFS_MAX_BIO_SECTORS with BIO_MAX_VECS
  btrfs: headers cleanup to remove unnecessary local includes
  btrfs: remove btrfs_bio::fs_info by extracting it from
    btrfs_bio::inode
  btrfs: make sure all btrfs_bio::end_io is called in task context
  btrfs: remove btrfs_fs_info::compressed_write_workers
  btrfs: relax btrfs_inode::ordered_tree_lock
  btrfs: introduce btrfs_bio::async_csum

 fs/btrfs/accessors.h    |   1 +
 fs/btrfs/bio.c          | 136 ++++++++++++++++++++++++++--------------
 fs/btrfs/bio.h          |  32 ++++++----
 fs/btrfs/btrfs_inode.h  |   8 +--
 fs/btrfs/compression.c  |  33 +++-------
 fs/btrfs/compression.h  |  13 ++--
 fs/btrfs/ctree.h        |   2 -
 fs/btrfs/defrag.c       |   1 +
 fs/btrfs/dir-item.c     |   1 +
 fs/btrfs/direct-io.c    |   8 +--
 fs/btrfs/disk-io.c      |  10 +--
 fs/btrfs/disk-io.h      |   3 +-
 fs/btrfs/extent-tree.c  |   1 +
 fs/btrfs/extent_io.c    |  27 ++++----
 fs/btrfs/extent_io.h    |   1 -
 fs/btrfs/extent_map.h   |   3 +-
 fs/btrfs/file-item.c    |  64 +++++++++++++------
 fs/btrfs/file-item.h    |   4 +-
 fs/btrfs/fs.h           |   1 -
 fs/btrfs/inode.c        |  12 ++--
 fs/btrfs/ordered-data.c |  57 ++++++++---------
 fs/btrfs/scrub.c        |  49 ++++++++-------
 fs/btrfs/space-info.c   |   1 +
 fs/btrfs/subpage.h      |   1 -
 fs/btrfs/transaction.c  |   2 +
 fs/btrfs/transaction.h  |   4 --
 fs/btrfs/tree-log.c     |   5 +-
 fs/btrfs/tree-log.h     |   3 +-
 fs/btrfs/zoned.c        |   4 +-
 fs/btrfs/zoned.h        |   1 -
 30 files changed, 264 insertions(+), 224 deletions(-)

-- 
2.51.0


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

end of thread, other threads:[~2025-11-13  0:37 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29  5:34 [PATCH v2 0/7] btrfs: introduce btrfs_bio::async_csum Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 1/7] btrfs: replace BTRFS_MAX_BIO_SECTORS with BIO_MAX_VECS Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 2/7] btrfs: headers cleanup to remove unnecessary local includes Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 3/7] btrfs: remove btrfs_bio::fs_info by extracting it from btrfs_bio::inode Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 4/7] btrfs: make sure all btrfs_bio::end_io is called in task context Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 5/7] btrfs: remove btrfs_fs_info::compressed_write_workers Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 6/7] btrfs: relax btrfs_inode::ordered_tree_lock Qu Wenruo
2025-10-29  5:34 ` [PATCH v2 7/7] btrfs: introduce btrfs_bio::async_csum Qu Wenruo
2025-11-10 18:40   ` Daniel Vacek
2025-11-10 21:05     ` Qu Wenruo
2025-11-10 21:45       ` Qu Wenruo
2025-11-11 12:38       ` Daniel Vacek
2025-11-11 20:33         ` Qu Wenruo
2025-11-12 10:46           ` Daniel Vacek
2025-11-12 20:11             ` Qu Wenruo
2025-11-12 21:43               ` Daniel Vacek
2025-11-13  0:21                 ` Qu Wenruo
2025-11-13  0:36                   ` Qu Wenruo
2025-11-11 12:41   ` Daniel Vacek
2025-11-11 20:38     ` Qu Wenruo
2025-11-12  7:12       ` Daniel Vacek
2025-11-04  5:37 ` [PATCH v2 0/7] " David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox