Whamcloud - gitweb
4a900d97f3ebdf19996d8f16254b92e1470b9573
[fs/lustre-release.git] / lustre / ldlm / ldlm_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 /* ldlm_request.c */
6 typedef enum {
7         LDLM_ASYNC,
8         LDLM_SYNC,
9 } ldlm_sync_t;
10
11 int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync);
12
13 /* ldlm_resource.c */
14 int ldlm_resource_putref_locked(struct ldlm_resource *res);
15 void ldlm_resource_insert_lock_after(struct ldlm_lock *original,
16                                      struct ldlm_lock *new);
17
18 /* ldlm_lock.c */
19 void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
20 struct ldlm_lock *
21 ldlm_lock_create(struct ldlm_namespace *ns,
22                  const struct lustre_handle *parent_lock_handle,
23                  const struct ldlm_res_id *,
24                  ldlm_type_t type, ldlm_mode_t, ldlm_blocking_callback,
25                  ldlm_completion_callback, ldlm_glimpse_callback, void *data,
26                  __u32 lvb_len);
27 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
28                                void *cookie, int *flags);
29 void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode);
30 void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode);
31 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
32                                 struct list_head *work_list);
33 int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue,
34                          struct list_head *work_list);
35 int ldlm_run_bl_ast_work(struct list_head *rpc_list);
36 int ldlm_run_cp_ast_work(struct list_head *rpc_list);
37 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
38 void ldlm_lock_destroy_nolock(struct ldlm_lock *lock);
39
40 /* ldlm_lockd.c */
41 int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
42                       struct ldlm_lock *lock);
43 void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
44                              struct ldlm_lock_desc *ld, struct ldlm_lock *lock);
45
46 /* ldlm_plain.c */
47 int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
48                             ldlm_error_t *err, struct list_head *work_list);
49
50 /* ldlm_extent.c */
51 int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
52                              ldlm_error_t *err, struct list_head *work_list);
53
54 /* ldlm_flock.c */
55 int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
56                             ldlm_error_t *err, struct list_head *work_list);
57
58 /* ldlm_inodebits.c */
59 int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
60                                 int first_enq, ldlm_error_t *err,
61                                 struct list_head *work_list);
62
63 /* l_lock.c */
64 void l_check_ns_lock(struct ldlm_namespace *ns);
65 void l_check_no_ns_lock(struct ldlm_namespace *ns);
66
67 extern cfs_proc_dir_entry_t *ldlm_svc_proc_dir;
68
69 struct ldlm_state {
70         struct ptlrpc_service *ldlm_cb_service;
71         struct ptlrpc_service *ldlm_cancel_service;
72         struct ptlrpc_client *ldlm_client;
73         struct ptlrpc_connection *ldlm_server_conn;
74         struct ldlm_bl_pool *ldlm_bl_pool;
75 };
76
77 int ldlm_init(void);
78 void ldlm_exit(void);
79