Whamcloud - gitweb
LU-2924 Only wake up ldlm_poold as frequently as the check interval
[fs/lustre-release.git] / lustre / include / lustre_dlm.h
index f13040e..cdb5ea0 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2010, 2012, Whamcloud, Inc.
+ * Copyright (c) 2010, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -70,12 +70,7 @@ struct obd_device;
 
 #define OBD_LDLM_DEVICENAME  "ldlm"
 
-#ifdef HAVE_BGL_SUPPORT
-/* 1.5 times the maximum 128 tasks available in VN mode */
-#define LDLM_DEFAULT_LRU_SIZE 196
-#else
 #define LDLM_DEFAULT_LRU_SIZE (100 * cfs_num_online_cpus())
-#endif
 #define LDLM_DEFAULT_MAX_ALIVE (cfs_time_seconds(36000))
 #define LDLM_CTIME_AGE_LIMIT (10)
 #define LDLM_DEFAULT_PARALLEL_AST_LIMIT 1024
@@ -90,6 +85,7 @@ typedef enum {
         ELDLM_LOCK_ABORTED = 301,
         ELDLM_LOCK_REPLACED = 302,
         ELDLM_NO_LOCK_DATA = 303,
+        ELDLM_LOCK_WOULDBLOCK = 304,
 
         ELDLM_NAMESPACE_EXISTS = 400,
         ELDLM_BAD_NAMESPACE    = 401
@@ -1141,7 +1137,7 @@ struct ldlm_resource {
         * To serialize lvbo_init.
         */
        struct mutex            lr_lvb_mutex;
-       __u32                   lr_lvb_len;
+       int                     lr_lvb_len;
        /** protected by lr_lock */
        void                    *lr_lvb_data;
 
@@ -1153,6 +1149,12 @@ struct ldlm_resource {
        struct inode            *lr_lvb_inode;
 };
 
+static inline bool ldlm_has_layout(struct ldlm_lock *lock)
+{
+       return lock->l_resource->lr_type == LDLM_IBITS &&
+               lock->l_policy_data.l_inodebits.bits & MDS_INODELOCK_LAYOUT;
+}
+
 static inline char *
 ldlm_ns_name(struct ldlm_namespace *ns)
 {
@@ -1516,8 +1518,6 @@ void ldlm_namespace_free(struct ldlm_namespace *ns,
                          struct obd_import *imp, int force);
 void ldlm_namespace_register(struct ldlm_namespace *ns, ldlm_side_t client);
 void ldlm_namespace_unregister(struct ldlm_namespace *ns, ldlm_side_t client);
-void ldlm_namespace_move_locked(struct ldlm_namespace *ns, ldlm_side_t client);
-struct ldlm_namespace *ldlm_namespace_first_locked(ldlm_side_t client);
 void ldlm_namespace_get(struct ldlm_namespace *ns);
 void ldlm_namespace_put(struct ldlm_namespace *ns);
 int ldlm_proc_setup(void);
@@ -1586,6 +1586,11 @@ int ldlm_prep_elc_req(struct obd_export *exp,
                       struct ptlrpc_request *req,
                       int version, int opc, int canceloff,
                       cfs_list_t *cancels, int count);
+
+struct ptlrpc_request *ldlm_enqueue_pack(struct obd_export *exp, int lvb_len);
+int ldlm_handle_enqueue0(struct ldlm_namespace *ns, struct ptlrpc_request *req,
+                        const struct ldlm_request *dlm_req,
+                        const struct ldlm_callback_suite *cbs);
 int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
                           ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode,
                          __u64 *flags, void *lvb, __u32 lvb_len,
@@ -1604,7 +1609,8 @@ int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new,
                     void *data, __u32 data_len);
 int ldlm_cli_convert(struct lustre_handle *, int new_mode, __u32 *flags);
 int ldlm_cli_update_pool(struct ptlrpc_request *req);
-int ldlm_cli_cancel(struct lustre_handle *lockh);
+int ldlm_cli_cancel(struct lustre_handle *lockh,
+                   ldlm_cancel_flags_t cancel_flags);
 int ldlm_cli_cancel_unused(struct ldlm_namespace *, const struct ldlm_res_id *,
                            ldlm_cancel_flags_t flags, void *opaque);
 int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
@@ -1684,7 +1690,7 @@ void unlock_res_and_lock(struct ldlm_lock *lock);
  * There are not used outside of ldlm.
  * @{
  */
-void ldlm_pools_recalc(ldlm_side_t client);
+int ldlm_pools_recalc(ldlm_side_t client);
 int ldlm_pools_init(void);
 void ldlm_pools_fini(void);