Whamcloud - gitweb
d650df21ffcb496f79e6172e45df60d23314259e
[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 /* Cancel lru flag, it indicates we cancel aged locks. */
12 #define LDLM_CANCEL_AGED 0x00000001
13
14 int ldlm_cancel_lru(struct ldlm_namespace *ns, ldlm_sync_t sync);
15 int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
16                           int count, int max, int flags);
17
18 /* ldlm_resource.c */
19 int ldlm_resource_putref_locked(struct ldlm_resource *res);
20 void ldlm_resource_insert_lock_after(struct ldlm_lock *original,
21                                      struct ldlm_lock *new);
22
23 /* ldlm_lock.c */
24 void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list);
25 struct ldlm_lock *
26 ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *,
27                  ldlm_type_t type, ldlm_mode_t, ldlm_blocking_callback,
28                  ldlm_completion_callback, ldlm_glimpse_callback, void *data,
29                  __u32 lvb_len);
30 ldlm_error_t ldlm_lock_enqueue(struct ldlm_namespace *, struct ldlm_lock **,
31                                void *cookie, int *flags);
32 void ldlm_lock_addref_internal(struct ldlm_lock *, __u32 mode);
33 void ldlm_lock_decref_internal(struct ldlm_lock *, __u32 mode);
34 void ldlm_add_ast_work_item(struct ldlm_lock *lock, struct ldlm_lock *new,
35                                 struct list_head *work_list);
36 int ldlm_reprocess_queue(struct ldlm_resource *res, struct list_head *queue,
37                          struct list_head *work_list);
38 int ldlm_run_bl_ast_work(struct list_head *rpc_list);
39 int ldlm_run_cp_ast_work(struct list_head *rpc_list);
40 int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock);
41 void ldlm_lock_destroy_nolock(struct ldlm_lock *lock);
42
43 /* ldlm_lockd.c */
44 int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
45                            struct ldlm_lock *lock);
46 int ldlm_bl_to_thread_list(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
47                            struct list_head *cancels, int count);
48
49 void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
50                              struct ldlm_lock_desc *ld, struct ldlm_lock *lock);
51
52 /* ldlm_plain.c */
53 int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
54                             ldlm_error_t *err, struct list_head *work_list);
55
56 /* ldlm_extent.c */
57 int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
58                              ldlm_error_t *err, struct list_head *work_list);
59
60 /* ldlm_flock.c */
61 int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
62                             ldlm_error_t *err, struct list_head *work_list);
63
64 /* ldlm_inodebits.c */
65 int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
66                                 int first_enq, ldlm_error_t *err,
67                                 struct list_head *work_list);
68
69 /* l_lock.c */
70 void l_check_ns_lock(struct ldlm_namespace *ns);
71 void l_check_no_ns_lock(struct ldlm_namespace *ns);
72
73 extern cfs_proc_dir_entry_t *ldlm_svc_proc_dir;
74
75 struct ldlm_state {
76         struct ptlrpc_service *ldlm_cb_service;
77         struct ptlrpc_service *ldlm_cancel_service;
78         struct ptlrpc_client *ldlm_client;
79         struct ptlrpc_connection *ldlm_server_conn;
80         struct ldlm_bl_pool *ldlm_bl_pool;
81 };
82
83 int ldlm_init(void);
84 void ldlm_exit(void);
85