Whamcloud - gitweb
LU-12616 obclass: fix MDS start/stop race
[fs/lustre-release.git] / lustre / ldlm / ldlm_internal.h
index 3b7e55d..0b79fe5 100644 (file)
@@ -30,8 +30,6 @@
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#define MAX_STRING_SIZE 128
-
 extern int ldlm_srv_namespace_nr;
 extern int ldlm_cli_namespace_nr;
 extern struct mutex ldlm_srv_namespace_lock;
@@ -122,6 +120,7 @@ extern unsigned int ldlm_enqueue_min;
 /* ldlm_resource.c */
 extern struct kmem_cache *ldlm_resource_slab;
 extern struct kmem_cache *ldlm_lock_slab;
+extern struct kmem_cache *ldlm_inodebits_slab;
 extern struct kmem_cache *ldlm_interval_tree_slab;
 
 void ldlm_resource_insert_lock_after(struct ldlm_lock *original,
@@ -158,7 +157,8 @@ void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
 #ifdef HAVE_SERVER_SUPPORT
 int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue,
                         struct list_head *work_list,
-                        enum ldlm_process_intention intention);
+                        enum ldlm_process_intention intention,
+                        struct ldlm_lock *hint);
 int ldlm_handle_conflict_lock(struct ldlm_lock *lock, __u64 *flags,
                              struct list_head *rpc_list);
 void ldlm_discard_bl_list(struct list_head *bl_list);
@@ -204,14 +204,25 @@ int ldlm_process_inodebits_lock(struct ldlm_lock *lock, __u64 *flags,
                                enum ldlm_process_intention intention,
                                enum ldlm_error *err,
                                struct list_head *work_list);
+int ldlm_reprocess_inodebits_queue(struct ldlm_resource *res,
+                                  struct list_head *queue,
+                                  struct list_head *work_list,
+                                  enum ldlm_process_intention intention,
+                                  struct ldlm_lock *hint);
 /* ldlm_extent.c */
 int ldlm_process_extent_lock(struct ldlm_lock *lock, __u64 *flags,
                             enum ldlm_process_intention intention,
                             enum ldlm_error *err, struct list_head *work_list);
 #endif
+int ldlm_extent_alloc_lock(struct ldlm_lock *lock);
 void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock);
 void ldlm_extent_unlink_lock(struct ldlm_lock *lock);
 
+int ldlm_inodebits_alloc_lock(struct ldlm_lock *lock);
+void ldlm_inodebits_add_lock(struct ldlm_resource *res, struct list_head *head,
+                            struct ldlm_lock *lock);
+void ldlm_inodebits_unlink_lock(struct ldlm_lock *lock);
+
 /* ldlm_flock.c */
 int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,
                            enum ldlm_process_intention intention,
@@ -237,7 +248,6 @@ struct ldlm_state {
 extern struct kmem_cache *ldlm_interval_slab; /* slab cache for ldlm_interval */
 extern void ldlm_interval_attach(struct ldlm_interval *n, struct ldlm_lock *l);
 extern struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l);
-extern struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock);
 extern void ldlm_interval_free(struct ldlm_interval *node);
 /* this function must be called with res lock held */
 static inline struct ldlm_extent *
@@ -288,7 +298,7 @@ enum ldlm_policy_res {
        static ssize_t var##_store(struct kobject *kobj,                   \
                                   struct attribute *attr,                 \
                                   const char *buffer,                     \
-                                  unsigned long count)                    \
+                                  size_t count)                           \
        {                                                                  \
                struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool,\
                                                    pl_kobj);              \
@@ -324,7 +334,7 @@ enum ldlm_policy_res {
        static ssize_t var##_store(struct kobject *kobj,                   \
                                   struct attribute *attr,                 \
                                   const char *buffer,                     \
-                                  unsigned long count)                    \
+                                  size_t count)                           \
        {                                                                  \
                struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool,\
                                                    pl_kobj);              \
@@ -346,7 +356,7 @@ static inline void
 ldlm_add_var(struct lprocfs_vars *vars, struct dentry *debugfs_entry,
             const char *name, void *data, const struct file_operations *ops)
 {
-       snprintf((char *)vars->name, MAX_STRING_SIZE, "%s", name);
+       vars->name = name;
        vars->data = data;
        vars->fops = ops;
        ldebugfs_add_vars(debugfs_entry, vars, NULL);
@@ -354,17 +364,13 @@ ldlm_add_var(struct lprocfs_vars *vars, struct dentry *debugfs_entry,
 
 static inline int is_granted_or_cancelled(struct ldlm_lock *lock)
 {
-        int ret = 0;
+       int ret = 0;
 
-        lock_res_and_lock(lock);
-       if ((lock->l_req_mode == lock->l_granted_mode) &&
-            !ldlm_is_cp_reqd(lock))
-               ret = 1;
-       else if (ldlm_is_failed(lock) || ldlm_is_cancel(lock))
-                ret = 1;
-        unlock_res_and_lock(lock);
+       lock_res_and_lock(lock);
+       ret = is_granted_or_cancelled_nolock(lock);
+       unlock_res_and_lock(lock);
 
-        return ret;
+       return ret;
 }
 
 static inline bool is_bl_done(struct ldlm_lock *lock)