diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-31 15:52:24 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-31 18:02:57 -0400 |
commit | 7f102ee83d83fd918783ca542fac1574f9b2c623 (patch) | |
tree | da560f908d970d3dbad5749c1407ed30b6965c4c /libbcachefs/util.c | |
parent | d22c79d2fff10dd782caf5668fd019387914a5bb (diff) |
Update bcachefs sources to 8fd009dd76 bcachefs: Rip out code for storing backpointers in alloc keysv0.28
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/util.c')
-rw-r--r-- | libbcachefs/util.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/libbcachefs/util.c b/libbcachefs/util.c index 56c21c61..c50473d4 100644 --- a/libbcachefs/util.c +++ b/libbcachefs/util.c @@ -240,36 +240,6 @@ bool bch2_is_zero(const void *_p, size_t n) return true; } -static void bch2_quantiles_update(struct bch2_quantiles *q, u64 v) -{ - unsigned i = 0; - - while (i < ARRAY_SIZE(q->entries)) { - struct bch2_quantile_entry *e = q->entries + i; - - if (unlikely(!e->step)) { - e->m = v; - e->step = max_t(unsigned, v / 2, 1024); - } else if (e->m > v) { - e->m = e->m >= e->step - ? e->m - e->step - : 0; - } else if (e->m < v) { - e->m = e->m + e->step > e->m - ? e->m + e->step - : U32_MAX; - } - - if ((e->m > v ? e->m - v : v - e->m) < e->step) - e->step = max_t(unsigned, e->step / 2, 1); - - if (v >= e->m) - break; - - i = eytzinger0_child(i, v > e->m); - } -} - void bch2_prt_u64_binary(struct printbuf *out, u64 v, unsigned nr_bits) { while (nr_bits) @@ -343,6 +313,36 @@ int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task) /* time stats: */ #ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT +static void bch2_quantiles_update(struct bch2_quantiles *q, u64 v) +{ + unsigned i = 0; + + while (i < ARRAY_SIZE(q->entries)) { + struct bch2_quantile_entry *e = q->entries + i; + + if (unlikely(!e->step)) { + e->m = v; + e->step = max_t(unsigned, v / 2, 1024); + } else if (e->m > v) { + e->m = e->m >= e->step + ? e->m - e->step + : 0; + } else if (e->m < v) { + e->m = e->m + e->step > e->m + ? e->m + e->step + : U32_MAX; + } + + if ((e->m > v ? e->m - v : v - e->m) < e->step) + e->step = max_t(unsigned, e->step / 2, 1); + + if (v >= e->m) + break; + + i = eytzinger0_child(i, v > e->m); + } +} + static inline void bch2_time_stats_update_one(struct bch2_time_stats *stats, u64 start, u64 end) { |