Hi all, Today's linux-next merge of the bcachefs tree got a conflict in: fs/bcachefs/clock.c between commit: 1fcce6b8a768 ("bcachefs: remove heap-related macros and switch to generic min_heap") from the mm-nonmm-stable tree and commit: 54fb2dad4aae ("bcachefs: Convert clock code to u64s") from the bcachefs tree. I fixed it up (I think - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc fs/bcachefs/clock.c index b50d7cd6fbde,df3763c18c0e..000000000000 --- a/fs/bcachefs/clock.c +++ b/fs/bcachefs/clock.c @@@ -24,22 -15,15 +24,20 @@@ static inline void io_timer_swp(void *l void bch2_io_timer_add(struct io_clock *clock, struct io_timer *timer) { - size_t i; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + spin_lock(&clock->timer_lock); - if (time_after_eq((unsigned long) atomic64_read(&clock->now), - timer->expire)) { + if (time_after_eq64((u64) atomic64_read(&clock->now), timer->expire)) { spin_unlock(&clock->timer_lock); timer->fn(timer); return; } - for (i = 0; i < clock->timers.nr; i++) - for (size_t i = 0; i < clock->timers.used; i++) ++ for (int i = 0; i < clock->timers.nr; i++) if (clock->timers.data[i] == timer) goto out; @@@ -50,17 -34,11 +48,16 @@@ out void bch2_io_timer_del(struct io_clock *clock, struct io_timer *timer) { - size_t i; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + spin_lock(&clock->timer_lock); - for (i = 0; i < clock->timers.nr; i++) - for (size_t i = 0; i < clock->timers.used; i++) ++ for (int i = 0; i < clock->timers.nr; i++) if (clock->timers.data[i] == timer) { - heap_del(&clock->timers, i, io_timer_cmp, NULL); + min_heap_del(&clock->timers, i, &callbacks, NULL); break; } @@@ -144,21 -120,13 +139,20 @@@ void bch2_kthread_io_clock_wait(struct bch2_io_timer_del(clock, &wait.io_timer); } - static struct io_timer *get_expired_timer(struct io_clock *clock, - unsigned long now) + static struct io_timer *get_expired_timer(struct io_clock *clock, u64 now) { struct io_timer *ret = NULL; + const struct min_heap_callbacks callbacks = { + .less = io_timer_cmp, + .swp = io_timer_swp, + }; + + if (clock->timers.nr && - time_after_eq(now, clock->timers.data[0]->expire)) { ++ time_after_eq64(now, clock->timers.data[0]->expire)) { + ret = *min_heap_peek(&clock->timers); + min_heap_pop(&clock->timers, &callbacks, NULL); + } - if (clock->timers.used && - time_after_eq64(now, clock->timers.data[0]->expire)) - heap_pop(&clock->timers, ret, io_timer_cmp, NULL); return ret; } @@@ -175,17 -143,18 +169,18 @@@ void __bch2_increment_clock(struct io_c void bch2_io_timers_to_text(struct printbuf *out, struct io_clock *clock) { - unsigned long now; - unsigned i; - out->atomic++; spin_lock(&clock->timer_lock); - now = atomic64_read(&clock->now); + u64 now = atomic64_read(&clock->now); - for (i = 0; i < clock->timers.nr; i++) - prt_printf(out, "%ps:\t%li\n", + printbuf_tabstop_push(out, 40); + prt_printf(out, "current time:\t%llu\n", now); + - for (unsigned i = 0; i < clock->timers.used; i++) ++ for (int i = 0; i < clock->timers.nr; i++) + prt_printf(out, "%ps %ps:\t%llu\n", clock->timers.data[i]->fn, - clock->timers.data[i]->expire - now); + clock->timers.data[i]->fn2, + clock->timers.data[i]->expire); spin_unlock(&clock->timer_lock); --out->atomic; }
Attachment:
pgp9L6fQJUi3K.pgp
Description: OpenPGP digital signature