On Fri, Sep 15, 2023 at 06:51:02AM -0400, Brian Foster wrote:
> On Thu, Sep 14, 2023 at 03:47:06PM -0400, Kent Overstreet wrote:
> > On Thu, Sep 14, 2023 at 08:56:47AM -0400, Brian Foster wrote:
> > > > +/*
> > > > + * Ugly hack alert:
> > > > + *
> > > > + * We need to cram a spinlock in a single byte, because that's what we 
> > > > have left
> > > > + * in struct bucket, and we care about the size of these - during 
> > > > fsck, we need
> > > > + * in memory state for every single bucket on every device.
> > > > + *
> > > > + * We used to do
> > > > + *   while (xchg(&b->lock, 1) cpu_relax();
> > > > + * but, it turns out not all architectures support xchg on a single 
> > > > byte.
> > > > + *
> > > > + * So now we use bit_spin_lock(), with fun games since we can't burn a 
> > > > whole
> > > > + * ulong for this.
> > > > + */
> > > > +
...

Hi Kent,

So FYI reviewing this prompted me to do some "less common" arch testing
on s390x. bcachefs format currently fails in this environment, which
prompted the couple of related byte ordering patches I've posted (also
susceptible to the problem fixed by this bucket lock patch). The most
recent [1] seems rather closely related to this one as it pertains to
how bit_spin_lock() and friends work in userspace. Still no unspin
locking use case I'm afraid ;P, but curious on your thoughts on that
one..

Brian

[1] 
https://lore.kernel.org/linux-bcachefs/[email protected]/

Reply via email to