Whamcloud - gitweb
b=23289 less global lock & atomic for ldlm pool
[fs/lustre-release.git] / lustre / include / lustre_dlm.h
index bf0d9f8..2c6ed28 100644 (file)
@@ -330,10 +330,6 @@ struct ldlm_pool {
          */
         cfs_atomic_t           pl_cancel_rate;
         /**
-         * Grant speed (GR-CR) per T.
-         */
-        cfs_atomic_t           pl_grant_speed;
-        /**
          * Server lock volume. Protected by pl_lock.
          */
         __u64                  pl_server_lock_volume;
@@ -662,7 +658,10 @@ struct ldlm_lock {
          * Protected by lock and resource locks.
          */
         __u8                  l_destroyed;
-
+        /**
+         * flag whether this is a server namespace lock
+         */
+        __u8                  l_ns_srv;
         /**
          * If the lock is granted, a process sleeps on this waitq to learn when
          * it's no longer in use.  If the lock is not granted, a process sleeps
@@ -694,10 +693,6 @@ struct ldlm_lock {
         void                 *l_lvb_data;
 
         void                 *l_ast_data;
-        cfs_spinlock_t        l_extents_list_lock;
-        cfs_list_t            l_extents_list;
-
-        cfs_list_t            l_cache_locks_list;
 
         /*
          * Server-side-only members.
@@ -757,8 +752,6 @@ struct ldlm_resource {
 
         /* protected by ns_hash_lock */
         cfs_list_t             lr_hash;
-        struct ldlm_resource  *lr_parent;   /* 0 for a root resource */
-        cfs_list_t             lr_children; /* list head for child resources */
         cfs_list_t             lr_childof;  /* part of ns_root_list if root res,
                                              * part of lr_children if child */
         cfs_spinlock_t         lr_lock;
@@ -789,6 +782,30 @@ struct ldlm_resource {
         struct inode          *lr_lvb_inode;
 };
 
+static inline struct ldlm_namespace *
+ldlm_res_to_ns(struct ldlm_resource *res)
+{
+        return res->lr_namespace;
+}
+
+static inline struct ldlm_namespace *
+ldlm_lock_to_ns(struct ldlm_lock *lock)
+{
+        return ldlm_res_to_ns(lock->l_resource);
+}
+
+static inline char *
+ldlm_lock_to_ns_name(struct ldlm_lock *lock)
+{
+        return ldlm_lock_to_ns(lock)->ns_name;
+}
+
+static inline struct adaptive_timeout *
+ldlm_lock_to_ns_at(struct ldlm_lock *lock)
+{
+        return &ldlm_lock_to_ns(lock)->ns_at_estimate;
+}
+
 struct ldlm_ast_work {
         struct ldlm_lock      *w_lock;
         int                    w_blocking;
@@ -943,10 +960,10 @@ ldlm_handle2lock_long(const struct lustre_handle *h, int flags)
 static inline int ldlm_res_lvbo_update(struct ldlm_resource *res,
                                        struct ptlrpc_request *r, int increase)
 {
-        if (res->lr_namespace->ns_lvbo &&
-            res->lr_namespace->ns_lvbo->lvbo_update) {
-                return res->lr_namespace->ns_lvbo->lvbo_update(res, r,
-                                                               increase);
+        if (ldlm_res_to_ns(res)->ns_lvbo &&
+            ldlm_res_to_ns(res)->ns_lvbo->lvbo_update) {
+                return ldlm_res_to_ns(res)->ns_lvbo->lvbo_update(res, r,
+                                                                 increase);
         }
         return 0;
 }