X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flu_ref.h;h=5bb3bf1b52dcb085060b6c7b9adb360e1d71e3a5;hb=e88b3bf26a477a2b42182c4b451bc2fe55fa88fa;hp=41259301d7021c2b176e319bf5dd7293c89029e8;hpb=c0b9c99922da2f059d145e92f9636f37d1fea49e;p=fs%2Flustre-release.git diff --git a/lustre/include/lu_ref.h b/lustre/include/lu_ref.h index 4125930..5bb3bf1 100644 --- a/lustre/include/lu_ref.h +++ b/lustre/include/lu_ref.h @@ -1,7 +1,5 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. +/* + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Author: Nikita Danilov @@ -120,13 +118,42 @@ struct lu_ref_link; * etc.) refer to. */ struct lu_ref { - spinlock_t lf_guard; - struct list_head lf_list; - int lf_failed; + /** + * Spin-lock protecting lu_ref::lf_list. + */ + cfs_spinlock_t lf_guard; + /** + * List of all outstanding references (each represented by struct + * lu_ref_link), pointing to this object. + */ + cfs_list_t lf_list; + /** + * # 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). + */ + cfs_list_t 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); @@ -142,6 +169,8 @@ void lu_ref_del_at (struct lu_ref *ref, 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 {}; @@ -196,6 +225,10 @@ static inline void lu_ref_global_fini(void) static inline void lu_ref_print(const struct lu_ref *ref) { } + +static inline void lu_ref_print_all(void) +{ +} #endif /* USE_LU_REF */ /** @} lu */