public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] btrfs: btrfs_lookup_bio_sums() related fixes
@ 2020-10-29  7:12 Qu Wenruo
  2020-10-29  7:12 ` [PATCH v2 1/3] btrfs: file-item: use nodesize to determine whether we need readhead for btrfs_lookup_bio_sums() Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Qu Wenruo @ 2020-10-29  7:12 UTC (permalink / raw)
  To: linux-btrfs

This is the final piece to make subpage read/write patchset to pass all
fsstress tests.

Before this 3 patches, there is a very low chance to hit the following
errors:
- False bad data csum error
  The expected csum is alwasy 0x00000000, which should represents
  something.

- WARN_ON_ONCE(count) hit
  Something is definitely wrong in btrfs_lookup_bio_sums().

After more debugging, even on X86_64, there is definitely something to
notice, the most important thing is, the bvec in btrfs_lookup_bio_sums()
is not always in linear bytenr order:

  btrfs_lookup_bio_sums: file_offset=-1 expected_bvec_offset=532480 page_offset=716800 bv_offset=0
  btrfs_lookup_bio_sums: orig_file_offset=520192 bvec_index=3 root=259 ino=260 page_owner_ino=260

This is from x86_64 run, with extra debug info from the
bio_for_each_segment() loop.

It turns out that, bio can be merged as long as their disk_bytenr can be
merged, no need for their page offset to be adjacent.
This means, the file_offset in btrfs_lookup_bio_sums() doesn't make much
sense.

To address the problem, the 3rd patch is introduced to do bio unrelated
csum search.
This does not only simplify the main loop (just one small main loop),
but also free us from the out-of-order bvec problems.

The other two patches are mostly small enhancement found during the
development.

With the patchset, the subpage can survive infinite fsstress
run and the regular page size case can still pass all existing fstests.

Since it has nothing special to subpage at all, and by nature they are
mostly renames and refactor, they can be submitted right now, with or
without subpage patches.

Changelog:
v2:
- Remove the @file_offset parameter completely
- Remove btrfs_find_ordered_sum() completely
- Introduce data reloc inode specific file_offset lookup.

Qu Wenruo (3):
  btrfs: file-item: use nodesize to determine whether we need readhead
    for btrfs_lookup_bio_sums()
  btrfs: file-item: remove the btrfs_find_ordered_sum() call in
    btrfs_lookup_bio_sums()
  btrfs: file-item: refactor btrfs_lookup_bio_sums() to handle
    out-of-order bvecs

 fs/btrfs/compression.c  |   4 +-
 fs/btrfs/ctree.h        |   2 +-
 fs/btrfs/file-item.c    | 274 ++++++++++++++++++++++++++--------------
 fs/btrfs/inode.c        |   5 +-
 fs/btrfs/ordered-data.c |  46 -------
 fs/btrfs/ordered-data.h |   2 -
 6 files changed, 185 insertions(+), 148 deletions(-)

-- 
2.29.1


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

end of thread, other threads:[~2020-10-29 23:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-29  7:12 [PATCH v2 0/3] btrfs: btrfs_lookup_bio_sums() related fixes Qu Wenruo
2020-10-29  7:12 ` [PATCH v2 1/3] btrfs: file-item: use nodesize to determine whether we need readhead for btrfs_lookup_bio_sums() Qu Wenruo
2020-10-29 18:57   ` Josef Bacik
2020-10-29 23:57     ` Qu Wenruo
2020-10-29  7:12 ` [PATCH v2 2/3] btrfs: file-item: remove the btrfs_find_ordered_sum() call in btrfs_lookup_bio_sums() Qu Wenruo
2020-10-29  7:47   ` Nikolay Borisov
2020-10-29  7:53     ` Qu Wenruo
2020-10-29 18:51   ` Josef Bacik
2020-10-29  7:12 ` [PATCH v2 3/3] btrfs: file-item: refactor btrfs_lookup_bio_sums() to handle out-of-order bvecs Qu Wenruo
2020-10-29 11:50   ` Nikolay Borisov
2020-10-29 12:43     ` Qu Wenruo
2020-10-29 13:54       ` David Sterba
2020-10-29 14:11         ` Qu Wenruo

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