Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[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
18 struct mds_export_data {
19         struct list_head        med_open_head;
20         spinlock_t              med_open_lock;
21         struct mds_client_data *med_mcd;
22         loff_t                  med_off;
23         int                     med_idx;
24 };
25
26 struct ldlm_export_data {
27         struct list_head       led_held_locks; /* protected by namespace lock */
28         struct obd_import     *led_import;
29 };
30
31 struct lov_export_data {
32         spinlock_t       led_lock;
33         struct list_head led_open_head;
34 };
35
36 struct ec_export_data { /* echo client */
37         struct list_head eced_open_head;
38         struct list_head eced_locks;
39 };
40
41 /* In-memory access to client data from OST struct */
42 struct filter_client_data;
43 struct filter_export_data {
44         struct list_head           fed_open_head; //files to close on disconnect
45         spinlock_t                 fed_lock;      /* protects fed_open_head */
46         struct filter_client_data *fed_fcd;
47         loff_t                     fed_lr_off;
48         int                        fed_lr_idx;
49 };
50
51 struct obd_export {
52         struct portals_handle     exp_handle;
53         atomic_t                  exp_refcount;
54         struct obd_uuid           exp_client_uuid;
55         struct list_head          exp_obd_chain;
56         struct obd_device        *exp_obd;
57         struct ptlrpc_connection *exp_connection;
58         struct ldlm_export_data   exp_ldlm_data;
59         struct ptlrpc_request    *exp_outstanding_reply;
60         time_t                    exp_last_request_time;
61         spinlock_t                exp_lock; /* protects flags int below */
62         int                       exp_failed:1;
63         int                       exp_flags;
64         union {
65                 struct mds_export_data    eu_mds_data;
66                 struct filter_export_data eu_filter_data;
67                 struct lov_export_data    eu_lov_data;
68                 struct ec_export_data     eu_ec_data;
69         } u;
70 };
71
72 #define exp_mds_data    u.eu_mds_data
73 #define exp_lov_data    u.eu_lov_data
74 #define exp_filter_data u.eu_filter_data
75 #define exp_ec_data     u.eu_ec_data
76
77 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
78 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
79
80 #endif /* __EXPORT_H */