Whamcloud - gitweb
* Move recovery state into connection from client, and fallout therefrom.
[fs/lustre-release.git] / lustre / include / linux / lustre_dlm.h
index f8b4c21..2ec2693 100644 (file)
@@ -8,9 +8,12 @@
 #ifdef __KERNEL__
 
 #include <linux/proc_fs.h>
-#include <linux/obd_class.h>
 #include <linux/lustre_net.h>
 
+struct obd_ops;
+struct obd_export;
+struct obd_device;
+
 #define OBD_LDLM_DEVICENAME  "ldlm"
 
 typedef enum {
@@ -111,13 +114,16 @@ typedef int (*ldlm_blocking_callback)(struct ldlm_lock *lock,
 typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, int flags); 
 
 struct ldlm_lock {
-        __u64                  l_random;
+        __u64                 l_random;
         int                   l_refc;
         struct ldlm_resource *l_resource;
         struct ldlm_lock     *l_parent;
         struct list_head      l_children;
         struct list_head      l_childof;
         struct list_head      l_res_link; /*position in one of three res lists*/
+        struct list_head      l_export_chain; /* per-export chain of locks */
+        struct list_head      l_pending_chain; /* locks with callbacks pending*/
+        unsigned long         l_callback_timeout;
 
         ldlm_mode_t           l_req_mode;
         ldlm_mode_t           l_granted_mode;
@@ -125,7 +131,7 @@ struct ldlm_lock {
         ldlm_completion_callback    l_completion_ast;
         ldlm_blocking_callback    l_blocking_ast;
 
-        struct ptlrpc_connection *l_connection;
+        struct obd_export    *l_export;
         struct ptlrpc_client *l_client;
         struct lustre_handle *l_connh;
         __u32                 l_flags;
@@ -189,6 +195,12 @@ struct ldlm_ast_work {
         void *w_data;
         int w_datalen;
 };
+
+/* Per-export ldlm state. */
+struct ldlm_export_data {
+        struct list_head        led_held_locks;
+        struct ptlrpc_client    led_client;     /* cached client for locks  */
+};
         
 static inline struct ldlm_extent *ldlm_res2extent(struct ldlm_resource *res)
 {
@@ -197,7 +209,6 @@ static inline struct ldlm_extent *ldlm_res2extent(struct ldlm_resource *res)
 
 extern struct obd_ops ldlm_obd_ops;
 
-
 extern char *ldlm_lockname[];
 extern char *ldlm_typename[];
 extern char *ldlm_it2str(int it);
@@ -249,17 +260,18 @@ void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);
 
 #define LDLM_LOCK_PUT(lock)                     \
 do {                                            \
-        LDLM_DEBUG(lock, "put");                \
+        /*LDLM_DEBUG(lock, "put");*/            \
         ldlm_lock_put(lock);                    \
 } while (0)
 
 #define LDLM_LOCK_GET(lock)                     \
 ({                                              \
         ldlm_lock_get(lock);                    \
-        LDLM_DEBUG(lock, "get");                \
+        /*LDLM_DEBUG(lock, "get");*/            \
         lock;                                   \
 })
 
+struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);
 void ldlm_lock_put(struct ldlm_lock *lock);
 void ldlm_lock_destroy(struct ldlm_lock *lock);
 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc);
@@ -287,7 +299,11 @@ void ldlm_reprocess_all(struct ldlm_resource *res);
 void ldlm_lock_dump(struct ldlm_lock *lock);
 
 /* ldlm_test.c */
-int ldlm_test(struct obd_device *device, struct ptlrpc_connection *conn);
+int ldlm_test(struct obd_device *device, struct lustre_handle *connh);
+int ldlm_regression_start(struct obd_device *obddev, 
+                struct lustre_handle *connh, int count);
+int ldlm_regression_stop(void);
+
 
 /* resource.c */
 struct ldlm_namespace *ldlm_namespace_new(char *name, __u32 local);
@@ -344,6 +360,7 @@ 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, int *flags);
 int ldlm_cli_cancel(struct lustre_handle *lockh);
+int ldlm_cli_cancel_unused(struct ldlm_namespace *ns, __u64 *res_id);
 
 /* mds/handler.c */
 /* This has to be here because recurisve inclusion sucks. */
@@ -358,6 +375,8 @@ int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
 
 #define IOC_LDLM_TEST                   _IOWR('f', 40, long)
 #define IOC_LDLM_DUMP                   _IOWR('f', 41, long)
-#define IOC_LDLM_MAX_NR                 41
+#define IOC_LDLM_REGRESS_START          _IOWR('f', 42, long)
+#define IOC_LDLM_REGRESS_STOP           _IOWR('f', 43, long)
+#define IOC_LDLM_MAX_NR                 43
 
 #endif