Skip to content

Commit

Permalink
bcachefs: Don't pass memcmp() as a pointer
Browse files Browse the repository at this point in the history
commit 0124f42 upstream.

Some (buggy!) compilers have issues with this.

Fixes: koverstreet/bcachefs#625
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Kent Overstreet authored and gregkh committed Feb 16, 2024
1 parent dc610c4 commit f114cfc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fs/bcachefs/replicas.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *,
struct bch_replicas_cpu *);

/* Some (buggy!) compilers don't allow memcmp to be passed as a pointer */
static int bch2_memcmp(const void *l, const void *r, size_t size)
{
return memcmp(l, r, size);
}

/* Replicas tracking - in memory: */

static void verify_replicas_entry(struct bch_replicas_entry *e)
Expand All @@ -33,7 +39,7 @@ void bch2_replicas_entry_sort(struct bch_replicas_entry *e)

static void bch2_cpu_replicas_sort(struct bch_replicas_cpu *r)
{
eytzinger0_sort(r->entries, r->nr, r->entry_size, memcmp, NULL);
eytzinger0_sort(r->entries, r->nr, r->entry_size, bch2_memcmp, NULL);
}

static void bch2_replicas_entry_v0_to_text(struct printbuf *out,
Expand Down Expand Up @@ -833,7 +839,7 @@ static int bch2_cpu_replicas_validate(struct bch_replicas_cpu *cpu_r,
sort_cmp_size(cpu_r->entries,
cpu_r->nr,
cpu_r->entry_size,
memcmp, NULL);
bch2_memcmp, NULL);

for (i = 0; i < cpu_r->nr; i++) {
struct bch_replicas_entry *e =
Expand Down

0 comments on commit f114cfc

Please sign in to comment.