Re: bio re-ordering

From: Andriy Gapon <>
Date: Wed, 02 Feb 2022 09:05:17 UTC
On 02/02/2022 09:58, Warner Losh wrote:
> On Wed, Feb 2, 2022, 12:49 AM Peter Jeremy < 
> <>> wrote:
>     Thanks all for the very prompt responses.
>     On 2022-Jan-28 22:32:02 -0700, Warner Losh <
>     <>> wrote:
>      >I think that ufs relies on two ordering primitives, both marked with
>      >BIO_ORDERED today.
>      >That's what most of the drivers key off of. We always set BIO_ORDERED on
>      >all the BIO_FLUSH
>      >events as far as I Can tell.
>     Thanks for that warning.  I don't think geom_gate understands either
>     B_BARRIER or BIO_ORDERED.  I shall have a closer look.
> It needs to understand BIO_ORDERED.
>      >to it. b*barrierwrite() sets this, and that's used in the ffs_alloc code.
>     In my case, I'm interested in ZFS, rather than UFS and it doesn't seem
>     to set B_BARRIER or BIO_ORDERED or indirectly.
> I went hunting ZFS for this year's ago and in the pre OpenZFS code they were 
> used, but there were three layers of indirection that obscured it. ZFS doesn't 
> use the buffer cache, so B_BARRIER isn't relevant. I'll see if I can find it 
> with the new code.
> But if it never sets BIO_ORDERED, drivers are already reordering things. That's 
> all any other driver in the tree worries about...

Hmm... it looks like both the old and new (Open)ZFS use BIO_FLUSH command 
without BIO_ORDERED flag.  Not sure if it happens to do the right thing anyway 
or not.

Andriy Gapon