From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@lst.de>, Chris Mason <clm@fb.com>,
Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/6] btrfs: optimize simple reads in btrfsic_map_block
Date: Wed, 31 May 2023 16:47:41 +0800 [thread overview]
Message-ID: <6997cf68-8775-f518-9b7d-2dbc15b5ce58@gmx.com> (raw)
In-Reply-To: <20230531041740.375963-3-hch@lst.de>
On 2023/5/31 12:17, Christoph Hellwig wrote:
> Pass a smap into __btrfs_map_block so that the usual case of a read that
> doesn't require parity raid recovery doesn't need an extra memory
> allocation for the btrfs_io_context.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
I'm more curious on whether the check-integrity feature is still under
heavy usage.
It's from old time where we don't have a lot of sanity checks, but
nowadays it looks less worthy and can cause extra burden to maintain.
Thanks,
Qu
> ---
> fs/btrfs/check-integrity.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index b4408037b823c5..fe15367000141a 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -1459,13 +1459,13 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
> struct btrfs_fs_info *fs_info = state->fs_info;
> int ret;
> u64 length;
> - struct btrfs_io_context *multi = NULL;
> + struct btrfs_io_context *bioc = NULL;
> + struct btrfs_io_stripe smap, *map;
> struct btrfs_device *device;
>
> length = len;
> - ret = btrfs_map_block(fs_info, BTRFS_MAP_READ,
> - bytenr, &length, &multi, mirror_num);
> -
> + ret = __btrfs_map_block(fs_info, BTRFS_MAP_READ, bytenr, &length, &bioc,
> + NULL, &mirror_num, 0);
> if (ret) {
> block_ctx_out->start = 0;
> block_ctx_out->dev_bytenr = 0;
> @@ -1478,21 +1478,26 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
> return ret;
> }
>
> - device = multi->stripes[0].dev;
> + if (bioc)
> + map = &bioc->stripes[0];
> + else
> + map = &smap;
> +
> + device = map->dev;
> if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state) ||
> !device->bdev || !device->name)
> block_ctx_out->dev = NULL;
> else
> block_ctx_out->dev = btrfsic_dev_state_lookup(
> device->bdev->bd_dev);
> - block_ctx_out->dev_bytenr = multi->stripes[0].physical;
> + block_ctx_out->dev_bytenr = map->physical;
> block_ctx_out->start = bytenr;
> block_ctx_out->len = len;
> block_ctx_out->datav = NULL;
> block_ctx_out->pagev = NULL;
> block_ctx_out->mem_to_free = NULL;
>
> - kfree(multi);
> + kfree(bioc);
> if (NULL == block_ctx_out->dev) {
> ret = -ENXIO;
> pr_info("btrfsic: error, cannot lookup dev (#1)!\n");
next prev parent reply other threads:[~2023-05-31 8:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 4:17 cleanup the btrfs_map_block interface Christoph Hellwig
2023-05-31 4:17 ` [PATCH 1/6] btrfs: remove BTRFS_MAP_DISCARD Christoph Hellwig
2023-05-31 8:45 ` Qu Wenruo
2023-05-31 4:17 ` [PATCH 2/6] btrfs: optimize simple reads in btrfsic_map_block Christoph Hellwig
2023-05-31 8:47 ` Qu Wenruo [this message]
2023-05-31 12:31 ` Johannes Thumshirn
2023-05-31 12:35 ` Christoph Hellwig
2023-05-31 12:46 ` Johannes Thumshirn
2023-05-31 4:17 ` [PATCH 3/6] btrfs: remove btrfs_map_block Christoph Hellwig
2023-05-31 8:48 ` Qu Wenruo
2023-05-31 4:17 ` [PATCH 4/6] btrfs: rename __btrfs_map_block to btrfs_map_block Christoph Hellwig
2023-05-31 8:48 ` Qu Wenruo
2023-05-31 4:17 ` [PATCH 5/6] btrfs: remove btrfs_map_sblock Christoph Hellwig
2023-05-31 8:49 ` Qu Wenruo
2023-05-31 4:17 ` [PATCH 6/6] btrfs: remove need_full_stripe Christoph Hellwig
2023-05-31 8:52 ` Qu Wenruo
2023-05-31 12:37 ` Christoph Hellwig
2023-05-31 12:35 ` cleanup the btrfs_map_block interface Johannes Thumshirn
2023-05-31 23:38 ` 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=6997cf68-8775-f518-9b7d-2dbc15b5ce58@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=josef@toxicpanda.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