Whamcloud - gitweb
* Compiles after merging b1_4
[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
5 #ifndef OSC_INTERNAL_H
6 #define OSC_INTERNAL_H
7
8 #define OAP_MAGIC 8675309
9
10 struct osc_async_page {
11         int                     oap_magic;
12         int                     oap_cmd;
13         struct list_head        oap_pending_item;
14         struct list_head        oap_urgent_item;
15         struct list_head        oap_rpc_item;
16
17         obd_off                 oap_obj_off;
18         obd_off                 oap_page_off;
19         int                     oap_count;
20         obd_flag                oap_brw_flags;
21         enum async_flags        oap_async_flags;
22
23         unsigned long           oap_interrupted:1;
24         struct oig_callback_context oap_occ;
25         struct page             *oap_page;
26         struct obd_io_group     *oap_oig;
27         struct ptlrpc_request   *oap_request;
28         struct client_obd       *oap_cli;
29         struct lov_oinfo        *oap_loi;
30
31         struct obd_async_page_ops *oap_caller_ops;
32         void                    *oap_caller_data;
33 };
34
35 #define OAP_FROM_COOKIE(c)                                                      \
36         (LASSERT(((struct osc_async_page *)(c))->oap_magic == OAP_MAGIC),       \
37          (struct osc_async_page *)(c))
38
39 struct osc_cache_waiter {
40         struct list_head        ocw_entry;
41         wait_queue_head_t       ocw_waitq;
42         struct osc_async_page   *ocw_oap;
43         int                     ocw_rc;
44 };
45
46 #define OSCC_FLAG_RECOVERING         0x01
47 #define OSCC_FLAG_CREATING           0x02
48 #define OSCC_FLAG_NOSPC              0x04 /* can't create more objects on OST */
49 #define OSCC_FLAG_SYNC_IN_PROGRESS   0x08 /* only allow one thread to sync */
50 #define OSCC_FLAG_LOW                0x10
51 #define OSCC_FLAG_EXITING            0x20
52
53 int osc_create(struct obd_export *exp, struct obdo *oa,
54                struct lov_stripe_md **ea, struct obd_trans_info *oti);
55 int osc_real_create(struct obd_export *exp, struct obdo *oa,
56                struct lov_stripe_md **ea, struct obd_trans_info *oti);
57 void oscc_init(struct obd_device *obd);
58 void osc_wake_cache_waiters(struct client_obd *cli);
59
60 #ifdef HAVE_QUOTA_SUPPORT
61 int osc_get_quota_flag(struct client_obd *cli, unsigned int uid,
62                        unsigned int gid);
63 int osc_set_quota_flag(struct client_obd *cli,
64                        unsigned int uid, unsigned int gid,
65                        obd_flag valid, obd_flag flags);
66 int osc_qinfo_cleanup(struct client_obd *cli);
67 int osc_qinfo_init(void);
68 void osc_qinfo_exit(void);
69 int osc_quotacheck(struct obd_export *exp, struct obd_quotactl *oqctl);
70 int osc_poll_quotacheck(struct obd_export *exp, struct if_quotacheck *qchk);
71 int osc_quotactl(struct obd_export *exp, struct obd_quotactl *oqctl);
72 #else
73 static inline int osc_get_quota_flag(struct client_obd *cli,
74                        unsigned int uid, unsigned int gid)
75 {
76        return QUOTA_OK;
77 }
78 static inline int osc_set_quota_flag(struct client_obd *cli,
79                        unsigned int uid, unsigned int gid,
80                        obd_flag valid, obd_flag flags)
81 {
82         return 0;
83 }
84 static inline int osc_qinfo_cleanup(struct client_obd *cli)
85 {
86         return 0;
87 }
88 static inline int osc_qinfo_init(void)
89 {
90         return 0;
91 }
92 static inline void osc_qinfo_exit(void) {}
93 static inline int osc_quotacheck(struct obd_export *exp, struct obd_quotactl *oqctl)
94 {
95         return -ENOTSUPP;
96 }
97 static inline int osc_poll_quotacheck(struct obd_export *exp, struct if_quotacheck *qchk)
98 {
99         return -ENOTSUPP;
100 }
101 static inline int osc_quotactl(struct obd_export *exp, struct obd_quotactl *oqctl)
102 {
103         return -ENOTSUPP;
104 }
105 #endif
106
107 #ifdef LPROCFS
108 int lproc_osc_attach_seqstat(struct obd_device *dev);
109 #else
110 static inline int lproc_osc_attach_seqstat(struct obd_device *dev) {return 0;}
111 #endif
112
113 #endif /* OSC_INTERNAL_H */