Commit b735d73a authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent b5e8a699
......@@ -1586,7 +1586,7 @@ void bch2_stripes_heap_to_text(struct printbuf *out, struct bch_fs *c)
size_t i;
spin_lock(&c->ec_stripes_heap_lock);
for (i = 0; i < min(h->used, 20UL); i++) {
for (i = 0; i < min_t(size_t, h->used, 20); i++) {
m = genradix_ptr(&c->stripes[0], h->data[i].idx);
pr_buf(out, "%zu %u/%u+%u\n", h->data[i].idx,
......
......@@ -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);
}
......
......@@ -180,7 +180,7 @@ void bch2_bio_alloc_pages_pool(struct bch_fs *c, struct bio *bio,
while (size) {
struct page *page = __bio_alloc_page_pool(c, &using_mempool);
unsigned len = min(PAGE_SIZE, size);
unsigned len = min_t(size_t, PAGE_SIZE, size);
BUG_ON(!bio_add_page(bio, page, len, 0));
size -= len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment