+ return retval;
+}
+
+/*
+ * Check health of a specific health type. Note that if a thread has not yet
+ * initialize its health subsystem or has quit, it's considered in a good
+ * state.
+ *
+ * Return 0 if health is bad or else 1.
+ */
+int health_check_state(enum health_type type)
+{
+ int retval = 1;
+ struct health_state *state;
+
+ assert(type < HEALTH_NUM_TYPE);
+
+ state_lock();
+
+ cds_list_for_each_entry(state, &health_state_list.head, node) {
+ int ret;
+
+ if (state->type != type) {
+ continue;
+ }
+
+ ret = validate_state(state);
+ if (!ret) {
+ retval = 0;
+ goto end;
+ }
+ }
+
+ /* Check the global state since some state might not be visible anymore. */
+ if (global_error_state[type] & HEALTH_ERROR) {
+ retval = 0;
+ }
+
+end: