From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: extract the parity scrub code into a helper
Date: Thu, 6 Nov 2025 12:16:03 +0100 [thread overview]
Message-ID: <20251106111603.GW13846@twin.jikos.cz> (raw)
In-Reply-To: <a07e2c42e9f29dce1bb50a9b875cf29dfa909afd.1762421429.git.wqu@suse.com>
On Thu, Nov 06, 2025 at 08:02:15PM +1030, Qu Wenruo wrote:
> The function scrub_raid56_parity_stripe() is handling the partity stripe
> by the following steps:
>
> - Scrub each data stripes
> And make sure everything is fine in each data stripe
>
> - Cache the data stripe into the raid bio
>
> - Use the cached raid bio to scrub the target parity stripe
>
> Extract the last two steps into a new helper,
> scrub_radi56_cached_parity(), as a cleanup and make the error handling
> more straightforward.
>
> With the following minor cleanups:
>
> - Use on-stack bio structure
> The bio is always empty thus we do not need any bio vector nor the
> block device. Thus there is no need to allocate a bio, the on-stack
> one is more than enough to cut it.
>
> - Remove the unnecessary btrfs_put_bioc() call if btrfs_map_block()
> failed
> If btrfs_map_block() is failed, @bioc_ret will not be touched thus
> there is no need to call btrfs_put_bioc() in this case.
>
> - Use a proper out: tag to do the cleanup
> Now the error cleanup is much shorter and simpler, just
> btrfs_bio_counter_dec() and bio_uninit().
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> Changelog:
> v2:
> - Rebased to the latest for-next branch
> The latest branch has the memory leak fixed merged, causing a minor
> conflict.
>
> - Remove the DECLARE_COMPLETION_ONSTACK() inside the caller
> Which is no longer utilized.
Reviewed-by: David Sterba <dsterba@suse.com>
prev parent reply other threads:[~2025-11-06 11:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 9:32 [PATCH v2] btrfs: extract the parity scrub code into a helper Qu Wenruo
2025-11-06 11:16 ` David Sterba [this message]
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=20251106111603.GW13846@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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