summaryrefslogtreecommitdiff
path: root/src/core/unit.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-09-26 20:14:24 +0200
committerLennart Poettering <lennart@poettering.net>2013-09-26 20:20:30 +0200
commita57f7e2c828b852eb32fd810dcea041bb2975501 (patch)
tree9d088f212995c20b3ba2d2574ca8027fad25a51b /src/core/unit.h
parent6270c1bd8f83e9985458c63688f452be7626766f (diff)
core: rework how we match mount units against each other
Previously to automatically create dependencies between mount units we matched every mount unit agains all others resulting in O(n^2) complexity. On setups with large amounts of mount units this might make things slow. This change replaces the matching code to use a hashtable that is keyed by a path prefix, and points to a set of units that require that path to be around. When a new mount unit is installed it is hence sufficient to simply look up this set of units via its own file system paths to know which units to order after itself. This patch also changes all unit types to only create automatic mount dependencies via the RequiresMountsFor= logic, and this is exposed to the outside to make things more transparent. With this change we still have some O(n) complexities in place when handling mounts, but that's currently unavoidable due to kernel APIs, and still substantially better than O(n^2) as before. https://bugs.freedesktop.org/show_bug.cgi?id=69740
Diffstat (limited to 'src/core/unit.h')
-rw-r--r--src/core/unit.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/unit.h b/src/core/unit.h
index 0caea183c4..6dd750f8c2 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -173,7 +173,6 @@ struct Unit {
/* Counterparts in the cgroup filesystem */
char *cgroup_path;
- bool cgroup_realized;
CGroupControllerMask cgroup_mask;
UnitRef slice;
@@ -255,6 +254,8 @@ struct Unit {
bool no_gc:1;
bool in_audit:1;
+
+ bool cgroup_realized:1;
};
struct UnitStatusMessageFormats {
@@ -589,7 +590,6 @@ void unit_ref_unset(UnitRef *ref);
#define UNIT_DEREF(ref) ((ref).unit)
#define UNIT_ISSET(ref) (!!(ref).unit)
-int unit_add_one_mount_link(Unit *u, Mount *m);
int unit_add_mount_links(Unit *u);
int unit_exec_context_defaults(Unit *u, ExecContext *c);
@@ -609,6 +609,8 @@ int unit_kill_context(Unit *u, KillContext *c, bool sigkill, pid_t main_pid, pid
int unit_make_transient(Unit *u);
+int unit_require_mounts_for(Unit *u, const char *path);
+
const char *unit_active_state_to_string(UnitActiveState i) _const_;
UnitActiveState unit_active_state_from_string(const char *s) _pure_;