summaryrefslogtreecommitdiff
path: root/src/load-dropin.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-11 00:52:00 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-11 00:52:00 +0200
commitfe51822e7120e89566cf76278d0b78ec7db4b43a (patch)
treed54f08b88805dee5604b3dc8d23a67edd956b466 /src/load-dropin.c
parent9014a8bd7a88aa4794b730e7fccf7838a00ad351 (diff)
manager: introduce unit path cache to minimize disk accesses
Diffstat (limited to 'src/load-dropin.c')
-rw-r--r--src/load-dropin.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/load-dropin.c b/src/load-dropin.c
index bdf3dd2c2e..9ba1201dbc 100644
--- a/src/load-dropin.c
+++ b/src/load-dropin.c
@@ -84,7 +84,11 @@ int unit_load_dropin(Unit *u) {
if (asprintf(&path, "%s/%s.wants", *p, t) < 0)
return -ENOMEM;
- r = iterate_dir(u, path);
+ if (u->meta.manager->unit_path_cache &&
+ !set_get(u->meta.manager->unit_path_cache, path))
+ r = 0;
+ else
+ r = iterate_dir(u, path);
free(path);
if (r < 0)
@@ -103,7 +107,11 @@ int unit_load_dropin(Unit *u) {
if (r < 0)
return -ENOMEM;
- r = iterate_dir(u, path);
+ if (u->meta.manager->unit_path_cache &&
+ !set_get(u->meta.manager->unit_path_cache, path))
+ r = 0;
+ else
+ r = iterate_dir(u, path);
free(path);
if (r < 0)