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_lib.h>
18 #include <linux/lustre_idl.h>
21 struct list_head typ_chain;
22 struct obd_ops *typ_ops;
34 struct lov_oinfo { /* per-child structure */
39 struct lov_stripe_md {
41 __u32 lmd_easize; /* packed size for MDS of ea */
42 __u64 lmd_object_id; /* lov object id */
43 __u64 lmd_stripe_offset; /* offset of the stripe */
44 __u64 lmd_stripe_size; /* size of the stripe */
45 __u32 lmd_stripe_count; /* how many objects are being striped */
46 __u32 lmd_stripe_pattern; /* per-lov object stripe pattern */
47 struct lov_oinfo lmd_oinfo[0];
50 struct lov_stripe_md_one {
52 __u32 lmd_easize; /* packed size for MDS of ea */
53 __u64 lmd_object_id; /* lov object id */
54 __u64 lmd_stripe_offset; /* offset of the stripe */
55 __u64 lmd_stripe_size; /* size of the stripe */
56 __u32 lmd_stripe_count; /* how many objects are being striped */
57 __u32 lmd_stripe_pattern; /* per-lov object stripe pattern */
58 struct lov_oinfo lmd_oinfo[1];
61 /* Individual type definitions */
64 struct super_block *e2_sb;
65 struct vfsmount *e2_vfsmnt;
68 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
69 #define OBD_CTXT_DEBUG /* development-only debugging */
71 struct vfsmount *pwdmnt;
80 #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
82 #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
87 struct super_block *fo_sb;
88 struct vfsmount *fo_vfsmnt;
89 struct obd_run_ctxt fo_ctxt;
90 struct dentry *fo_dentry_O;
91 struct dentry *fo_dentry_O_mode[16];
94 struct file_operations *fo_fop;
95 struct inode_operations *fo_iop;
96 struct address_space_operations *fo_aops;
99 struct mds_server_data;
102 struct ptlrpc_client *cl_client;
103 struct ptlrpc_client *cl_ldlm_client;
104 struct ptlrpc_connection *cl_conn;
105 struct lustre_handle cl_exporth;
106 struct semaphore cl_sem;
108 __u8 cl_target_uuid[37];
113 struct ptlrpc_service *mds_service;
116 struct super_block *mds_sb;
117 struct super_operations *mds_sop;
118 struct vfsmount *mds_vfsmnt;
119 struct obd_run_ctxt mds_ctxt;
120 struct file_operations *mds_fop;
121 struct inode_operations *mds_iop;
122 struct address_space_operations *mds_aops;
123 struct mds_fs_operations *mds_fsops;
125 struct file *mds_rcvd_filp;
126 __u64 mds_last_committed;
128 __u64 mds_mount_count;
129 struct ll_fid mds_rootfid;
130 struct mds_server_data *mds_server_data;
134 struct ptlrpc_service *ldlm_service;
135 struct ptlrpc_client *ldlm_client;
136 struct ptlrpc_connection *ldlm_server_conn;
141 struct super_block *eo_sb;
142 struct vfsmount *eo_vfsmnt;
143 struct obd_run_ctxt eo_ctxt;
146 struct file_operations *eo_fop;
147 struct inode_operations *eo_iop;
148 struct address_space_operations *eo_aops;
152 time_t recovd_waketime;
153 time_t recovd_timeout;
154 struct ptlrpc_service *recovd_service;
155 struct ptlrpc_client *recovd_client;
157 __u32 recovd_wakeup_flag;
158 spinlock_t recovd_lock;
159 struct list_head recovd_clients_lh; /* clients managed */
160 struct list_head recovd_troubled_lh; /* clients in trouble */
161 wait_queue_head_t recovd_recovery_waitq;
162 wait_queue_head_t recovd_ctl_waitq;
163 wait_queue_head_t recovd_waitq;
164 struct task_struct *recovd_thread;
168 struct obdtrace_opstats *stats;
173 unsigned int snap_index; /* which snapshot index are we accessing */
180 struct ptlrpc_service *ost_service;
181 struct lustre_handle ost_conn; /* the local connection to the OBD */
185 struct lov_tgt_desc {
187 struct lustre_handle conn;
191 struct obd_device *mdcobd;
192 struct lov_desc desc;
194 struct lov_tgt_desc *tgts;
197 struct niobuf_local {
204 void *target_private;
205 struct dentry *dentry;
208 #define N_LOCAL_TEMP_PAGE 0x00000001
210 /* corresponds to one of the obd's */
212 struct obd_type *obd_type;
214 /* common and UUID name of this device */
220 struct proc_dir_entry *obd_proc_entry;
221 struct list_head obd_exports;
222 struct list_head obd_imports;
223 struct ldlm_namespace *obd_namespace;
225 struct ext2_obd ext2;
226 struct filter_obd filter;
228 struct client_obd cli;
230 // struct osc_obd osc;
231 struct ldlm_obd ldlm;
232 struct echo_obd echo;
233 struct recovd_obd recovd;
234 struct trace_obd trace;
237 struct snap_obd snap;
245 int (*o_iocontrol)(long cmd, struct lustre_handle *, int len,
246 void *karg, void *uarg);
247 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
248 obd_count *vallen, void **val);
249 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
250 obd_count vallen, void *val);
251 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
252 int (*o_detach)(struct obd_device *dev);
253 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
254 int (*o_cleanup)(struct obd_device *dev);
255 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
257 int (*o_disconnect)(struct lustre_handle *conn);
260 int (*o_statfs)(struct lustre_handle *conn, struct statfs *statfs);
261 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
263 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
264 struct lov_stripe_md **ea);
265 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
266 struct lov_stripe_md *ea);
267 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
268 struct lov_stripe_md *ea);
269 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
270 struct lov_stripe_md *ea);
271 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
272 struct lov_stripe_md *);
273 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
274 struct lov_stripe_md *);
275 int (*o_brw)(int rw, struct lustre_handle *conn,
276 struct lov_stripe_md *md, obd_count oa_bufs,
277 struct brw_page *pgarr, brw_callback_t callback,
278 struct io_cb_data *data);
279 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
280 struct lov_stripe_md *md, obd_size count,
282 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
283 obd_size count, obd_off offset);
284 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
285 struct obdo *src, obd_size count, obd_off offset);
286 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
287 struct lustre_handle *srconn, struct obdo *src,
288 obd_size count, obd_off offset);
289 int (*o_iterate)(struct lustre_handle *conn,
290 int (*)(obd_id, obd_gr, void *),
291 obd_id *startid, obd_gr group, void *data);
292 int (*o_preprw)(int cmd, struct lustre_handle *conn,
293 int objcount, struct obd_ioobj *obj,
294 int niocount, struct niobuf_remote *remote,
295 struct niobuf_local *local, void **desc_private);
296 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
297 int objcount, struct obd_ioobj *obj,
298 int niocount, struct niobuf_local *local,
300 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
301 struct lustre_handle *parent_lock,
302 __u32 type, void *cookie, int cookielen, __u32 mode,
303 int *flags, void *cb, void *data, int datalen,
304 struct lustre_handle *lockh);
305 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md, __u32 mode, struct lustre_handle *);
308 /* FIXME: for 64-bit arch */