* etc.) refer to.
*/
struct lu_ref {
+ /**
+ * Spin-lock protecting lu_ref::lf_list.
+ */
spinlock_t lf_guard;
+ /**
+ * List of all outstanding references (each represented by struct
+ * lu_ref_link), pointing to this object.
+ */
struct list_head lf_list;
- int lf_failed;
+ /**
+ * # of links.
+ */
+ short lf_refs;
+ /**
+ * Flag set when lu_ref_add() failed to allocate lu_ref_link. It is
+ * used to mask spurious failure of the following lu_ref_del().
+ */
+ short lf_failed;
+ /**
+ * flags - attribute for the lu_ref, for pad and future use.
+ */
+ short lf_flags;
+ /**
+ * Where was I initialized?
+ */
+ short lf_line;
+ const char *lf_func;
+ /**
+ * Linkage into a global list of all lu_ref's (lu_ref_refs).
+ */
+ struct list_head lf_linkage;
};
-void lu_ref_init(struct lu_ref *ref);
-void lu_ref_fini(struct lu_ref *ref);
+void lu_ref_init_loc(struct lu_ref *ref, const char *func, const int line);
+void lu_ref_fini (struct lu_ref *ref);
+#define lu_ref_init(ref) lu_ref_init_loc(ref, __FUNCTION__, __LINE__)
struct lu_ref_link *lu_ref_add (struct lu_ref *ref, const char *scope,
const void *source);
struct lu_ref_link *link,
const char *scope, const void *source);
void lu_ref_print (const struct lu_ref *ref);
+void lu_ref_print_all (void);
+
#else /* !USE_LU_REF */
struct lu_ref {};
static inline void lu_ref_print(const struct lu_ref *ref)
{
}
+
+static inline void lu_ref_print_all(void)
+{
+}
#endif /* USE_LU_REF */
/** @} lu */