mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
To: Yusuf Khan <yusisamerican@gmail.com>, linux-btrfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dsterba@suse.com,
	josef@toxicpanda.com, clm@fb.com
Subject: Re: [PATCH] btrfs: raid56: do blk_check_plugged check twice while writing
Date: Sat, 19 Mar 2022 14:31:49 -0400	[thread overview]
Message-ID: <32eaf406-aca7-a17a-813a-631616480e42@dorminy.me> (raw)
In-Reply-To: <20220319011840.16213-1-yusisamerican@gmail.com>

Hi Yusuf:

On 3/18/22 21:18, Yusuf Khan wrote:
> Do the check to see if the drive was connected twice in case that
> the first was a fluke.

Block plugging is not actually about checking the connectivity of the 
drive; it's about batching IO submission. Specifically, when a client of 
the block layer (a filesystem or DM device, for instance) knows that it 
needs to send a whole batch of IO to disk from a thread, it can request 
the thread's be temporarily delayed, with blk_start_plug() 
(block/blk-core.c has a lengthy great comment about it). Then it submits 
its batch of requests. Finally, it requests the plug be released. This 
is useful because it can allow better IO by releasing a large, 
potentially better ordered batch at once.

In this particular case, to my understanding, blk_check_plug() checks 
whether the current thread is plugged, and, if it is, it adds the rbio 
to a list; when the plug expires, perhaps from the thread going to 
sleep, the plug callback gets called, specifically btrfs_raid_unplug(), 
which sorts the pending IOs.

As such, it shouldn't be necessary to check whether the thread is 
plugged twice. Your change description is a little light on *why* you'd 
like to check twice; maybe I'm missing something.

Hope this helps,

Sweet Tea


      reply	other threads:[~2022-03-19 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19  1:18 Yusuf Khan
2022-03-19 18:31 ` Sweet Tea Dorminy [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=32eaf406-aca7-a17a-813a-631616480e42@dorminy.me \
    --to=sweettea-kernel@dorminy.me \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yusisamerican@gmail.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

all inboxes | Powered by JetHome®