Re: Device loses barrier support (was: Fixed patch for simple barriers.)

Andi Kleen
2008-12-04T17:43:47Z

On Thu, Dec 04, 2008 at 11:45:44AM -0500, Mikulas Patocka wrote:
> > No there is nothing unordered. The file system path typically looks like
> >
> > commit of a transaction
> > if (i have never seen a barrier failing)
> > write block with barrier
> > if (EOPNOTSUPP) {
> > record failure
> > submit synchronously
> > }
> > } else
> > submit synchronously
> >
>
> If you view this as a "right" way of using barriers, then you can drop

It's the way the file systems do it. If you don't believe me feel
free to read the code for yourself.

> barrier support at all and replace this code sequence with:
>
> flush disk cache
> submit write synchronously
> flush disk cache
>
> --- because synchronous barriers bring you no performance advantage over
> the above sequence.

Remember this is done by a commit thread in a journaling file system.
Commits are ordered so the thread cannot really order out of order
anyways. And yes the barriers are essentially a way to flush the cache
regularly for selected commits. The alternative (if you
want to guarantee transaction order) would be to disable
the write cache completely and do it synchronous on each IO.

>
> > So if a pvmove barrier fails it will just submit synchronously.
> >
> > The write block with barrier bit varies, jbd/gfs2 do it synchronously
> > too and xfs does it asynchronously (with io done callbacks), but
>
> And how does xfs preserve write ordering, if the barrier asynchronously
> fails with -EOPNOTSUPP and there are other writes submitted after the
> barrier?

>From the high level journaling perspective they are not asynchronous
I think. Just the low level xfs_buf interface happens to use the asynchronous
callbacks instead of calling into the block layer directly like jbd et.al.
do.

-Andi