From: Li Nan <linan666@huaweicloud.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: song@kernel.org, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, yukuai3@huawei.com,
yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH] md: make md_flush_request() more readable
Date: Tue, 28 May 2024 10:06:16 +0800 [thread overview]
Message-ID: <143ec153-fe71-7a03-a10a-589ecd63eb71@huaweicloud.com> (raw)
In-Reply-To: <ZlL4rxKqcV5ePLXu@infradead.org>
在 2024/5/26 16:54, Christoph Hellwig 写道:
> On Sun, May 26, 2024 at 02:56:22AM +0800, linan666@huaweicloud.com wrote:
>> - bio = NULL;
>> - }
>> - spin_unlock_irq(&mddev->lock);
>> -
>> - if (!bio) {
>> + spin_unlock_irq(&mddev->lock);
>> INIT_WORK(&mddev->flush_work, submit_flushes);
>> queue_work(md_wq, &mddev->flush_work);
>> } else {
>> /* flush was performed for some other bio while we waited. */
>> + spin_unlock_irq(&mddev->lock);
>> if (bio->bi_iter.bi_size == 0)
>> /* an empty barrier - all done */
>
> This stil looks like a somwwhat odd flow Why not go all the way
> and turn it into:
>
>
> ...
> queue_work(md_wq, &mddev->flush_work);
> return true;
> }
>
> /* flush was performed for some other bio while we waited. */
> spin_unlock_irq(&mddev->lock);
> if (bio->bi_iter.bi_size == 0) {
> /* pure flush without data - all done */
> bio_endio(bio);
> return true;
> }
> bio->bi_opf &= ~REQ_PREFLUSH;
> return false;
> }
Yeah, it looks better. I will changed it in v2.
Thansk for your suggestion.
--
Thanks,
Nan
prev parent reply other threads:[~2024-05-28 2:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 18:56 [PATCH] md: make md_flush_request() more readable linan666
2024-05-26 8:54 ` Christoph Hellwig
2024-05-28 2:06 ` Li Nan [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=143ec153-fe71-7a03-a10a-589ecd63eb71@huaweicloud.com \
--to=linan666@huaweicloud.com \
--cc=hch@infradead.org \
--cc=houtao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.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;
as well as URLs for NNTP newsgroup(s).