Em 05/08/2025 02:08, Al Viro escreveu:
On Tue, Aug 05, 2025 at 12:09:06AM -0300, André Almeida wrote:
+static int ovl_strcmp(const char *str, struct ovl_cache_entry *p, int len)
+ if (p->map && !is_dot_dotdot(str, len)) {
+ dst = kmalloc(OVL_NAME_LEN, GFP_KERNEL);
...`
+ kfree(dst);
+
+ return cmp;
+}
+
@@ -107,7 +145,7 @@ static struct ovl_cache_entry *ovl_cache_entry_find(struct rb_root *root,
while (node) {
struct ovl_cache_entry *p = ovl_cache_entry_from_node(node);
- cmp = strncmp(name, p->name, len);
+ cmp = ovl_strcmp(name, p, len);
if (cmp > 0)
node = p->node.rb_right;
else if (cmp < 0 || len < p->len)
Am I misreading that, or do really we get a kmalloc()/kfree() for each
sodding tree node we traverse on rbtree lookup here?
Yes, this is what's implemented here, as it is. Alternatively, I could
allocate one buffer prior to the rbtree search/insert to be reused, and
free it later... I going to add that for the v3.