aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-11-05 12:16:05 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:46 -0400
commitb735d73a00d5d9f5652a299146d518b7eea47b7b (patch)
tree498348ecf29adaada91d6b5b1784aea71f18d923 /fs/bcachefs/fs.c
parentb5e8a6992fb1195cb58cb79461ef50f474c27608 (diff)
bcachefs: Build fixes for 32bit x86
PAGE_SIZE and size_t are not unsigned longs on 32 bit, annoying... also switch to atomic64_cmpxchg instead of cmpxchg() for journal_seq_copy, as atomic64_cmpxchg has a fallback that uses spinlocks for when it's not supported. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs.c')
-rw-r--r--fs/bcachefs/fs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 917a08ddc148..3e3ab4e53f33 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -44,6 +44,11 @@ static void journal_seq_copy(struct bch_fs *c,
struct bch_inode_info *dst,
u64 journal_seq)
{
+ /*
+ * atomic64_cmpxchg has a fallback for archs that don't support it,
+ * cmpxchg does not:
+ */
+ atomic64_t *dst_seq = (void *) &dst->ei_journal_seq;
u64 old, v = READ_ONCE(dst->ei_journal_seq);
do {
@@ -51,7 +56,7 @@ static void journal_seq_copy(struct bch_fs *c,
if (old >= journal_seq)
break;
- } while ((v = cmpxchg(&dst->ei_journal_seq, old, journal_seq)) != old);
+ } while ((v = atomic64_cmpxchg(dst_seq, old, journal_seq)) != old);
bch2_journal_set_has_inum(&c->journal, dst->v.i_ino, journal_seq);
}