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

From: Andi Kleen
Date: Thu Dec 04 2008 - 12:43:48 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/