Whamcloud - gitweb
Branch HEAD
[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(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld,
45                       struct ldlm_lock *lock, int flags);
46 void ldlm_handle_bl_callback(struct ldlm_namespace *ns,
47                              struct ldlm_lock_desc *ld, struct ldlm_lock *lock);
48
49 /* ldlm_plain.c */
50 int ldlm_process_plain_lock(struct ldlm_lock *lock, int *flags, int first_enq,
51                             ldlm_error_t *err, struct list_head *work_list);
52
53 /* ldlm_extent.c */
54 int ldlm_process_extent_lock(struct ldlm_lock *lock, int *flags, int first_enq,
55                              ldlm_error_t *err, struct list_head *work_list);
56
57 /* ldlm_flock.c */
58 int ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq,
59                             ldlm_error_t *err, struct list_head *work_list);
60
61 /* ldlm_inodebits.c */
62 int ldlm_process_inodebits_lock(struct ldlm_lock *lock, int *flags,
63                                 int first_enq, ldlm_error_t *err,
64                                 struct list_head *work_list);
65
66 /* l_lock.c */
67 void l_check_ns_lock(struct ldlm_namespace *ns);
68 void l_check_no_ns_lock(struct ldlm_namespace *ns);
69
70 extern cfs_proc_dir_entry_t *ldlm_svc_proc_dir;
71
72 struct ldlm_state {
73         struct ptlrpc_service *ldlm_cb_service;
74         struct ptlrpc_service *ldlm_cancel_service;
75         struct ptlrpc_client *ldlm_client;
76         struct ptlrpc_connection *ldlm_server_conn;
77         struct ldlm_bl_pool *ldlm_bl_pool;
78 };
79
80 int ldlm_init(void);
81 void ldlm_exit(void);
82