1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
13 struct lov_oinfo { /* per-child structure */
14 __u64 loi_id; /* object ID on the target OST */
15 struct lustre_handle *loi_handle; /* open file handle for obj on OST */
16 int loi_ost_idx; /* OST stripe index in lmd_objects array */
19 struct lov_stripe_md {
20 __u64 lsm_object_id; /* lov object id */
22 __u32 lsm_stripe_size; /* size of the stripe */
23 int lsm_stripe_offset; /* offset of first stripe in lmd_objects */
24 int lsm_stripe_count; /* how many objects are being striped on */
25 struct lov_oinfo lsm_oinfo[0];
28 #define IOC_OSC_TYPE 'h'
29 #define IOC_OSC_MIN_NR 20
30 #define IOC_OSC_REGISTER_LOV _IOWR(IOC_OSC_TYPE, 20, struct obd_device *)
31 #define IOC_OSC_MAX_NR 50
33 #define IOC_MDC_TYPE 'i'
34 #define IOC_MDC_MIN_NR 20
35 #define IOC_MDC_LOOKUP _IOWR(IOC_MDC_TYPE, 20, struct obd_device *)
36 #define IOC_MDC_MAX_NR 50
39 # include <linux/fs.h>
40 # include <linux/list.h>
41 # include <linux/smp_lock.h>
42 # include <linux/proc_fs.h>
44 # include <linux/lustre_lib.h>
45 # include <linux/lustre_idl.h>
46 # include <linux/lustre_mds.h>
47 # include <linux/lustre_export.h>
50 struct list_head typ_chain;
51 struct obd_ops *typ_ops;
52 struct proc_dir_entry *typ_procroot;
64 /* Individual type definitions */
67 struct super_block *e2_sb;
68 struct vfsmount *e2_vfsmnt;
77 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
78 #define OBD_CTXT_DEBUG /* development-only debugging */
80 struct vfsmount *pwdmnt;
93 #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
95 #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
100 struct super_block *fo_sb;
101 struct vfsmount *fo_vfsmnt;
102 struct obd_run_ctxt fo_ctxt;
103 struct dentry *fo_dentry_O;
104 struct dentry *fo_dentry_O_mode[16];
105 spinlock_t fo_objidlock; /* protects fo_lastobjid increment */
107 __u64 fo_last_committed;
108 struct file_operations *fo_fop;
109 struct inode_operations *fo_iop;
110 struct address_space_operations *fo_aops;
111 struct list_head fo_export_list;
112 spinlock_t fo_fddlock; /* protects setting dentry->d_fsdata */
115 struct mds_server_data;
118 struct obd_import cl_import;
119 struct semaphore cl_sem;
121 obd_uuid_t cl_target_uuid; /* XXX -> lustre_name */
122 /* max_mds_easize is purely a performance thing so we don't have to
123 * call obd_size_wiremd() all the time. */
124 int cl_max_mds_easize;
125 struct obd_device *cl_containing_lov;
129 struct ptlrpc_service *mds_service;
131 struct super_block *mds_sb;
132 struct vfsmount *mds_vfsmnt;
133 struct obd_run_ctxt mds_ctxt;
134 struct file_operations *mds_fop;
135 struct inode_operations *mds_iop;
136 struct address_space_operations *mds_aops;
139 struct file *mds_rcvd_filp;
140 struct semaphore mds_transno_sem;
141 __u64 mds_last_committed;
143 __u64 mds_mount_count;
144 struct ll_fid mds_rootfid;
145 struct mds_server_data *mds_server_data;
147 wait_queue_head_t mds_next_transno_waitq;
148 __u64 mds_next_recovery_transno;
149 int mds_recoverable_clients;
150 struct list_head mds_recovery_queue;
151 struct list_head mds_delayed_reply_queue;
152 spinlock_t mds_processing_task_lock;
153 pid_t mds_processing_task;
155 int mds_has_lov_desc;
156 struct lov_desc mds_lov_desc;
160 struct ptlrpc_service *ldlm_cb_service;
161 struct ptlrpc_service *ldlm_cancel_service;
162 struct ptlrpc_client *ldlm_client;
163 struct ptlrpc_connection *ldlm_server_conn;
181 * this struct does double-duty acting as either a client or
182 * server instance .. maybe not wise.
186 struct ptlrpc_service *ptlbd_service;
188 struct ptlrpc_client bd_client;
189 struct obd_import bd_import;
190 int refcount; /* XXX sigh */
194 spinlock_t recovd_lock;
195 struct list_head recovd_managed_items; /* items managed */
196 struct list_head recovd_troubled_items; /* items in recovery */
198 wait_queue_head_t recovd_recovery_waitq;
199 wait_queue_head_t recovd_ctl_waitq;
200 wait_queue_head_t recovd_waitq;
201 struct task_struct *recovd_thread;
206 struct obdtrace_opstats *stats;
211 unsigned int snap_index; /* which snapshot index are we accessing */
218 struct ptlrpc_service *ost_service;
219 struct lustre_handle ost_conn; /* the local connection to the OBD */
222 struct echo_client_obd {
223 struct lustre_handle conn; /* the local connection to osc/lov */
227 struct lustre_handle cobd_target; /* local connection to target obd */
228 struct lustre_handle cobd_cache; /* local connection to cache obd */
231 struct lov_tgt_desc {
233 struct lustre_handle conn;
234 int active; /* is this target available for requests, etc */
239 struct obd_device *mdcobd;
240 struct lov_desc desc;
243 struct lov_tgt_desc *tgts;
246 struct niobuf_local {
253 void *target_private;
254 struct dentry *dentry;
257 #define N_LOCAL_TEMP_PAGE 0x00000001
259 /* corresponds to one of the obd's */
261 struct obd_type *obd_type;
263 /* common and UUID name of this device */
269 struct proc_dir_entry *obd_proc_entry;
270 struct list_head obd_exports;
271 struct list_head obd_imports;
272 struct ldlm_namespace *obd_namespace;
273 struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
274 /* a spinlock is OK for what we do now, may need a semaphore later */
275 spinlock_t obd_dev_lock;
276 struct fsfilt_operations *obd_fsops;
278 struct ext2_obd ext2;
279 struct filter_obd filter;
281 struct client_obd cli;
283 struct echo_client_obd echo_client;;
284 struct ldlm_obd ldlm;
285 struct echo_obd echo;
286 struct recovd_obd recovd;
287 struct trace_obd trace;
289 struct cache_obd cobd;
290 struct ptlbd_obd ptlbd;
292 struct snap_obd snap;
295 /* Fields used by LProcFS */
296 unsigned int cntr_mem_size;
301 struct module *o_owner;
302 int (*o_iocontrol)(unsigned int cmd, struct lustre_handle *, int len,
303 void *karg, void *uarg);
304 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
305 obd_count *vallen, void **val);
306 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
307 obd_count vallen, void *val);
308 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
309 int (*o_detach)(struct obd_device *dev);
310 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
311 int (*o_cleanup)(struct obd_device *dev);
312 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
313 obd_uuid_t cluuid, struct recovd_obd *recovd,
314 ptlrpc_recovery_cb_t recover);
315 int (*o_disconnect)(struct lustre_handle *conn);
318 int (*o_statfs)(struct lustre_handle *conn, struct obd_statfs *osfs);
319 int (*o_packmd)(struct lustre_handle *, struct lov_mds_md **wire_tgt,
320 struct lov_stripe_md *mem_src);
321 int (*o_unpackmd)(struct lustre_handle *,
322 struct lov_stripe_md **mem_tgt,
323 struct lov_mds_md *wire_src);
324 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
326 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
327 struct lov_stripe_md **ea);
328 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
329 struct lov_stripe_md *ea);
330 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
331 struct lov_stripe_md *ea);
332 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
333 struct lov_stripe_md *ea);
334 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
335 struct lov_stripe_md *ea);
336 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
337 struct lov_stripe_md *ea);
338 int (*o_brw)(int rw, struct lustre_handle *conn,
339 struct lov_stripe_md *ea, obd_count oa_bufs,
340 struct brw_page *pgarr, struct obd_brw_set *);
341 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
342 struct lov_stripe_md *ea, obd_size count,
344 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
345 obd_size count, obd_off offset);
346 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
347 struct obdo *src, obd_size count, obd_off offset);
348 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
349 struct lustre_handle *srconn, struct obdo *src,
350 obd_size count, obd_off offset);
351 int (*o_iterate)(struct lustre_handle *conn,
352 int (*)(obd_id, obd_gr, void *),
353 obd_id *startid, obd_gr group, void *data);
354 int (*o_preprw)(int cmd, struct lustre_handle *conn,
355 int objcount, struct obd_ioobj *obj,
356 int niocount, struct niobuf_remote *remote,
357 struct niobuf_local *local, void **desc_private);
358 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
359 int objcount, struct obd_ioobj *obj,
360 int niocount, struct niobuf_local *local,
362 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
363 struct lustre_handle *parent_lock,
364 __u32 type, void *cookie, int cookielen, __u32 mode,
365 int *flags, void *cb, void *data, int datalen,
366 struct lustre_handle *lockh);
367 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md,
368 __u32 mode, struct lustre_handle *);
369 int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *,
372 #endif /* __KERNEL */