Whamcloud - gitweb
The old patch was failing because sometimes the inodes were gone by the time
[fs/lustre-release.git] / lustre / include / linux / lustre_dlm.h
index a2576f2..9f6c747 100644 (file)
@@ -8,10 +8,11 @@
 #ifdef __KERNEL__
 
 #include <linux/proc_fs.h>
+#include <linux/lustre_lib.h>
 #include <linux/lustre_net.h>
+#include <linux/lustre_import.h>
 
 struct obd_ops;
-struct obd_export;
 struct obd_device;
 
 #define OBD_LDLM_DEVICENAME  "ldlm"
@@ -21,7 +22,6 @@ typedef enum {
 
         ELDLM_LOCK_CHANGED = 300,
         ELDLM_LOCK_ABORTED = 301,
-        ELDLM_RESOURCE_FREED = 302,
 
         ELDLM_NAMESPACE_EXISTS = 400,
         ELDLM_BAD_NAMESPACE    = 401
@@ -38,6 +38,10 @@ typedef enum {
 #define LDLM_FL_AST_SENT       (1 << 5)
 #define LDLM_FL_DESTROYED      (1 << 6)
 #define LDLM_FL_WAIT_NOREPROC  (1 << 7)
+#define LDLM_FL_CANCEL         (1 << 8)
+
+#define LDLM_CB_BLOCKING    1
+#define LDLM_CB_CANCELING   2
 
 #define L2B(c) (1 << c)
 
@@ -85,7 +89,6 @@ static inline int lockmode_compat(ldlm_mode_t exist, ldlm_mode_t new)
 
 struct ldlm_namespace {
         char                  *ns_name;
-        struct ptlrpc_client   ns_rpc_client;/* used for revocation callbacks */
         __u32                  ns_client; /* is this a client-side lock tree? */
         struct list_head      *ns_hash; /* hash table for ns */
         __u32                  ns_refcount; /* count of resources in the hash */
@@ -93,6 +96,10 @@ struct ldlm_namespace {
         struct lustre_lock     ns_lock; /* protects hash, refcount, list */
         struct list_head       ns_list_chain; /* position in global NS list */
         struct proc_dir_entry *ns_proc_dir;
+
+        spinlock_t             ns_counter_lock;
+        __u64                  ns_locks;
+        __u64                  ns_resources;
 };
 
 /* 
@@ -109,7 +116,7 @@ struct ldlm_lock;
 
 typedef int (*ldlm_blocking_callback)(struct ldlm_lock *lock,
                                       struct ldlm_lock_desc *new, void *data,
-                                      __u32 data_len);
+                                      __u32 data_len, int flag);
 
 typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, int flags); 
 
@@ -132,10 +139,9 @@ struct ldlm_lock {
         ldlm_blocking_callback    l_blocking_ast;
 
         struct obd_export    *l_export;
-        struct ptlrpc_client *l_client;
         struct lustre_handle *l_connh;
         __u32                 l_flags;
-        struct lustre_handle    l_remote_handle;
+        struct lustre_handle   l_remote_handle;
         void                 *l_data;
         __u32                 l_data_len;
         void                 *l_cookie;
@@ -199,7 +205,7 @@ struct ldlm_ast_work {
 /* Per-export ldlm state. */
 struct ldlm_export_data {
         struct list_head        led_held_locks;
-        struct ptlrpc_client    led_client;     /* cached client for locks  */
+        struct obd_import       led_import;
 };
         
 static inline struct ldlm_extent *ldlm_res2extent(struct ldlm_resource *res)
@@ -218,7 +224,7 @@ do {                                                                    \
         if (lock->l_resource == NULL)                                   \
                 CDEBUG(D_DLMTRACE, "### " format                        \
                        " (UNKNOWN: lock %p(rc=%d/%d,%d) mode %s/%s on " \
-                       "res \?\? (rc=\?\?) type \?\?\? remote %Lx)\n" , \
+                       "res \?\? (rc=\?\?) type \?\?\? remote "LPX64")\n" , \
                        ## a, lock, lock->l_refc, lock->l_readers,       \
                        lock->l_writers,                                 \
                        ldlm_lockname[lock->l_granted_mode],             \
@@ -227,7 +233,7 @@ do {                                                                    \
         else                                                            \
                 CDEBUG(D_DLMTRACE, "### " format                        \
                        " (%s: lock %p(rc=%d/%d,%d) mode %s/%s on res "  \
-                       "%Lu (rc=%d) type %s remote %Lx)\n" , ## a,      \
+                       LPU64" (rc=%d) type %s remote "LPX64")\n" , ## a,      \
                        lock->l_resource->lr_namespace->ns_name, lock,   \
                        lock->l_refc, lock->l_readers, lock->l_writers,  \
                        ldlm_lockname[lock->l_granted_mode],             \
@@ -257,6 +263,7 @@ void ldlm_unregister_intent(void);
 void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);
 struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *handle);
 void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);
+void ldlm_cancel_callback(struct ldlm_lock *lock);
 
 #define LDLM_LOCK_PUT(lock)                     \
 do {                                            \
@@ -363,12 +370,12 @@ 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);
+int ldlm_cli_cancel_unused(struct ldlm_namespace *, __u64 *, int local_only);
 
 /* mds/handler.c */
 /* This has to be here because recurisve inclusion sucks. */
 int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
-                     void *data, __u32 data_len);
+                     void *data, __u32 data_len, int flag);
 
 #endif /* __KERNEL__ */