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 spinlock_t mds_last_lock;
127 __u64 mds_last_committed;
129 __u64 mds_mount_count;
130 struct ll_fid mds_rootfid;
131 struct mds_server_data *mds_server_data;
135 struct ptlrpc_service *ldlm_service;
136 struct ptlrpc_client *ldlm_client;
137 struct ptlrpc_connection *ldlm_server_conn;
142 struct super_block *eo_sb;
143 struct vfsmount *eo_vfsmnt;
144 struct obd_run_ctxt eo_ctxt;
147 struct file_operations *eo_fop;
148 struct inode_operations *eo_iop;
149 struct address_space_operations *eo_aops;
153 time_t recovd_waketime;
154 time_t recovd_timeout;
156 __u32 recovd_wakeup_flag;
157 spinlock_t recovd_lock;
158 struct list_head recovd_managed_items; /* items managed */
159 struct list_head recovd_troubled_items; /* items in trouble */
160 wait_queue_head_t recovd_recovery_waitq;
161 wait_queue_head_t recovd_ctl_waitq;
162 wait_queue_head_t recovd_waitq;
163 struct task_struct *recovd_thread;
167 struct obdtrace_opstats *stats;
172 unsigned int snap_index; /* which snapshot index are we accessing */
179 struct ptlrpc_service *ost_service;
180 struct lustre_handle ost_conn; /* the local connection to the OBD */
184 struct lov_tgt_desc {
186 struct lustre_handle conn;
190 struct obd_device *mdcobd;
191 struct lov_desc desc;
193 struct lov_tgt_desc *tgts;
196 struct niobuf_local {
203 void *target_private;
204 struct dentry *dentry;
207 #define N_LOCAL_TEMP_PAGE 0x00000001
209 /* corresponds to one of the obd's */
211 struct obd_type *obd_type;
213 /* common and UUID name of this device */
219 struct proc_dir_entry *obd_proc_entry;
220 struct list_head obd_exports;
221 struct list_head obd_imports;
222 struct ldlm_namespace *obd_namespace;
224 struct ext2_obd ext2;
225 struct filter_obd filter;
227 struct client_obd cli;
229 // struct osc_obd osc;
230 struct ldlm_obd ldlm;
231 struct echo_obd echo;
232 struct recovd_obd recovd;
233 struct trace_obd trace;
236 struct snap_obd snap;
244 int (*o_iocontrol)(long cmd, struct lustre_handle *, int len,
245 void *karg, void *uarg);
246 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
247 obd_count *vallen, void **val);
248 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
249 obd_count vallen, void *val);
250 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
251 int (*o_detach)(struct obd_device *dev);
252 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
253 int (*o_cleanup)(struct obd_device *dev);
254 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
256 int (*o_disconnect)(struct lustre_handle *conn);
259 int (*o_statfs)(struct lustre_handle *conn, struct statfs *statfs);
260 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
262 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
263 struct lov_stripe_md **ea);
264 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
265 struct lov_stripe_md *ea);
266 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
267 struct lov_stripe_md *ea);
268 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
269 struct lov_stripe_md *ea);
270 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
271 struct lov_stripe_md *);
272 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
273 struct lov_stripe_md *);
274 int (*o_brw)(int rw, struct lustre_handle *conn,
275 struct lov_stripe_md *md, obd_count oa_bufs,
276 struct brw_page *pgarr, brw_callback_t callback,
277 struct io_cb_data *data);
278 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
279 struct lov_stripe_md *md, obd_size count,
281 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
282 obd_size count, obd_off offset);
283 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
284 struct obdo *src, obd_size count, obd_off offset);
285 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
286 struct lustre_handle *srconn, struct obdo *src,
287 obd_size count, obd_off offset);
288 int (*o_iterate)(struct lustre_handle *conn,
289 int (*)(obd_id, obd_gr, void *),
290 obd_id *startid, obd_gr group, void *data);
291 int (*o_preprw)(int cmd, struct lustre_handle *conn,
292 int objcount, struct obd_ioobj *obj,
293 int niocount, struct niobuf_remote *remote,
294 struct niobuf_local *local, void **desc_private);
295 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
296 int objcount, struct obd_ioobj *obj,
297 int niocount, struct niobuf_local *local,
299 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
300 struct lustre_handle *parent_lock,
301 __u32 type, void *cookie, int cookielen, __u32 mode,
302 int *flags, void *cb, void *data, int datalen,
303 struct lustre_handle *lockh);
304 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md, __u32 mode, struct lustre_handle *);
307 /* FIXME: for 64-bit arch */