Whamcloud - gitweb
b=10968
[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                  struct lustre_handle *parent_lock_handle, struct ldlm_res_id,
23                  ldlm_type_t type, ldlm_mode_t, ldlm_blocking_callback,
24                  ldlm_completion_callback, ldlm_glimpse_callback, void *data,
25                  __u32 lvb_len);
26 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
27                                void *cookie, int *flags);
28 void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode);
29 void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode);
30 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
31                                 struct list_head *work_list);
32 int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue,
33                          struct list_head *work_list);
34 int ldlm_run_bl_ast_work(struct list_head *rpc_list);
35 int ldlm_run_cp_ast_work(struct list_head *rpc_list);
36 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
37 void ldlm_lock_destroy_nolock(struct ldlm_lock *lock);
38
39 /* ldlm_lockd.c */
40 int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
41                       struct ldlm_lock *lock);
42 void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
43                              struct ldlm_lock_desc *ld, struct ldlm_lock *lock);
44
45 /* ldlm_plain.c */
46 int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
47                             ldlm_error_t *err, struct list_head *work_list);
48
49 /* ldlm_extent.c */
50 int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
51                              ldlm_error_t *err, struct list_head *work_list);
52
53 /* ldlm_flock.c */
54 int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
55                             ldlm_error_t *err, struct list_head *work_list);
56
57 /* ldlm_inodebits.c */
58 int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
59                                 int first_enq, ldlm_error_t *err,
60                                 struct list_head *work_list);
61
62 /* l_lock.c */
63 void l_check_ns_lock(struct ldlm_namespace *ns);
64 void l_check_no_ns_lock(struct ldlm_namespace *ns);
65
66 extern cfs_proc_dir_entry_t *ldlm_svc_proc_dir;
67
68 struct ldlm_state {
69         struct ptlrpc_service *ldlm_cb_service;
70         struct ptlrpc_service *ldlm_cancel_service;
71         struct ptlrpc_client *ldlm_client;
72         struct ptlrpc_connection *ldlm_server_conn;
73         struct ldlm_bl_pool *ldlm_bl_pool;
74 };
75
76 int ldlm_init(void);
77 void ldlm_exit(void);
78