Whamcloud - gitweb
Revert "LU-2459 osd: add LMA incompat flag check"
[fs/lustre-release.git] / lustre / ldlm / ldlm_internal.h
index c6265f7..55483e9 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -38,9 +38,9 @@
 
 extern cfs_atomic_t ldlm_srv_namespace_nr;
 extern cfs_atomic_t ldlm_cli_namespace_nr;
-extern cfs_mutex_t ldlm_srv_namespace_lock;
+extern struct mutex ldlm_srv_namespace_lock;
 extern cfs_list_t ldlm_srv_namespace_list;
-extern cfs_mutex_t ldlm_cli_namespace_lock;
+extern struct mutex ldlm_cli_namespace_lock;
 extern cfs_list_t ldlm_cli_namespace_list;
 
 static inline cfs_atomic_t *ldlm_namespace_nr(ldlm_side_t client)
@@ -55,18 +55,13 @@ static inline cfs_list_t *ldlm_namespace_list(ldlm_side_t client)
                 &ldlm_srv_namespace_list : &ldlm_cli_namespace_list;
 }
 
-static inline cfs_mutex_t *ldlm_namespace_lock(ldlm_side_t client)
+static inline struct mutex *ldlm_namespace_lock(ldlm_side_t client)
 {
         return client == LDLM_NAMESPACE_SERVER ?
                 &ldlm_srv_namespace_lock : &ldlm_cli_namespace_lock;
 }
 
 /* ldlm_request.c */
-typedef enum {
-        LDLM_ASYNC,
-        LDLM_SYNC,
-} ldlm_sync_t;
-
 /* Cancel lru flag, it indicates we cancel aged locks. */
 enum {
         LDLM_CANCEL_AGED   = 1 << 0, /* Cancel aged locks (non lru resize). */
@@ -77,8 +72,8 @@ enum {
                                       * sending nor waiting for any rpcs) */
 };
 
-int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_sync_t sync,
-                    int flags);
+int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr,
+                   ldlm_cancel_flags_t sync, int flags);
 int ldlm_cancel_lru_local(struct ldlm_namespace *ns,
                           cfs_list_t *cancels, int count, int max,
                           ldlm_cancel_flags_t cancel_flags, int flags);
@@ -110,13 +105,15 @@ typedef enum {
 } ldlm_desc_ast_t;
 
 void ldlm_grant_lock(struct ldlm_lock *lock, cfs_list_t *work_list);
+int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
+                 enum req_location loc, void *data, int size);
 struct ldlm_lock *
 ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *,
                  ldlm_type_t type, ldlm_mode_t,
                  const struct ldlm_callback_suite *cbs,
-                 void *data, __u32 lvb_len);
+                void *data, __u32 lvb_len, enum lvb_type lvb_type);
 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
-                               void *cookie, int *flags);
+                              void *cookie, __u64 *flags);
 void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode);
 void ldlm_lock_addref_internal_nolock(struct ldlm_lock *, __u32 mode);
 void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode);
@@ -142,34 +139,39 @@ void ldlm_cancel_locks_for_export(struct obd_export *export);
 /* ldlm_lockd.c */
 int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
                            struct ldlm_lock *lock);
-int ldlm_bl_to_thread_list(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
-                           cfs_list_t *cancels, int count, int mode);
+int ldlm_bl_to_thread_list(struct ldlm_namespace *ns,
+                          struct ldlm_lock_desc *ld,
+                          cfs_list_t *cancels, int count,
+                          ldlm_cancel_flags_t cancel_flags);
 
 void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
                              struct ldlm_lock_desc *ld, struct ldlm_lock *lock);
 
 #ifdef HAVE_SERVER_SUPPORT
 /* ldlm_plain.c */
-int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                            ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_plain_lock(struct ldlm_lock *lock, __u64 *flags,
+                           int first_enq, ldlm_error_t *err,
+                           cfs_list_t *work_list);
 
 /* ldlm_inodebits.c */
-int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
+int ldlm_process_inodebits_lock(struct ldlm_lock *lock, __u64 *flags,
                                 int first_enq, ldlm_error_t *err,
                                 cfs_list_t *work_list);
 #endif
 
 /* ldlm_extent.c */
 #ifdef HAVE_SERVER_SUPPORT
-int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
-                             ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_extent_lock(struct ldlm_lock *lock, __u64 *flags,
+                            int first_enq, ldlm_error_t *err,
+                            cfs_list_t *work_list);
 #endif
 void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock);
 void ldlm_extent_unlink_lock(struct ldlm_lock *lock);
 
 /* ldlm_flock.c */
-int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
-                            ldlm_error_t *err, cfs_list_t *work_list);
+int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,
+                           int first_enq, ldlm_error_t *err,
+                           cfs_list_t *work_list);
 int ldlm_init_flock_export(struct obd_export *exp);
 void ldlm_destroy_flock_export(struct obd_export *exp);
 
@@ -224,9 +226,9 @@ typedef enum ldlm_policy_res ldlm_policy_res_t;
                 struct ldlm_pool *pl = data;                                \
                 type tmp;                                                   \
                                                                             \
-                cfs_spin_lock(&pl->pl_lock);                                \
-                tmp = pl->pl_##var;                                         \
-                cfs_spin_unlock(&pl->pl_lock);                              \
+               spin_lock(&pl->pl_lock);                                    \
+               tmp = pl->pl_##var;                                         \
+               spin_unlock(&pl->pl_lock);                                  \
                                                                             \
                 return lprocfs_rd_uint(page, start, off, count, eof, &tmp); \
         }                                                                   \
@@ -246,9 +248,9 @@ typedef enum ldlm_policy_res ldlm_policy_res_t;
                         return rc;                                          \
                 }                                                           \
                                                                             \
-                cfs_spin_lock(&pl->pl_lock);                                \
-                pl->pl_##var = tmp;                                         \
-                cfs_spin_unlock(&pl->pl_lock);                              \
+               spin_lock(&pl->pl_lock);                                    \
+               pl->pl_##var = tmp;                                         \
+               spin_unlock(&pl->pl_lock);                                  \
                                                                             \
                 return rc;                                                  \
         }                                                                   \