From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/2] btrfs: reduce div64 calls for __btrfs_map_block() and its variants
Date: Sun, 5 Feb 2023 16:53:40 +0800 [thread overview]
Message-ID: <cover.1675586554.git.wqu@suse.com> (raw)
Div64 is much slower than 32 bit division, and only get improved in
the most recent CPUs, that's why we have dedicated div64* helpers.
One usage of div64 is in __btrfs_map_block() and its variants, where we
got @stripe_nr as u64, and all later division has to go the div64
helpers.
But the truth is, with our current chunk size limit (10G) and fixed
stripe length (64K), we can have at most 160K stripes in a chunk, which
is small enough for u32 already.
So this patchset would reduce div64 calls by:
- Remove map_lookup::stripe_len first
So now we don't need to call div64 to calculate @stripe_nr, just a
simple right shift, then truncate to u32.
This is a prerequisite for the 2nd patch, without the fixed stripe
length, we have to rely on div64.
- Reduce the width of various @stripe_nr to 32
- Use regular divitsion and module to do the calculation
Now we can get rid of the fear that we missed some div64 helpers.
Qu Wenruo (2):
btrfs: remove map_lookup->stripe_len
btrfs: reduce div64 calls by limiting the number of stripes of a chunk
to u32
fs/btrfs/block-group.c | 18 ++---
fs/btrfs/scrub.c | 43 ++++++------
fs/btrfs/tests/extent-map-tests.c | 1 -
fs/btrfs/tree-checker.c | 14 ++++
fs/btrfs/volumes.c | 110 +++++++++++++++---------------
fs/btrfs/volumes.h | 7 +-
6 files changed, 104 insertions(+), 89 deletions(-)
--
2.39.1
next reply other threads:[~2023-02-05 8:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-05 8:53 Qu Wenruo [this message]
2023-02-05 8:53 ` [PATCH 1/2] btrfs: remove map_lookup->stripe_len Qu Wenruo
2023-02-06 6:39 ` Christoph Hellwig
2023-02-06 8:28 ` Johannes Thumshirn
2023-02-06 8:50 ` Qu Wenruo
2023-02-06 8:56 ` Johannes Thumshirn
2023-02-05 8:53 ` [PATCH 2/2] btrfs: reduce div64 calls by limiting the number of stripes of a chunk to u32 Qu Wenruo
2023-02-05 12:09 ` kernel test robot
2023-02-05 12:20 ` kernel test robot
2023-02-06 6:44 ` Christoph Hellwig
2023-02-06 10:16 ` Qu Wenruo
2023-02-06 6:38 ` [PATCH 0/2] btrfs: reduce div64 calls for __btrfs_map_block() and its variants Christoph Hellwig
2023-02-06 6:58 ` Qu Wenruo
2023-02-06 7:02 ` Christoph Hellwig
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.1675586554.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