1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
40 #include <lustre/lustre_idl.h>
41 #include <lustre_dlm.h>
42 #include <lprocfs_status.h>
43 #include <class_hash.h>
45 /* Data stored per client in the last_rcvd file. In le32 order. */
46 struct mds_client_data;
47 struct mdt_client_data;
48 struct mds_idmap_table;
49 struct mdt_idmap_table;
51 struct mdt_export_data {
52 struct list_head med_open_head;
53 spinlock_t med_open_lock; /* lock med_open_head, mfd_list*/
54 struct semaphore med_lcd_lock;
55 struct lsd_client_data *med_lcd;
56 __u64 med_ibits_known;
59 struct semaphore med_idmap_sem;
60 struct lustre_idmap_table *med_idmap;
65 struct list_head oscc_list;
66 struct obd_device *oscc_obd;
67 obd_id oscc_last_id;//last available pre-created object
68 obd_id oscc_next_id;// what object id to give out next
71 * Limit oscc_grow_count value, can be changed via proc fs
73 int oscc_max_grow_count;
76 cfs_waitq_t oscc_waitq; /* creating procs wait on this */
79 struct ec_export_data { /* echo client */
80 struct list_head eced_locks;
83 /* In-memory access to client data from OST struct */
84 struct filter_export_data {
85 spinlock_t fed_lock; /* protects fed_open_head */
86 struct lsd_client_data *fed_lcd;
89 long fed_dirty; /* in bytes */
90 long fed_grant; /* in bytes */
91 struct list_head fed_mod_list; /* files being modified */
92 int fed_mod_count;/* items in fed_writing list */
93 long fed_pending; /* bytes just being written */
95 struct brw_stats fed_brw_stats;
98 typedef struct nid_stat_uuid {
99 struct list_head ns_uuid_list;
100 struct obd_uuid ns_uuid;
103 typedef struct nid_stat {
105 struct hlist_node nid_hash;
106 struct list_head nid_list;
107 struct list_head nid_uuid_list;
108 struct obd_device *nid_obd;
109 struct proc_dir_entry *nid_proc;
110 struct lprocfs_stats *nid_stats;
111 struct lprocfs_stats *nid_ldlm_stats;
112 struct brw_stats *nid_brw_stats;
113 int nid_exp_ref_count;
117 OBD_OPT_FORCE = 0x0001,
118 OBD_OPT_FAILOVER = 0x0002,
119 OBD_OPT_ABORT_RECOV = 0x0004,
123 struct portals_handle exp_handle;
124 atomic_t exp_refcount;
125 atomic_t exp_rpc_count;
126 struct obd_uuid exp_client_uuid;
127 struct list_head exp_obd_chain;
128 struct hlist_node exp_uuid_hash; /* uuid-export hash*/
129 struct hlist_node exp_nid_hash; /* nid-export hash */
130 /* exp_obd_chain_timed fo ping evictor, protected by obd_dev_lock */
131 struct list_head exp_obd_chain_timed;
132 struct obd_device *exp_obd;
133 struct obd_import *exp_imp_reverse; /* to make RPCs backwards */
134 struct nid_stat *exp_nid_stats;
135 struct lprocfs_stats *exp_md_stats;
136 struct ptlrpc_connection *exp_connection;
138 lustre_hash_t *exp_lock_hash; /* existing lock hash */
139 spinlock_t exp_lock_hash_lock;
140 struct list_head exp_outstanding_replies;
141 time_t exp_last_request_time;
142 struct list_head exp_req_replay_queue;
143 spinlock_t exp_lock; /* protects flags int below */
144 /* ^ protects exp_outstanding_replies too */
145 __u64 exp_connect_flags;
146 enum obd_option exp_flags;
147 unsigned long exp_failed:1,
151 exp_req_replay_needed:1,
152 exp_lock_replay_needed:1,
156 exp_libclient:1; /* liblustre client? */
157 struct list_head exp_queued_rpc; /* RPC to be handled */
158 /* also protected by exp_lock */
159 enum lustre_sec_part exp_sp_peer;
160 struct sptlrpc_flavor exp_flvr; /* current */
161 struct sptlrpc_flavor exp_flvr_old[2]; /* about-to-expire */
162 cfs_time_t exp_flvr_expire[2]; /* seconds */
165 struct mdt_export_data eu_mdt_data;
166 struct filter_export_data eu_filter_data;
167 struct ec_export_data eu_ec_data;
171 #define exp_mdt_data u.eu_mdt_data
172 #define exp_filter_data u.eu_filter_data
173 #define exp_ec_data u.eu_ec_data
175 static inline int exp_connect_cancelset(struct obd_export *exp)
177 LASSERT(exp != NULL);
178 return !!(exp->exp_connect_flags & OBD_CONNECT_CANCELSET);
181 static inline int exp_connect_lru_resize(struct obd_export *exp)
183 LASSERT(exp != NULL);
184 return !!(exp->exp_connect_flags & OBD_CONNECT_LRU_RESIZE);
187 static inline int exp_connect_rmtclient(struct obd_export *exp)
189 LASSERT(exp != NULL);
190 return !!(exp->exp_connect_flags & OBD_CONNECT_RMT_CLIENT);
193 static inline int client_is_remote(struct obd_export *exp)
195 struct obd_import *imp = class_exp2cliimp(exp);
197 return !!(imp->imp_connect_data.ocd_connect_flags &
198 OBD_CONNECT_RMT_CLIENT);
201 static inline int imp_connect_lru_resize(struct obd_import *imp)
203 struct obd_connect_data *ocd;
205 LASSERT(imp != NULL);
206 ocd = &imp->imp_connect_data;
207 return !!(ocd->ocd_connect_flags & OBD_CONNECT_LRU_RESIZE);
210 extern struct obd_export *class_conn2export(struct lustre_handle *conn);
211 extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
213 #endif /* __EXPORT_H */