1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
13 #include <linux/list.h>
14 #include <linux/smp_lock.h>
16 #include <linux/lustre_idl.h>
18 struct obd_conn_info {
19 unsigned int conn_id; /* handle */
23 struct list_head typ_chain;
24 struct obd_ops *typ_ops;
30 struct vfsmount *pwdmnt;
36 struct obd_device *oc_dev;
40 struct obd_devicename {
43 struct dentry *dentry; /* file system obd device names */
44 __u8 _uuid[16]; /* uuid obd device names */
48 /* Individual type definitions */
51 struct super_block *e2_sb;
52 struct vfsmount *e2_vfsmnt;
57 struct super_block *fo_sb;
58 struct vfsmount *fo_vfsmnt;
59 struct obd_run_ctxt fo_ctxt;
60 struct dentry *fo_dentry_O;
61 struct dentry *fo_dentry_O_mode[16];
64 struct file_operations *fo_fop;
65 struct inode_operations *fo_iop;
66 struct address_space_operations *fo_aops;
69 struct mds_client_info;
70 struct mds_server_data;
73 struct ptlrpc_client *mdc_client;
74 struct ptlrpc_client *mdc_ldlm_client;
75 struct ptlrpc_connection *mdc_conn;
76 __u8 mdc_target_uuid[37];
80 struct ldlm_namespace *mds_local_namespace;
81 struct ptlrpc_service *mds_service;
82 struct ptlrpc_client *mds_ldlm_client; /* to be an LDLM client */
83 struct ptlrpc_connection *mds_ldlm_conn; /* to be an LDLM client */
86 struct super_block *mds_sb;
87 struct super_operations *mds_sop;
88 struct vfsmount *mds_vfsmnt;
89 struct obd_run_ctxt mds_ctxt;
90 struct file_operations *mds_fop;
91 struct inode_operations *mds_iop;
92 struct address_space_operations *mds_aops;
93 struct mds_fs_operations *mds_fsops;
94 struct file *mds_rcvd_filp;
95 __u64 mds_last_committed;
97 __u64 mds_mount_count;
98 struct ll_fid mds_rootfid;
100 struct list_head mds_client_info;
101 struct mds_server_data *mds_server_data;
105 struct ptlrpc_service *ldlm_service;
106 struct ptlrpc_client *ldlm_client;
107 struct ptlrpc_connection *ldlm_server_conn;
112 struct super_block *eo_sb;
113 struct vfsmount *eo_vfsmnt;
114 struct obd_run_ctxt eo_ctxt;
117 struct file_operations *eo_fop;
118 struct inode_operations *eo_iop;
119 struct address_space_operations *eo_aops;
123 time_t recovd_waketime;
124 time_t recovd_timeout;
125 struct ptlrpc_service *recovd_service;
126 struct ptlrpc_client *recovd_client;
128 __u32 recovd_wakeup_flag;
129 spinlock_t recovd_lock;
130 struct list_head recovd_clients_lh; /* clients managed */
131 struct list_head recovd_troubled_lh; /* clients in trouble */
132 wait_queue_head_t recovd_recovery_waitq;
133 wait_queue_head_t recovd_ctl_waitq;
134 wait_queue_head_t recovd_waitq;
135 struct task_struct *recovd_thread;
139 struct obdtrace_opstats *stats;
144 unsigned int snap_index; /* which snapshot index are we accessing */
149 unsigned int raid1_count; /* how many replicas */
150 /* devices to replicate on */
151 struct obd_device *raid1_devlist[MAX_RAID1];
152 /* connections we make */
153 struct obd_conn_info raid1_connections[MAX_RAID1];
154 struct list_head raid1_clients; /* clients we have */
159 struct ptlrpc_service *ost_service;
160 struct obd_device *ost_tgt; /* the exported OBD */
161 struct obd_conn ost_conn; /* the local connection to the OBD */
165 struct obd_device *osc_tgt;
166 struct ptlrpc_client *osc_client;
167 struct ptlrpc_client *osc_ldlm_client;
168 struct ptlrpc_connection *osc_conn;
169 __u8 osc_target_uuid[37];
172 typedef __u8 uuid_t[37];
176 __u32 lov_default_count;
177 __u32 lov_default_pattern;
178 __u32 lov_default_size;
179 uuid_t lov_service_uuids[MAX_MULTI];
183 struct obd_conn *lov_targets;
187 /* corresponds to one of the obd's */
189 struct obd_type *obd_type;
196 struct obd_devicename obd_fsname;
197 struct proc_dir_entry *obd_proc_entry;
199 struct obd_conn obd_multi_conn[MAX_MULTI];
200 unsigned int obd_gen_last_id;
201 unsigned long obd_gen_prealloc_quota;
202 struct list_head obd_gen_clients;
203 struct list_head obd_req_list;
204 wait_queue_head_t obd_req_waitq;
205 struct ldlm_namespace *obd_namespace;
207 struct ext2_obd ext2;
208 struct filter_obd filter;
213 struct ldlm_obd ldlm;
214 struct echo_obd echo;
215 struct recovd_obd recovd;
216 struct trace_obd trace;
219 struct raid1_obd raid1;
220 struct snap_obd snap;
226 int (*o_iocontrol)(long cmd, struct obd_conn *, int len, void *karg,
228 int (*o_get_info)(struct obd_conn *, obd_count keylen, void *key,
229 obd_count *vallen, void **val);
230 int (*o_set_info)(struct obd_conn *, obd_count keylen, void *key,
231 obd_count vallen, void *val);
232 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
233 int (*o_detach)(struct obd_device *dev);
234 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
235 int (*o_cleanup)(struct obd_device *dev);
236 int (*o_connect)(struct obd_conn *conn);
237 int (*o_disconnect)(struct obd_conn *conn);
240 int (*o_statfs)(struct obd_conn *conn, struct statfs *statfs);
241 int (*o_preallocate)(struct obd_conn *, obd_count *req, obd_id *ids);
242 int (*o_create)(struct obd_conn *conn, struct obdo *oa);
243 int (*o_destroy)(struct obd_conn *conn, struct obdo *oa);
244 int (*o_setattr)(struct obd_conn *conn, struct obdo *oa);
245 int (*o_getattr)(struct obd_conn *conn, struct obdo *oa);
246 int (*o_open)(struct obd_conn *conn, struct obdo *oa);
247 int (*o_close)(struct obd_conn *conn, struct obdo *oa);
248 int (*o_read)(struct obd_conn *conn, struct obdo *oa, char *buf,
249 obd_size *count, obd_off offset);
250 int (*o_write)(struct obd_conn *conn, struct obdo *oa, char *buf,
251 obd_size *count, obd_off offset);
252 int (*o_brw)(int rw, struct obd_conn *conn, obd_count num_oa,
253 struct obdo **oa, obd_count *oa_bufs, struct page **buf,
254 obd_size *count, obd_off *offset, obd_flag *flags,
256 int (*o_punch)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
258 int (*o_sync)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
260 int (*o_migrate)(struct obd_conn *conn, struct obdo *dst,
261 struct obdo *src, obd_size count, obd_off offset);
262 int (*o_copy)(struct obd_conn *dstconn, struct obdo *dst,
263 struct obd_conn *srconn, struct obdo *src,
264 obd_size count, obd_off offset);
265 int (*o_iterate)(struct obd_conn *conn, int (*)(obd_id, obd_gr, void *),
266 obd_id *startid, obd_gr group, void *data);
267 int (*o_preprw)(int cmd, struct obd_conn *conn,
268 int objcount, struct obd_ioobj *obj,
269 int niocount, struct niobuf_remote *remote,
270 struct niobuf_local *local, void **desc_private);
271 int (*o_commitrw)(int cmd, struct obd_conn *conn,
272 int objcount, struct obd_ioobj *obj,
273 int niocount, struct niobuf_local *local,
275 int (*o_enqueue)(struct obd_conn *conn,
276 struct lustre_handle *parent_lock, __u64 *res_id,
277 __u32 type, void *cookie, int cookielen, __u32 mode,
278 int *flags, void *cb, void *data, int datalen,
279 struct lustre_handle *lockh);
280 int (*o_cancel)(struct obd_conn *, __u32 mode, struct lustre_handle *);