Whamcloud - gitweb
Constify instances of struct {lu,dt,md}_device_operations.
[fs/lustre-release.git] / lustre / include / lu_object.h
index c1ab0d3..d105001 100644 (file)
@@ -452,7 +452,7 @@ struct lu_object {
         /*
          * Operations for this object.
          */
-        struct lu_object_operations *lo_ops;
+        const struct lu_object_operations *lo_ops;
         /*
          * Linkage into list of all layers.
          */
@@ -465,6 +465,10 @@ struct lu_object {
          * Flags from enum lu_object_flags.
          */
         unsigned long                lo_flags;
+        /**
+         * Link to the device, for debugging.
+         */
+        struct lu_ref_link                *lo_dev_ref;
 };
 
 enum lu_object_header_flags {
@@ -627,15 +631,25 @@ struct lu_site {
 
         /*
          * Client Seq Manager
+        /**
+         * Wait-queue signaled when an object in this site is ultimately
+         * destroyed (lu_object_free()). It is used by lu_object_find() to
+         * wait before re-trying when object in the process of destruction is
+         * found in the hash table.
+         *
+         * If having a single wait-queue turns out to be a problem, a
+         * wait-queue per hash-table bucket can be easily implemented.
+         *
+         * \see htable_lookup().
          */
-        struct lu_client_seq *ls_client_seq;
+        cfs_waitq_t           ls_marche_funebre;
 
-        /* statistical counters. Protected by nothing, races are accepted. */
+        /** statistical counters. Protected by nothing, races are accepted. */
         struct {
                 __u32 s_created;
                 __u32 s_cache_hit;
                 __u32 s_cache_miss;
-                /*
+                /**
                  * Number of hash-table entry checks made.
                  *
                  *       ->s_cache_check / (->s_cache_miss + ->s_cache_hit)
@@ -767,21 +781,21 @@ static inline const struct lu_fid *lu_object_fid(const struct lu_object *o)
         return &o->lo_header->loh_fid;
 }
 
-/*
+/**
  * return device operations vector for this object
  */
-static inline struct lu_device_operations *
+static const inline struct lu_device_operations *
 lu_object_ops(const struct lu_object *o)
 {
         return o->lo_dev->ld_ops;
 }
 
-/*
+/**
  * Given a compound object, find its slice, corresponding to the device type
- * @dtype.
+ * \a dtype.
  */
 struct lu_object *lu_object_locate(struct lu_object_header *h,
-                                   struct lu_device_type *dtype);
+                                   const struct lu_device_type *dtype);
 
 struct lu_cdebug_print_info {
         int         lpi_subsys;
@@ -869,6 +883,26 @@ static inline __u32 lu_object_attr(const struct lu_object *o)
         return o->lo_header->loh_attr;
 }
 
+static inline struct lu_ref_link *lu_object_ref_add(struct lu_object *o,
+                                                    const char *scope,
+                                                    const void *source)
+{
+        return lu_ref_add(&o->lo_header->loh_reference, scope, source);
+}
+
+static inline void lu_object_ref_del(struct lu_object *o,
+                                     const char *scope, const void *source)
+{
+        lu_ref_del(&o->lo_header->loh_reference, scope, source);
+}
+
+static inline void lu_object_ref_del_at(struct lu_object *o,
+                                        struct lu_ref_link *link,
+                                        const char *scope, const void *source)
+{
+        lu_ref_del_at(&o->lo_header->loh_reference, link, scope, source);
+}
+
 struct lu_rdpg {
         /* input params, should be filled out by mdt */
         __u64                   rp_hash;        /* hash */
@@ -1170,6 +1204,17 @@ void  lu_context_key_revive  (struct lu_context_key *key);
         }                                                              \
         struct __##mod##_dummy_type_fini {;}
 
+#define LU_TYPE_START(mod, ...)                                 \
+        static void mod##_type_start(struct lu_device_type *t)  \
+        {                                                       \
+        }                                                       \
+        struct __##mod##_dummy_type_start {;}
+
+#define LU_TYPE_STOP(mod, ...)                                  \
+        static void mod##_type_stop(struct lu_device_type *t)   \
+        {                                                       \
+        }                                                       \
+        struct __##mod##_dummy_type_stop {;}
 
 
 
@@ -1266,4 +1311,15 @@ enum {
 
 extern const char *lu_time_names[LU_TIME_NR];
 
+struct lu_kmem_descr {
+        cfs_mem_cache_t **ckd_cache;
+        const char       *ckd_name;
+        const size_t      ckd_size;
+};
+
+int  lu_kmem_init(struct lu_kmem_descr *caches);
+void lu_kmem_fini(struct lu_kmem_descr *caches);
+
+/** @} lu */
+
 #endif /* __LUSTRE_LU_OBJECT_H */