Whamcloud - gitweb
ec36e7215c2818f857276b8bb43a2247dad6e443
[fs/lustre-release.git] / lustre / include / linux / lustre_export.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2001  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 __EXPORT_H
11 #define __EXPORT_H
12
13 #include <linux/lustre_idl.h>
14 #include <linux/lustre_dlm.h>
15
16 struct mds_client_data;
17 struct mds_idmap_table;
18
19 struct mds_export_data {
20         struct list_head        med_open_head;
21         spinlock_t              med_open_lock;
22         struct mds_client_data *med_mcd;
23         loff_t                  med_off;
24         int                     med_idx;
25         unsigned int            med_initialized:1,
26                                 med_remote:1;
27         __u32                   med_nllu;
28         __u32                   med_nllg;
29         struct mds_idmap_table *med_idmap;
30 };
31
32 struct osc_creator {
33         spinlock_t              oscc_lock;
34         struct list_head        oscc_list;
35         struct obd_device       *oscc_obd;
36         obd_id                  oscc_last_id;//last available pre-created object
37         obd_id                  oscc_next_id;// what object id to give out next
38         obd_id                  oscc_gr;
39         int                     oscc_grow_count;
40         int                     oscc_max_grow_count;
41         int                     oscc_kick_barrier;
42         struct osc_created     *oscc_osccd;
43         struct obdo             oscc_oa;
44         int                     oscc_flags;
45         wait_queue_head_t       oscc_waitq; /* creating procs wait on this */
46 };
47
48 struct ldlm_export_data {
49         struct list_head       led_held_locks; /* protected by namespace lock */
50 };
51
52 struct ec_export_data { /* echo client */
53         struct list_head eced_locks;
54 };
55
56 /* In-memory access to client data from OST struct */
57 struct filter_client_data;
58 struct obd_llogs;
59 struct filter_export_data {
60         spinlock_t                 fed_lock;      /* protects fed_open_head */
61         __u32                      fed_group;
62         struct filter_client_data *fed_fcd;
63         loff_t                     fed_lr_off;
64         int                        fed_lr_idx;
65         long                       fed_dirty;    /* in bytes */
66         long                       fed_grant;    /* in bytes */
67         long                       fed_pending;  /* bytes just being written */
68 };
69
70 struct obd_export {
71         struct portals_handle     exp_handle;
72         atomic_t                  exp_refcount;
73         atomic_t                  exp_rpc_count;
74         struct obd_uuid           exp_client_uuid;
75         struct list_head          exp_obd_chain;
76         struct obd_device        *exp_obd;
77         struct obd_import        *exp_imp_reverse; /* to make RPCs backwards */
78         struct ptlrpc_connection *exp_connection;
79         __u32                     exp_conn_cnt;
80         struct ldlm_export_data   exp_ldlm_data;
81         struct list_head          exp_outstanding_replies;
82         time_t                    exp_last_request_time;
83         spinlock_t                exp_lock; /* protects flags int below */
84         /* ^ protects exp_outstanding_replies too */
85         unsigned long             exp_flags;
86         int                       exp_failed:1,
87                                   exp_req_replay_needed:1,
88                                   exp_lock_replay_needed:1,
89                                   exp_libclient:1, /* liblustre client? */
90                                   exp_sync:1;
91         union {
92                 struct mds_export_data    eu_mds_data;
93                 struct filter_export_data eu_filter_data;
94                 struct ec_export_data     eu_ec_data;
95         } u;
96 };
97
98 #define exp_mds_data    u.eu_mds_data
99 #define exp_lov_data    u.eu_lov_data
100 #define exp_filter_data u.eu_filter_data
101 #define exp_ec_data     u.eu_ec_data
102
103 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
104 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
105
106 #endif /* __EXPORT_H */