Whamcloud - gitweb
Add missed files from previous commit.
[fs/lustre-release.git] / lustre / include / lustre_cache.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef LUSTRE_CACHE_H
6 #define LUSTRE_CACHE_H
7 #include <obd.h>
8 #include <lustre/lustre_idl.h>
9 #include <lustre_dlm.h>
10
11 struct lustre_cache;
12 struct osc_async_page;
13 struct page_removal_cb_element {
14         struct list_head        prce_list;
15         obd_page_removal_cb_t   prce_callback;
16 };
17
18 typedef int (*cache_iterate_extents_cb_t)(struct lustre_cache *,
19                                           struct lustre_handle *,
20                                           struct osc_async_page *,
21                                           void *);
22 typedef int (*cache_iterate_locks_cb_t)(struct lustre_cache *,
23                                         struct ldlm_res_id *,
24                                         struct lustre_handle *, void *);
25
26 struct lustre_cache {
27         struct list_head         lc_locks_list;
28         spinlock_t               lc_locks_list_lock;
29         struct list_head         lc_page_removal_callback_list;
30         struct obd_device       *lc_obd;
31         obd_pin_extent_cb        lc_pin_extent_cb;
32 };
33
34 int cache_add_lock(struct lustre_cache *cache, struct lustre_handle *lockh);
35 int cache_add_extent(struct lustre_cache *cache, struct ldlm_res_id *res,
36                      struct osc_async_page *extent,
37                      struct lustre_handle *lockh);
38 void cache_remove_extent(struct lustre_cache *, struct osc_async_page *);
39 int cache_add_extent_removal_cb(struct lustre_cache *cache,
40                                 obd_page_removal_cb_t func_cb,
41                                 obd_pin_extent_cb pin_cb);
42 int cache_del_extent_removal_cb(struct lustre_cache *cache,
43                                 obd_page_removal_cb_t func_cb);
44 int cache_iterate_extents(struct lustre_cache *cache, struct lustre_handle *lockh,
45                           cache_iterate_extents_cb_t cb_func, void *data);
46 int cache_remove_lock(struct lustre_cache *cache, struct lustre_handle *lockh);
47 int cache_iterate_locks(struct lustre_cache *cache, struct ldlm_res_id *res,
48                         cache_iterate_locks_cb_t cb_fun, void *data);
49 struct lustre_cache *cache_create(struct obd_device *obd);
50 int cache_destroy(struct lustre_cache *cache);
51
52
53 #endif /* LUSTRE_CACHE_H */