[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250610215516.1513296-3-visitorckw@gmail.com>
Date: Wed, 11 Jun 2025 05:55:10 +0800
From: Kuan-Wei Chiu <visitorckw@...il.com>
To: corbet@....net,
colyli@...nel.org,
kent.overstreet@...ux.dev,
akpm@...ux-foundation.org,
robertpang@...gle.com
Cc: linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org,
linux-bcache@...r.kernel.org,
jserv@...s.ncku.edu.tw,
Kuan-Wei Chiu <visitorckw@...il.com>,
stable@...r.kernel.org
Subject: [PATCH 2/8] lib min_heap: Add typedef for sift_down function pointer
Several min-heap operations such as min_heapify_all(), min_heap_pop(),
min_heap_pop_push(), and min_heap_del() use min_heap_sift_down()
internally. With the addition of the equal-elements-aware variant
min_heap_sift_down_eqaware(), these functions now need to choose
between multiple sift_down implementations.
Introduce a siftdown_fn_t typedef to represent the function pointer
type for sift_down routines. This avoids repeating verbose function
pointer declarations and simplifies code that dynamically selects the
appropriate implementation based on heap characteristics.
Cc: stable@...r.kernel.org # 6.11+
Signed-off-by: Kuan-Wei Chiu <visitorckw@...il.com>
---
include/linux/min_heap.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/min_heap.h b/include/linux/min_heap.h
index b0d603fe5379..4cd8fd9db259 100644
--- a/include/linux/min_heap.h
+++ b/include/linux/min_heap.h
@@ -49,6 +49,9 @@ struct min_heap_callbacks {
void (*swp)(void *lhs, void *rhs, void *args);
};
+typedef void (*siftdown_fn_t)(min_heap_char *heap, size_t pos, size_t elem_size,
+ const struct min_heap_callbacks *func, void *args);
+
/**
* is_aligned - is this pointer & size okay for word-wide copying?
* @base: pointer to data
--
2.34.1
Powered by blists - more mailing lists