|
|
beb904 |
autofs-5.1.7 - eliminate redundant cache lookup in tree_mapent_add_node()
|
|
|
beb904 |
|
|
|
beb904 |
From: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
|
|
|
beb904 |
Since we need to create the offset tree after adding the offset entries
|
|
|
beb904 |
to the mapent cache (from a list.h list) there's no need to lookup the
|
|
|
beb904 |
mapent in tree_mapent_add_node() and validate it. Just use it directly
|
|
|
beb904 |
when calling tree_mapent_add_node() and avoid a cache lookup on every
|
|
|
beb904 |
node addition.
|
|
|
beb904 |
|
|
|
beb904 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
---
|
|
|
beb904 |
CHANGELOG | 1 +
|
|
|
beb904 |
include/mounts.h | 2 +-
|
|
|
beb904 |
lib/mounts.c | 13 ++-----------
|
|
|
beb904 |
modules/parse_sun.c | 2 +-
|
|
|
beb904 |
4 files changed, 5 insertions(+), 13 deletions(-)
|
|
|
beb904 |
|
|
|
beb904 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
beb904 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
beb904 |
@@ -70,6 +70,7 @@
|
|
|
beb904 |
- fix amd hosts mount expire.
|
|
|
beb904 |
- fix offset entries order.
|
|
|
beb904 |
- use mapent tree root for tree_mapent_add_node().
|
|
|
beb904 |
+- eliminate redundant cache lookup in tree_mapent_add_node().
|
|
|
beb904 |
|
|
|
beb904 |
xx/xx/2018 autofs-5.1.5
|
|
|
beb904 |
- fix flag file permission.
|
|
|
beb904 |
--- autofs-5.1.4.orig/include/mounts.h
|
|
|
beb904 |
+++ autofs-5.1.4/include/mounts.h
|
|
|
beb904 |
@@ -170,7 +170,7 @@ void mnts_get_expire_list(struct list_he
|
|
|
beb904 |
void mnts_put_expire_list(struct list_head *mnts);
|
|
|
beb904 |
void mnts_set_mounted_mount(struct autofs_point *ap, const char *name, unsigned int flags);
|
|
|
beb904 |
struct tree_node *tree_mapent_root(struct mapent *me);
|
|
|
beb904 |
-int tree_mapent_add_node(struct mapent_cache *mc, struct tree_node *root, const char *key);
|
|
|
beb904 |
+int tree_mapent_add_node(struct mapent_cache *mc, struct tree_node *root, struct mapent *me);
|
|
|
beb904 |
int tree_mapent_delete_offsets(struct mapent_cache *mc, const char *key);
|
|
|
beb904 |
void tree_mapent_cleanup_offsets(struct mapent *oe);
|
|
|
beb904 |
int tree_mapent_mount_offsets(struct mapent *oe, int nonstrict);
|
|
|
beb904 |
--- autofs-5.1.4.orig/lib/mounts.c
|
|
|
beb904 |
+++ autofs-5.1.4/lib/mounts.c
|
|
|
beb904 |
@@ -1519,19 +1519,10 @@ static void tree_mapent_free(struct tree
|
|
|
beb904 |
}
|
|
|
beb904 |
|
|
|
beb904 |
int tree_mapent_add_node(struct mapent_cache *mc,
|
|
|
beb904 |
- struct tree_node *root, const char *key)
|
|
|
beb904 |
+ struct tree_node *root, struct mapent *me)
|
|
|
beb904 |
{
|
|
|
beb904 |
- unsigned int logopt = mc->ap->logopt;
|
|
|
beb904 |
struct tree_node *n;
|
|
|
beb904 |
struct mapent *parent;
|
|
|
beb904 |
- struct mapent *me;
|
|
|
beb904 |
-
|
|
|
beb904 |
- me = cache_lookup_distinct(mc, key);
|
|
|
beb904 |
- if (!me) {
|
|
|
beb904 |
- error(logopt,
|
|
|
beb904 |
- "failed to find key %s of multi-mount", key);
|
|
|
beb904 |
- return 0;
|
|
|
beb904 |
- }
|
|
|
beb904 |
|
|
|
beb904 |
n = tree_add_node(root, me);
|
|
|
beb904 |
if (!n)
|
|
|
beb904 |
@@ -1540,7 +1531,7 @@ int tree_mapent_add_node(struct mapent_c
|
|
|
beb904 |
MAPENT_SET_ROOT(me, root)
|
|
|
beb904 |
|
|
|
beb904 |
/* Set the subtree parent */
|
|
|
beb904 |
- parent = cache_get_offset_parent(mc, key);
|
|
|
beb904 |
+ parent = cache_get_offset_parent(mc, me->key);
|
|
|
beb904 |
if (!parent)
|
|
|
beb904 |
MAPENT_SET_PARENT(me, root)
|
|
|
beb904 |
else
|
|
|
beb904 |
--- autofs-5.1.4.orig/modules/parse_sun.c
|
|
|
beb904 |
+++ autofs-5.1.4/modules/parse_sun.c
|
|
|
beb904 |
@@ -1548,7 +1548,7 @@ dont_expand:
|
|
|
beb904 |
return 1;
|
|
|
beb904 |
}
|
|
|
beb904 |
list_for_each_entry_safe(oe, tmp, &offsets, work) {
|
|
|
beb904 |
- if (!tree_mapent_add_node(mc, MAPENT_ROOT(me), oe->key))
|
|
|
beb904 |
+ if (!tree_mapent_add_node(mc, MAPENT_ROOT(me), oe))
|
|
|
beb904 |
error(ap->logopt, "failed to add offset %s to tree", oe->key);
|
|
|
beb904 |
list_del_init(&oe->work);
|
|
|
beb904 |
}
|