Whamcloud - gitweb
b=6332
[fs/lustre-release.git] / lustre / osc / osc_internal.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2003 Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  */
9
10 #ifndef OSC_INTERNAL_H
11 #define OSC_INTERNAL_H
12
13 #define OAP_MAGIC 8675309
14
15 struct osc_async_page {
16         int                     oap_magic;
17         struct list_head        oap_pending_item;
18         struct list_head        oap_urgent_item;
19         struct list_head        oap_rpc_item;
20         struct page             *oap_page;
21         int                     oap_cmd;
22
23         obd_off                 oap_obj_off;
24         obd_off                 oap_page_off;
25         int                     oap_count;
26         obd_flags                oap_brw_flags;
27         enum async_flags        oap_async_flags;
28
29         unsigned long           oap_interrupted:1;
30         struct obd_io_group      *oap_oig;
31         struct oig_callback_context oap_occ;
32         struct ptlrpc_request   *oap_request;
33         struct client_obd       *oap_cli;
34         struct lov_oinfo        *oap_loi;
35
36         struct obd_async_page_ops *oap_caller_ops;
37         void                   *oap_caller_data;
38 };
39
40 #define OAP_FROM_COOKIE(c)                                                      \
41         (LASSERT(((struct osc_async_page *)(c))->oap_magic == OAP_MAGIC),       \
42          (struct osc_async_page *)(c))
43
44 struct osc_cache_waiter {
45         struct list_head        ocw_entry;
46         wait_queue_head_t       ocw_waitq;
47         struct osc_async_page   *ocw_oap;
48         int                     ocw_rc;
49 };
50
51 #define OSCC_FLAG_RECOVERING         0x01
52 #define OSCC_FLAG_CREATING           0x02
53 #define OSCC_FLAG_NOSPC              0x04 /* can't create more objects on OST */
54 #define OSCC_FLAG_SYNC_IN_PROGRESS   0x08 /* only allow one thread to sync */
55 #define OSCC_FLAG_LOW                0x10
56 #define OSCC_FLAG_EXITING            0x20
57
58 int osc_create(struct obd_export *exp, struct obdo *oa,
59                void *acl, int acl_size,
60                struct lov_stripe_md **ea, struct obd_trans_info *oti);
61 int osc_real_create(struct obd_export *exp, struct obdo *oa,
62                struct lov_stripe_md **ea, struct obd_trans_info *oti);
63 void oscc_init(struct obd_device *obd);
64 void osc_wake_cache_waiters(struct client_obd *cli);
65
66 #ifdef __KERNEL__
67 int lproc_osc_attach_seqstat(struct obd_device *dev);
68 #else
69 static inline int lproc_osc_attach_seqstat(struct obd_device *dev) {return 0;}
70 #endif
71
72 #endif /* OSC_INTERNAL_H */