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>
15 #include <linux/proc_fs.h>
17 #include <linux/lustre_idl.h>
20 struct list_head typ_chain;
21 struct obd_ops *typ_ops;
26 typedef int (*brw_callback_t)(void *, int err, int phase);
34 /* Individual type definitions */
37 struct super_block *e2_sb;
38 struct vfsmount *e2_vfsmnt;
41 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
42 #define OBD_CTXT_DEBUG /* development-only debugging */
44 struct vfsmount *pwdmnt;
54 struct super_block *fo_sb;
55 struct vfsmount *fo_vfsmnt;
56 struct obd_run_ctxt fo_ctxt;
57 struct dentry *fo_dentry_O;
58 struct dentry *fo_dentry_O_mode[16];
61 struct file_operations *fo_fop;
62 struct inode_operations *fo_iop;
63 struct address_space_operations *fo_aops;
66 struct mds_server_data;
69 struct ptlrpc_client *cl_client;
70 struct ptlrpc_client *cl_ldlm_client;
71 struct ptlrpc_connection *cl_conn;
72 struct lustre_handle cl_exporth;
73 struct semaphore cl_sem;
75 __u8 cl_target_uuid[37];
80 struct ptlrpc_service *mds_service;
83 struct super_block *mds_sb;
84 struct super_operations *mds_sop;
85 struct vfsmount *mds_vfsmnt;
86 struct obd_run_ctxt mds_ctxt;
87 struct file_operations *mds_fop;
88 struct inode_operations *mds_iop;
89 struct address_space_operations *mds_aops;
90 struct mds_fs_operations *mds_fsops;
92 struct file *mds_rcvd_filp;
93 __u64 mds_last_committed;
95 __u64 mds_mount_count;
96 struct ll_fid mds_rootfid;
97 struct mds_server_data *mds_server_data;
101 struct ptlrpc_service *ldlm_service;
102 struct ptlrpc_client *ldlm_client;
103 struct ptlrpc_connection *ldlm_server_conn;
108 struct super_block *eo_sb;
109 struct vfsmount *eo_vfsmnt;
110 struct obd_run_ctxt eo_ctxt;
113 struct file_operations *eo_fop;
114 struct inode_operations *eo_iop;
115 struct address_space_operations *eo_aops;
119 time_t recovd_waketime;
120 time_t recovd_timeout;
121 struct ptlrpc_service *recovd_service;
122 struct ptlrpc_client *recovd_client;
124 __u32 recovd_wakeup_flag;
125 spinlock_t recovd_lock;
126 struct list_head recovd_clients_lh; /* clients managed */
127 struct list_head recovd_troubled_lh; /* clients in trouble */
128 wait_queue_head_t recovd_recovery_waitq;
129 wait_queue_head_t recovd_ctl_waitq;
130 wait_queue_head_t recovd_waitq;
131 struct task_struct *recovd_thread;
135 struct obdtrace_opstats *stats;
140 unsigned int snap_index; /* which snapshot index are we accessing */
147 struct ptlrpc_service *ost_service;
148 struct lustre_handle ost_conn; /* the local connection to the OBD */
152 struct lov_tgt_desc {
154 struct lustre_handle conn;
158 struct obd_device *mdcobd;
159 struct lov_desc desc;
161 struct lov_tgt_desc *tgts;
164 struct niobuf_local {
171 void *target_private;
172 struct dentry *dentry;
175 #define N_LOCAL_TEMP_PAGE 0x00000001
177 /* corresponds to one of the obd's */
179 struct obd_type *obd_type;
181 /* common and UUID name of this device */
187 struct proc_dir_entry *obd_proc_entry;
188 struct list_head obd_exports;
189 struct list_head obd_imports;
190 struct ldlm_namespace *obd_namespace;
192 struct ext2_obd ext2;
193 struct filter_obd filter;
195 struct client_obd cli;
197 // struct osc_obd osc;
198 struct ldlm_obd ldlm;
199 struct echo_obd echo;
200 struct recovd_obd recovd;
201 struct trace_obd trace;
204 struct snap_obd snap;
211 int (*o_iocontrol)(long cmd, struct lustre_handle *, int len,
212 void *karg, void *uarg);
213 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
214 obd_count *vallen, void **val);
215 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
216 obd_count vallen, void *val);
217 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
218 int (*o_detach)(struct obd_device *dev);
219 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
220 int (*o_cleanup)(struct obd_device *dev);
221 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
223 int (*o_disconnect)(struct lustre_handle *conn);
226 int (*o_statfs)(struct lustre_handle *conn, struct statfs *statfs);
227 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
229 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
230 struct lov_stripe_md **ea);
231 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
232 struct lov_stripe_md *ea);
233 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
234 struct lov_stripe_md *ea);
235 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
236 struct lov_stripe_md *ea);
237 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
238 struct lov_stripe_md *);
239 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
240 struct lov_stripe_md *);
241 int (*o_brw)(int rw, struct lustre_handle *conn,
242 struct lov_stripe_md *md, obd_count oa_bufs,
243 struct brw_page *pgarr, brw_callback_t callback,
245 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
246 struct lov_stripe_md *md, obd_size count,
248 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
249 obd_size count, obd_off offset);
250 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
251 struct obdo *src, obd_size count, obd_off offset);
252 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
253 struct lustre_handle *srconn, struct obdo *src,
254 obd_size count, obd_off offset);
255 int (*o_iterate)(struct lustre_handle *conn,
256 int (*)(obd_id, obd_gr, void *),
257 obd_id *startid, obd_gr group, void *data);
258 int (*o_preprw)(int cmd, struct lustre_handle *conn,
259 int objcount, struct obd_ioobj *obj,
260 int niocount, struct niobuf_remote *remote,
261 struct niobuf_local *local, void **desc_private);
262 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
263 int objcount, struct obd_ioobj *obj,
264 int niocount, struct niobuf_local *local,
266 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
267 struct lustre_handle *parent_lock,
268 __u32 type, void *cookie, int cookielen, __u32 mode,
269 int *flags, void *cb, void *data, int datalen,
270 struct lustre_handle *lockh);
271 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md, __u32 mode, struct lustre_handle *);