These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / lustre / lustre / include / lustre_dlm.h
index bac9902..0e75a15 100644 (file)
@@ -64,7 +64,6 @@ struct obd_device;
 
 #define LDLM_DEFAULT_LRU_SIZE (100 * num_online_cpus())
 #define LDLM_DEFAULT_MAX_ALIVE (cfs_time_seconds(36000))
-#define LDLM_CTIME_AGE_LIMIT (10)
 #define LDLM_DEFAULT_PARALLEL_AST_LIMIT 1024
 
 /**
@@ -211,7 +210,6 @@ struct ldlm_pool_ops {
        /** Cancel at least \a nr locks from pool \a pl */
        int (*po_shrink)(struct ldlm_pool *pl, int nr,
                         gfp_t gfp_mask);
-       int (*po_setup)(struct ldlm_pool *pl, int limit);
 };
 
 /** One second for pools thread check interval. Each pool has own period. */
@@ -232,8 +230,8 @@ struct ldlm_pool_ops {
  * This feature is commonly referred to as lru_resize.
  */
 struct ldlm_pool {
-       /** Pool proc directory. */
-       struct proc_dir_entry   *pl_proc_dir;
+       /** Pool debugfs directory. */
+       struct dentry           *pl_debugfs_entry;
        /** Pool name, must be long enough to hold compound proc entry name. */
        char                    pl_name[100];
        /** Lock for protecting SLV/CLV updates. */
@@ -254,20 +252,20 @@ struct ldlm_pool {
         *  server_slv * lock_volume_factor. */
        atomic_t                pl_lock_volume_factor;
        /** Time when last SLV from server was obtained. */
-       time_t                  pl_recalc_time;
+       time64_t                pl_recalc_time;
        /** Recalculation period for pool. */
-       time_t                  pl_recalc_period;
+       time64_t                pl_recalc_period;
        /** Recalculation and shrink operations. */
        const struct ldlm_pool_ops      *pl_ops;
        /** Number of planned locks for next period. */
        int                     pl_grant_plan;
        /** Pool statistics. */
        struct lprocfs_stats    *pl_stats;
-};
 
-typedef int (*ldlm_res_policy)(struct ldlm_namespace *, struct ldlm_lock **,
-                              void *req_cookie, ldlm_mode_t mode, __u64 flags,
-                              void *data);
+       /* sysfs object */
+       struct kobject           pl_kobj;
+       struct completion        pl_kobj_unregister;
+};
 
 typedef int (*ldlm_cancel_for_recovery)(struct ldlm_lock *lock);
 
@@ -302,14 +300,6 @@ typedef enum {
        LDLM_NAMESPACE_MODEST = 1 << 1
 } ldlm_appetite_t;
 
-/**
- * Default values for the "max_nolock_size", "contention_time" and
- * "contended_locks" namespace tunables.
- */
-#define NS_DEFAULT_MAX_NOLOCK_BYTES 0
-#define NS_DEFAULT_CONTENTION_SECONDS 2
-#define NS_DEFAULT_CONTENDED_LOCKS 32
-
 struct ldlm_ns_bucket {
        /** back pointer to namespace */
        struct ldlm_namespace      *nsb_namespace;
@@ -390,8 +380,8 @@ struct ldlm_namespace {
        /** Client side original connect flags supported by server. */
        __u64                   ns_orig_connect_flags;
 
-       /* namespace proc dir entry */
-       struct proc_dir_entry   *ns_proc_dir_entry;
+       /* namespace debugfs dir entry */
+       struct dentry           *ns_debugfs_entry;
 
        /**
         * Position in global namespace list linking all namespaces on
@@ -421,18 +411,6 @@ struct ldlm_namespace {
        unsigned int            ns_max_unused;
        /** Maximum allowed age (last used time) for locks in the LRU */
        unsigned int            ns_max_age;
-       /**
-        * Server only: number of times we evicted clients due to lack of reply
-        * to ASTs.
-        */
-       unsigned int            ns_timeouts;
-       /**
-        * Number of seconds since the file change time after which the
-        * MDT will return an UPDATE lock along with a LOOKUP lock.
-        * This allows the client to start caching negative dentries
-        * for a directory and may save an RPC for a later stat.
-        */
-       unsigned int            ns_ctime_age_limit;
 
        /**
         * Used to rate-limit ldlm_namespace_dump calls.
@@ -441,9 +419,6 @@ struct ldlm_namespace {
         */
        unsigned long           ns_next_dump;
 
-       /** "policy" function that does actual lock conflict determination */
-       ldlm_res_policy         ns_policy;
-
        /**
         * LVB operations for this namespace.
         * \see struct ldlm_valblock_ops
@@ -466,27 +441,6 @@ struct ldlm_namespace {
        /** Definition of how eagerly unused locks will be released from LRU */
        ldlm_appetite_t         ns_appetite;
 
-       /**
-        * If more than \a ns_contended_locks are found, the resource is
-        * considered to be contended. Lock enqueues might specify that no
-        * contended locks should be granted
-        */
-       unsigned                ns_contended_locks;
-
-       /**
-        * The resources in this namespace remember contended state during
-        * \a ns_contention_time, in seconds.
-        */
-       unsigned                ns_contention_time;
-
-       /**
-        * Limit size of contended extent locks, in bytes.
-        * If extended lock is requested for more then this many bytes and
-        * caller instructs us not to grant contended locks, we would disregard
-        * such a request.
-        */
-       unsigned                ns_max_nolock_size;
-
        /** Limit of parallel AST RPC count. */
        unsigned                ns_max_parallel_ast;
 
@@ -501,33 +455,10 @@ struct ldlm_namespace {
         * recalculation of LDLM pool statistics should be skipped.
         */
        unsigned                ns_stopping:1;
-};
 
-/**
- * Returns 1 if namespace \a ns is a client namespace.
- */
-static inline int ns_is_client(struct ldlm_namespace *ns)
-{
-       LASSERT(ns != NULL);
-       LASSERT(!(ns->ns_client & ~(LDLM_NAMESPACE_CLIENT |
-                                   LDLM_NAMESPACE_SERVER)));
-       LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT ||
-               ns->ns_client == LDLM_NAMESPACE_SERVER);
-       return ns->ns_client == LDLM_NAMESPACE_CLIENT;
-}
-
-/**
- * Returns 1 if namespace \a ns is a server namespace.
- */
-static inline int ns_is_server(struct ldlm_namespace *ns)
-{
-       LASSERT(ns != NULL);
-       LASSERT(!(ns->ns_client & ~(LDLM_NAMESPACE_CLIENT |
-                                   LDLM_NAMESPACE_SERVER)));
-       LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT ||
-               ns->ns_client == LDLM_NAMESPACE_SERVER);
-       return ns->ns_client == LDLM_NAMESPACE_SERVER;
-}
+       struct kobject          ns_kobj; /* sysfs object */
+       struct completion       ns_kobj_unregister;
+};
 
 /**
  * Returns 1 if namespace \a ns supports early lock cancel (ELC).
@@ -584,6 +515,7 @@ struct ldlm_interval {
        struct list_head                li_group; /* the locks which have the same
                                           * policy - group of the policy */
 };
+
 #define to_ldlm_interval(n) container_of(n, struct ldlm_interval, li_node)
 
 /**
@@ -627,9 +559,6 @@ typedef union {
        struct ldlm_inodebits l_inodebits;
 } ldlm_policy_data_t;
 
-void ldlm_convert_policy_to_wire(ldlm_type_t type,
-                                const ldlm_policy_data_t *lpolicy,
-                                ldlm_wire_policy_data_t *wpolicy);
 void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type,
                                  const ldlm_wire_policy_data_t *wpolicy,
                                  ldlm_policy_data_t *lpolicy);
@@ -781,7 +710,7 @@ struct ldlm_lock {
         * Seconds. It will be updated if there is any activity related to
         * the lock, e.g. enqueue the lock or send blocking AST.
         */
-       unsigned long           l_last_activity;
+       time64_t                l_last_activity;
 
        /**
         * Time last used by e.g. being matched by lock match.
@@ -915,8 +844,6 @@ struct ldlm_resource {
         * @{ */
        /** List of locks in granted state */
        struct list_head                lr_granted;
-       /** List of locks waiting to change their granted mode (converted) */
-       struct list_head                lr_converting;
        /**
         * List of locks that could not be granted due to conflicts and
         * that are waiting for conflicts to go away */
@@ -1048,8 +975,7 @@ struct ldlm_enqueue_info {
 extern struct obd_ops ldlm_obd_ops;
 
 extern char *ldlm_lockname[];
-extern char *ldlm_typename[];
-extern char *ldlm_it2str(int it);
+char *ldlm_it2str(int it);
 
 /**
  * Just a fancy CDEBUG call with log level preset to LDLM_DEBUG.
@@ -1057,7 +983,7 @@ extern char *ldlm_it2str(int it);
  * with a debugging message that is ldlm-related
  */
 #define LDLM_DEBUG_NOLOCK(format, a...)                        \
-       CDEBUG(D_DLMTRACE, "### " format "\n" , ##a)
+       CDEBUG(D_DLMTRACE, "### " format "\n", ##a)
 
 /**
  * Support function for lock information printing into debug logs.
@@ -1083,7 +1009,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
 #define LDLM_DEBUG_LIMIT(mask, lock, fmt, a...) do {                    \
        static struct cfs_debug_limit_state _ldlm_cdls;                    \
        LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, &_ldlm_cdls);       \
-       ldlm_lock_debug(&msgdata, mask, &_ldlm_cdls, lock, "### " fmt , ##a);\
+       ldlm_lock_debug(&msgdata, mask, &_ldlm_cdls, lock, "### " fmt, ##a);\
 } while (0)
 
 #define LDLM_ERROR(lock, fmt, a...) LDLM_DEBUG_LIMIT(D_ERROR, lock, fmt, ## a)
@@ -1094,7 +1020,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,
        if (likely(lock != NULL)) {                                         \
                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_DLMTRACE, NULL);      \
                ldlm_lock_debug(&msgdata, D_DLMTRACE, NULL, lock,           \
-                               "### " fmt , ##a);                          \
+                               "### " fmt, ##a);                           \
        } else {                                                            \
                LDLM_DEBUG_NOLOCK("no dlm lock: " fmt, ##a);                \
        }                                                                   \
@@ -1119,10 +1045,6 @@ typedef int (*ldlm_res_iterator_t)(struct ldlm_resource *, void *);
  * LDLM provides for a way to iterate through every lock on a resource or
  * namespace or every resource in a namespace.
  * @{ */
-int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter,
-                         void *closure);
-void ldlm_namespace_foreach(struct ldlm_namespace *ns, ldlm_iterator_t iter,
-                           void *closure);
 int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *,
                          ldlm_iterator_t iter, void *data);
 /** @} ldlm_iterator */
@@ -1142,16 +1064,11 @@ struct ldlm_callback_suite {
 };
 
 /* ldlm_lockd.c */
-int ldlm_del_waiting_lock(struct ldlm_lock *lock);
-int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout);
 int ldlm_get_ref(void);
 void ldlm_put_ref(void);
-int ldlm_init_export(struct obd_export *exp);
-void ldlm_destroy_export(struct obd_export *exp);
 struct ldlm_lock *ldlm_request_lock(struct ptlrpc_request *req);
 
 /* ldlm_lock.c */
-void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg);
 void ldlm_lock2handle(const struct ldlm_lock *lock,
                      struct lustre_handle *lockh);
 struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 flags);
@@ -1197,8 +1114,7 @@ static inline int ldlm_res_lvbo_update(struct ldlm_resource *res,
 }
 
 int ldlm_error2errno(ldlm_error_t error);
-ldlm_error_t ldlm_errno2error(int err_no); /* don't call it `errno': this
-                                           * confuses user-space. */
+
 #if LUSTRE_TRACKS_LOCK_EXP_REFS
 void ldlm_dump_export_locks(struct obd_export *exp);
 #endif
@@ -1246,14 +1162,12 @@ do {                                        \
 
 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);
 void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode);
 int  ldlm_lock_addref_try(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
 void ldlm_lock_fail_match_locked(struct ldlm_lock *lock);
-void ldlm_lock_fail_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match(struct ldlm_lock *lock);
 void ldlm_lock_allow_match_locked(struct ldlm_lock *lock);
 ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
@@ -1262,12 +1176,7 @@ ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags,
                            struct lustre_handle *, int unref);
 ldlm_mode_t ldlm_revalidate_lock_handle(struct lustre_handle *lockh,
                                        __u64 *bits);
-struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
-                                       __u32 *flags);
-void ldlm_lock_downgrade(struct ldlm_lock *lock, int new_mode);
 void ldlm_lock_cancel(struct ldlm_lock *lock);
-void ldlm_reprocess_all(struct ldlm_resource *res);
-void ldlm_reprocess_all_ns(struct ldlm_namespace *ns);
 void ldlm_lock_dump_handle(int level, struct lustre_handle *);
 void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);
 
@@ -1277,26 +1186,16 @@ ldlm_namespace_new(struct obd_device *obd, char *name,
                   ldlm_side_t client, ldlm_appetite_t apt,
                   ldlm_ns_type_t ns_type);
 int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags);
-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_get(struct ldlm_namespace *ns);
 void ldlm_namespace_put(struct ldlm_namespace *ns);
-#if defined (CONFIG_PROC_FS)
-int ldlm_proc_setup(void);
-void ldlm_proc_cleanup(void);
-#else
-static inline int ldlm_proc_setup(void) { return 0; }
-static inline void ldlm_proc_cleanup(void) {}
-#endif
+int ldlm_debugfs_setup(void);
+void ldlm_debugfs_cleanup(void);
 
 /* resource.c - internal */
 struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
                                        struct ldlm_resource *parent,
                                        const struct ldlm_res_id *,
                                        ldlm_type_t type, int create);
-struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res);
 int ldlm_resource_putref(struct ldlm_resource *res);
 void ldlm_resource_add_lock(struct ldlm_resource *res,
                            struct list_head *head,
@@ -1318,16 +1217,11 @@ int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *,
 } while (0)
 
 /* ldlm_request.c */
-int ldlm_expired_completion_wait(void *data);
 /** \defgroup ldlm_local_ast Default AST handlers for local locks
  * These AST handlers are typically used for server-side local locks and are
  * also used by client-side lock handlers to perform minimum level base
  * processing.
  * @{ */
-int ldlm_blocking_ast_nocheck(struct ldlm_lock *lock);
-int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
-                     void *data, int flag);
-int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp);
 int ldlm_completion_ast_async(struct ldlm_lock *lock, __u64 flags, void *data);
 int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data);
 /** @} ldlm_local_ast */
@@ -1351,27 +1245,10 @@ int ldlm_prep_elc_req(struct obd_export *exp,
                      int version, int opc, int canceloff,
                      struct list_head *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,
                          struct lustre_handle *lockh, int rc);
-int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
-                          const struct ldlm_res_id *res_id,
-                          ldlm_type_t type, ldlm_policy_data_t *policy,
-                          ldlm_mode_t mode, __u64 *flags,
-                          ldlm_blocking_callback blocking,
-                          ldlm_completion_callback completion,
-                          ldlm_glimpse_callback glimpse,
-                          void *data, __u32 lvb_len, enum lvb_type lvb_type,
-                          const __u64 *client_cookie,
-                          struct lustre_handle *lockh);
-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,
                    ldlm_cancel_flags_t cancel_flags);
@@ -1383,8 +1260,6 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
                                    ldlm_mode_t mode,
                                    ldlm_cancel_flags_t flags,
                                    void *opaque);
-int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *head,
-                       int count, ldlm_cancel_flags_t flags);
 int ldlm_cancel_resource_local(struct ldlm_resource *res,
                               struct list_head *cancels,
                               ldlm_policy_data_t *policy,
@@ -1401,7 +1276,6 @@ int ldlm_cli_cancel_list(struct list_head *head, int count,
 int intent_disposition(struct ldlm_reply *rep, int flag);
 void intent_set_disposition(struct ldlm_reply *rep, int flag);
 
-
 /* ioctls for trying requests */
 #define IOC_LDLM_TYPE             'f'
 #define IOC_LDLM_MIN_NR                 40
@@ -1454,24 +1328,12 @@ void unlock_res_and_lock(struct ldlm_lock *lock);
  * There are not used outside of ldlm.
  * @{
  */
-int ldlm_pools_recalc(ldlm_side_t client);
 int ldlm_pools_init(void);
 void ldlm_pools_fini(void);
 
 int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
                   int idx, ldlm_side_t client);
-int ldlm_pool_shrink(struct ldlm_pool *pl, int nr,
-                    gfp_t gfp_mask);
 void ldlm_pool_fini(struct ldlm_pool *pl);
-int ldlm_pool_setup(struct ldlm_pool *pl, int limit);
-int ldlm_pool_recalc(struct ldlm_pool *pl);
-__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl);
-__u64 ldlm_pool_get_slv(struct ldlm_pool *pl);
-__u64 ldlm_pool_get_clv(struct ldlm_pool *pl);
-__u32 ldlm_pool_get_limit(struct ldlm_pool *pl);
-void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv);
-void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv);
-void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit);
 void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock);
 void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock);
 /** @} */