Whamcloud - gitweb
(1) Drop unnecessary permission check for name_{insert,remove}.
[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 struct mds_idmap_table;
15 struct mdt_idmap_table;
16
17 struct mds_export_data {
18         struct list_head        med_open_head;
19         spinlock_t              med_open_lock; /* lock med_open_head, mfd_list*/
20         struct mds_client_data *med_mcd;
21         __u64                   med_ibits_known;
22         loff_t                  med_lr_off;
23         int                     med_lr_idx;
24         unsigned int            med_rmtclient:1; /* remote client? */
25         __u32                   med_nllu;
26         __u32                   med_nllg;
27         struct mds_idmap_table *med_idmap;
28 };
29
30 struct mdt_export_data {
31         struct list_head        med_open_head;
32         spinlock_t              med_open_lock; /* lock med_open_head, mfd_list*/
33         struct semaphore        med_mcd_lock; 
34         struct mdt_client_data *med_mcd;
35         __u64                   med_ibits_known;
36         loff_t                  med_lr_off;
37         int                     med_lr_idx;
38         unsigned int            med_rmtclient:1; /* remote client? */
39         __u32                   med_nllu;
40         __u32                   med_nllg;
41         struct mdt_idmap_table *med_idmap;
42 };
43
44 struct osc_creator {
45         spinlock_t              oscc_lock;
46         struct list_head        oscc_list;
47         struct obd_device       *oscc_obd;
48         obd_id                  oscc_last_id;//last available pre-created object
49         obd_id                  oscc_next_id;// what object id to give out next
50         int                     oscc_grow_count;
51         struct obdo             oscc_oa;
52         int                     oscc_flags;
53         cfs_waitq_t             oscc_waitq; /* creating procs wait on this */
54 };
55
56 struct ldlm_export_data {
57         struct list_head       led_held_locks; /* protected by namespace lock */
58         spinlock_t             led_lock;
59 };
60
61 struct ec_export_data { /* echo client */
62         struct list_head eced_locks;
63 };
64
65 /* In-memory access to client data from OST struct */
66 struct filter_client_data;
67 struct filter_export_data {
68         spinlock_t                 fed_lock;      /* protects fed_open_head */
69         struct filter_client_data *fed_fcd;
70         loff_t                     fed_lr_off;
71         int                        fed_lr_idx;
72         long                       fed_dirty;    /* in bytes */
73         long                       fed_grant;    /* in bytes */
74         struct list_head           fed_mod_list; /* files being modified */
75         int                        fed_mod_count;/* items in fed_writing list */
76         long                       fed_pending;  /* bytes just being written */
77         __u32                      fed_group;
78 };
79
80 struct obd_export {
81         struct portals_handle     exp_handle;
82         atomic_t                  exp_refcount;
83         atomic_t                  exp_rpc_count;
84         struct obd_uuid           exp_client_uuid;
85         struct list_head          exp_obd_chain;
86         /* exp_obd_chain_timed fo ping evictor, protected by obd_dev_lock */
87         struct list_head          exp_obd_chain_timed;
88         struct obd_device        *exp_obd;
89         struct obd_import        *exp_imp_reverse; /* to make RPCs backwards */
90         struct ptlrpc_connection *exp_connection;
91         __u32                     exp_conn_cnt;
92         struct ldlm_export_data   exp_ldlm_data;
93         struct list_head          exp_outstanding_replies;
94         time_t                    exp_last_request_time;
95         spinlock_t                exp_lock; /* protects flags int below */
96         /* ^ protects exp_outstanding_replies too */
97         __u64                     exp_connect_flags;
98         int                       exp_flags;
99         unsigned int              exp_failed:1,
100                                   exp_connected:1,
101                                   exp_disconnected:1,
102                                   exp_connecting:1,
103                                   exp_req_replay_needed:1,
104                                   exp_lock_replay_needed:1,
105                                   exp_libclient:1; /* liblustre client? */
106         union {
107                 struct mds_export_data    eu_mds_data;
108                 struct mdt_export_data    eu_mdt_data;
109                 struct filter_export_data eu_filter_data;
110                 struct ec_export_data     eu_ec_data;
111         } u;
112 };
113
114 #define exp_mds_data    u.eu_mds_data
115 #define exp_mdt_data    u.eu_mdt_data
116 #define exp_lov_data    u.eu_lov_data
117 #define exp_filter_data u.eu_filter_data
118 #define exp_ec_data     u.eu_ec_data
119
120 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
121 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
122
123 #endif /* __EXPORT_H */