All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/8] btrfs: cleanup scrub_rbio
Date: Wed, 14 Dec 2022 07:32:00 +0800	[thread overview]
Message-ID: <d4124214-f09b-5089-38c8-47f29a07b7d5@gmx.com> (raw)
In-Reply-To: <20221213132433.GA21430@lst.de>



On 2022/12/13 21:24, Christoph Hellwig wrote:
> On Tue, Dec 13, 2022 at 04:53:33PM +0800, Qu Wenruo wrote:
>>>      	ret = scrub_assemble_read_bios(rbio, &bio_list);
>>>    	if (ret < 0)
>>> -		goto cleanup;
>>> +		return ret;
>>>      	submit_read_bios(rbio, &bio_list);
>>>    	wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
>>>      	/* We may have some failures, recover the failed sectors first. */
>>>    	ret = recover_scrub_rbio(rbio);
>>> -	if (ret < 0)
>>> -		goto cleanup;
>>> +	if (ret < 0) {
>>> +		while ((bio = bio_list_pop(&bio_list)))
>>> +			bio_put(bio);
>>> +		return ret;
>>> +	}
>>
>> Do we still need the cleanup? IIRC after submit_read_bios() (or be more
>> safe, after wait_event()), we should no longer touch @bio_list anymore.
> 
> Oh, true.  submit_read_bios does the list_pop, so we don't need
> this here, and in recover_rbio either.  And looking at it a little more
> I think the are could use even more cleanup by:
> 
>   - moving the wait_event for stripes_pending into submit_read_bios.
>   - moving the submit_read_bios *_assemble_read_bios and stop passing
>     the bio_list entirely, which removes all the confusion about
>     who cleans it up.
> 
> What do you think of this series (still needs testing before I can
> post it):
> 
> http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/btrfs-raid56-cleanups

The code change all looks good, I'd just prefer some naming changes.

One personal thing is, I'd prefer "_wait_" for functions that may wait 
for IOs. Thus submit_read_bios() may be better renamed to 
submit_read_wait_bios().
(bios means it still directly handle a bio list, or just 
submit_read_wait_bio_list()?)

Another changes is, since there is no bio_list out of the 
<work>_read_bios(), the "bios" naming can be removed.
Something like <work>_read_wait() may be a little better.

Thanks,
Qu

  reply	other threads:[~2022-12-13 23:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  8:41 small raid56 cleanups v2 Christoph Hellwig
2022-12-13  8:41 ` [PATCH 1/8] btrfs: cleanup raid56_parity_write Christoph Hellwig
2022-12-13  8:41 ` [PATCH 2/8] btrfs: cleanup rmw_rbio Christoph Hellwig
2022-12-13  8:41 ` [PATCH 3/8] btrfs: cleanup rmw_read_wait_recover Christoph Hellwig
2022-12-13  8:41 ` [PATCH 4/8] btrfs: cleanup recover_rbio Christoph Hellwig
2022-12-13  8:50   ` Qu Wenruo
2022-12-13  8:41 ` [PATCH 5/8] btrfs: cleanup scrub_rbio Christoph Hellwig
2022-12-13  8:53   ` Qu Wenruo
2022-12-13 13:24     ` Christoph Hellwig
2022-12-13 23:32       ` Qu Wenruo [this message]
2022-12-14 16:45         ` Christoph Hellwig
2022-12-13  8:41 ` [PATCH 6/8] btrfs: call rbio_orig_end_io from rmw_rbio Christoph Hellwig
2022-12-13  8:54   ` Qu Wenruo
2022-12-13  8:41 ` [PATCH 7/8] btrfs: call rbio_orig_end_io from recover_rbio Christoph Hellwig
2022-12-13  8:54   ` Qu Wenruo
2022-12-13  8:41 ` [PATCH 8/8] btrfs: call rbio_orig_end_io from scrub_rbio Christoph Hellwig
2022-12-13  8:55   ` Qu Wenruo
2022-12-13  8:59 ` small raid56 cleanups v2 Qu Wenruo
2022-12-13 13:25   ` 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=d4124214-f09b-5089-38c8-47f29a07b7d5@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 \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.