aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/export-to-postgresql.py
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2025-01-28 18:24:15 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-14 21:02:14 -0400
commitf27614652cd33184fb8a8464c1b0b893d350b33d (patch)
tree67c642c24fdc214456c2ba8dfb9d5e5ab67e9558 /tools/perf/scripts/python/export-to-postgresql.py
parentbcachefs: convert eytzinger sort to be 1-based (2) (diff)
downloadlinux-f27614652cd33184fb8a8464c1b0b893d350b33d.tar.gz
linux-f27614652cd33184fb8a8464c1b0b893d350b33d.zip
bcachefs: eytzinger1_{next,prev} cleanup
The eytzinger code was previously relying on the following wrap-around properties and their "eytzinger0" equivalents: eytzinger1_prev(0, size) == eytzinger1_last(size) eytzinger1_next(0, size) == eytzinger1_first(size) However, these properties are no longer relied upon and no longer necessary, so remove the corresponding asserts and forbid the use of eytzinger1_prev(0, size) and eytzinger1_next(0, size). This allows to further simplify the code in eytzinger1_next() and eytzinger1_prev(): where the left shifting happens, eytzinger1_next() is trying to move i to the lowest child on the left, which is equivalent to doubling i until the next doubling would cause it to be greater than size. This is implemented by shifting i to the left so that the most significant bits align and then shifting i to the right by one if the result is greater than size. Likewise, eytzinger1_prev() is trying to move to the lowest child on the right; the same applies here. The 1-offset in (size - 1) in eytzinger1_next() isn't needed at all, but the equivalent offset in eytzinger1_prev() is surprisingly needed to preserve the 'eytzinger1_prev(0, size) == eytzinger1_last(size)' property. However, since we no longer support that property, we can get rid of these offsets as well. This saves one addition in each function and makes the code less confusing. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions