Whamcloud - gitweb
- merge with 1_5,some fixes.
[fs/lustre-release.git] / lustre / include / lustre_export.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  */
4
5 #ifndef __EXPORT_H
6 #define __EXPORT_H
7
8 #include <lustre/lustre_idl.h>
9 #include <lustre_dlm.h>
10
11 /* Data stored per client in the last_rcvd file.  In le32 order. */
12 struct mds_client_data;
13 struct mdt_client_data;
14
15 struct mds_export_data {
16         struct list_head        med_open_head;
17         spinlock_t              med_open_lock; /* lock med_open_head, mfd_list*/
18         struct mds_client_data *med_mcd;
19         __u64                   med_ibits_known;
20         loff_t                  med_lr_off;
21         int                     med_lr_idx;
22 };
23
24 struct mdt_export_data {
25         struct list_head        med_open_head;
26         spinlock_t              med_open_lock; /* lock med_open_head, mfd_list*/
27         struct semaphore        med_mcd_lock; 
28         struct mdt_client_data *med_mcd;
29         __u64                   med_ibits_known;
30         loff_t                  med_lr_off;
31         int                     med_lr_idx;
32 };
33 struct osc_creator {
34         spinlock_t              oscc_lock;
35         struct list_head        oscc_list;
36         struct obd_device       *oscc_obd;
37         obd_id                  oscc_last_id;//last available pre-created object
38         obd_id                  oscc_next_id;// what object id to give out next
39         int                     oscc_grow_count;
40         struct obdo             oscc_oa;
41         int                     oscc_flags;
42         cfs_waitq_t             oscc_waitq; /* creating procs wait on this */
43 };
44
45 struct ldlm_export_data {
46         struct list_head       led_held_locks; /* protected by namespace lock */
47         spinlock_t             led_lock;
48 };
49
50 struct ec_export_data { /* echo client */
51         struct list_head eced_locks;
52 };
53
54 /* In-memory access to client data from OST struct */
55 struct filter_client_data;
56 struct filter_export_data {
57         spinlock_t                 fed_lock;      /* protects fed_open_head */
58         struct filter_client_data *fed_fcd;
59         loff_t                     fed_lr_off;
60         int                        fed_lr_idx;
61         long                       fed_dirty;    /* in bytes */
62         long                       fed_grant;    /* in bytes */
63         struct list_head           fed_mod_list; /* files being modified */
64         int                        fed_mod_count;/* items in fed_writing list */
65         long                       fed_pending;  /* bytes just being written */
66 };
67
68 struct obd_export {
69         struct portals_handle     exp_handle;
70         atomic_t                  exp_refcount;
71         struct obd_uuid           exp_client_uuid;
72         struct list_head          exp_obd_chain;
73         /* exp_obd_chain_timed fo ping evictor, protected by obd_dev_lock */
74         struct list_head          exp_obd_chain_timed;
75         struct obd_device        *exp_obd;
76         struct obd_import        *exp_imp_reverse; /* to make RPCs backwards */
77         struct ptlrpc_connection *exp_connection;
78         __u32                     exp_conn_cnt;
79         struct ldlm_export_data   exp_ldlm_data;
80         struct list_head          exp_outstanding_replies;
81         time_t                    exp_last_request_time;
82         spinlock_t                exp_lock; /* protects flags int below */
83         /* ^ protects exp_outstanding_replies too */
84         __u64                     exp_connect_flags;
85         int                       exp_flags;
86         unsigned int              exp_failed:1,
87                                   exp_disconnected:1,
88                                   exp_connecting:1,
89                                   exp_replay_needed:1,
90                                   exp_libclient:1; /* liblustre client? */
91         union {
92                 struct mds_export_data    eu_mds_data;
93                 struct mdt_export_data    eu_mdt_data;
94                 struct filter_export_data eu_filter_data;
95                 struct ec_export_data     eu_ec_data;
96         } u;
97 };
98
99 #define exp_mds_data    u.eu_mds_data
100 #define exp_mdt_data    u.eu_mdt_data
101 #define exp_lov_data    u.eu_lov_data
102 #define exp_filter_data u.eu_filter_data
103 #define exp_ec_data     u.eu_ec_data
104
105 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
106 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
107
108 #endif /* __EXPORT_H */