On Fri, May 19, 2017 at 03:08:22PM +0200, David Sterba wrote:
> On Thu, May 18, 2017 at 05:42:24PM -0700, Liu Bo wrote:
> > On Tue, May 16, 2017 at 07:10:38PM +0200, David Sterba wrote:
> > > flush_all_writes is an atomic but does not use the semantics at all,
> > > it's just on/off indicator, we can use bool.
> > > 
> > 
> > It might use atomic to avoid reordering, but I'm not sure if
> > reordering could really happen here.
> 
> Ok, I'll have a look. It does not seem to rely on atomics/ordering though.

The semantics of atomic_t to not lose concurrent increment/decrement is
not used here. The variable is always used within the following patterns:

        set to 1
        submit writes
        wait for completion
        set to 0

or

        if set: submit writes

The potential ordering issues, eg. when the worker thread that just
reads the value will not see the value 1 from other thread would need to
keep the state out of sync overal several mutex lock/unlock calls, that
imply a barrier anyway.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to