Whamcloud - gitweb
8cc24b90562b83fdd013d1ce276e25c3ebc2a1f6
[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 osc_creator {
27         spinlock_t              oscc_lock;
28         struct list_head        oscc_list;
29         struct obd_device       *oscc_obd;
30         obd_id                  oscc_last_id;//last available pre-created object
31         obd_id                  oscc_next_id;// what object id to give out next
32         obd_id                  oscc_gr;
33         int                     oscc_initial_create_count;
34         int                     oscc_grow_count;
35         int                     oscc_kick_barrier;
36         struct osc_created     *oscc_osccd;
37         struct obdo             oscc_oa;
38         int                     oscc_flags;
39         wait_queue_head_t       oscc_waitq; /* creating procs wait on this */
40 };
41
42 struct ldlm_export_data {
43         struct list_head       led_held_locks; /* protected by namespace lock */
44 };
45
46 struct ec_export_data { /* echo client */
47         struct list_head eced_locks;
48 };
49
50 /* In-memory access to client data from OST struct */
51 struct filter_client_data;
52 struct obd_llogs;
53 struct filter_export_data {
54         spinlock_t                 fed_lock;      /* protects fed_open_head */
55         __u32                      fed_group;
56         struct filter_client_data *fed_fcd;
57         loff_t                     fed_lr_off;
58         int                        fed_lr_idx;
59         unsigned long              fed_dirty;    /* in bytes */
60         unsigned long              fed_grant;    /* in bytes */
61         unsigned long              fed_pending;  /* bytes just being written */
62 };
63
64 struct obd_export {
65         struct portals_handle     exp_handle;
66         atomic_t                  exp_refcount;
67         atomic_t                  exp_rpc_count;
68         struct obd_uuid           exp_client_uuid;
69         struct list_head          exp_obd_chain;
70         struct obd_device        *exp_obd;
71         struct obd_import        *exp_imp_reverse; /* to make RPCs backwards */
72         struct ptlrpc_connection *exp_connection;
73         __u32                     exp_conn_cnt;
74         struct ldlm_export_data   exp_ldlm_data;
75         struct list_head          exp_outstanding_replies;
76         time_t                    exp_last_request_time;
77         spinlock_t                exp_lock; /* protects flags int below */
78         /* ^ protects exp_outstanding_replies too */
79         int                       exp_flags;
80         int                       exp_failed:1;
81         int                       exp_libclient:1; /* liblustre client? */
82         union {
83                 struct mds_export_data    eu_mds_data;
84                 struct filter_export_data eu_filter_data;
85                 struct ec_export_data     eu_ec_data;
86         } u;
87 };
88
89 #define exp_mds_data    u.eu_mds_data
90 #define exp_lov_data    u.eu_lov_data
91 #define exp_filter_data u.eu_filter_data
92 #define exp_ec_data     u.eu_ec_data
93
94 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
95 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
96
97 #endif /* __EXPORT_H */