From: Brian Foster <bfoster@redhat.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org
Subject: Re: [PATCH] bcachefs: Change bucket_lock() to use bit_spin_lock()
Date: Tue, 19 Sep 2023 10:31:38 -0400 [thread overview]
Message-ID: <ZQmwymI1SfIyouFM@bfoster> (raw)
In-Reply-To: <ZQQ3Fo3PWwWphcmz@bfoster>
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/20230919142611.36445-1-bfoster@redhat.com/
prev parent reply other threads:[~2023-09-19 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 0:37 [PATCH] bcachefs: Change bucket_lock() to use bit_spin_lock() Kent Overstreet
2023-09-14 12:56 ` Brian Foster
2023-09-14 19:47 ` Kent Overstreet
2023-09-15 10:51 ` Brian Foster
2023-09-19 14:31 ` Brian Foster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZQmwymI1SfIyouFM@bfoster \
--to=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox