lkml.org 
[lkml]   [2022]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] btrfs: raid56: do blk_check_plugged check twice while writing
From
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

\
 
 \ /
  Last update: 2022-03-19 19:32    [W:0.038 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site