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 unsigned lsm_stripe_offset; /* offset of first stripe in lmd_objects */
24 unsigned 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;
78 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
79 #define OBD_CTXT_DEBUG /* development-only debugging */
81 struct vfsmount *pwdmnt;
94 #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
96 #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
99 struct ost_server_data;
103 struct super_block *fo_sb;
104 struct vfsmount *fo_vfsmnt;
105 struct obd_run_ctxt fo_ctxt;
106 struct dentry *fo_dentry_O;
107 struct dentry *fo_dentry_O_mode[16];
108 spinlock_t fo_objidlock; /* protects fo_lastobjid increment */
109 struct semaphore fo_transno_sem;
110 struct file *fo_rcvd_filp;
111 struct filter_server_data *fo_fsd;
113 __u64 fo_next_recovery_transno;
114 int fo_recoverable_clients;
115 struct file_operations *fo_fop;
116 struct inode_operations *fo_iop;
117 struct address_space_operations *fo_aops;
118 struct list_head fo_export_list;
119 spinlock_t fo_fddlock; /* protects setting dentry->d_fsdata */
122 struct mds_server_data;
125 struct obd_import cl_import;
126 struct semaphore cl_sem;
128 struct obd_uuid cl_target_uuid; /* XXX -> lustre_name */
129 /* max_mds_easize is purely a performance thing so we don't have to
130 * call obd_size_wiremd() all the time. */
131 int cl_max_mds_easize;
132 struct obd_device *cl_containing_lov;
136 struct ptlrpc_service *mds_service;
137 struct ptlrpc_service *mds_getattr_service;
139 struct super_block *mds_sb;
140 struct vfsmount *mds_vfsmnt;
141 struct obd_run_ctxt mds_ctxt;
142 struct file_operations *mds_fop;
143 struct inode_operations *mds_iop;
144 struct address_space_operations *mds_aops;
147 struct file *mds_rcvd_filp;
148 struct semaphore mds_transno_sem;
150 __u64 mds_mount_count;
151 struct ll_fid mds_rootfid;
152 struct mds_server_data *mds_server_data;
154 wait_queue_head_t mds_next_transno_waitq;
155 __u64 mds_next_recovery_transno;
156 int mds_recoverable_clients;
157 struct list_head mds_recovery_queue;
158 struct list_head mds_delayed_reply_queue;
159 spinlock_t mds_processing_task_lock;
160 pid_t mds_processing_task;
161 struct timer_list mds_recovery_timer;
163 int mds_has_lov_desc;
164 struct lov_desc mds_lov_desc;
168 struct ptlrpc_service *ldlm_cb_service;
169 struct ptlrpc_service *ldlm_cancel_service;
170 struct ptlrpc_client *ldlm_client;
171 struct ptlrpc_connection *ldlm_server_conn;
189 * this struct does double-duty acting as either a client or
190 * server instance .. maybe not wise.
194 struct ptlrpc_service *ptlbd_service;
197 struct ptlrpc_client bd_client;
198 struct obd_import bd_import;
199 int refcount; /* XXX sigh */
203 spinlock_t recovd_lock;
204 struct list_head recovd_managed_items; /* items managed */
205 struct list_head recovd_troubled_items; /* items in recovery */
207 wait_queue_head_t recovd_recovery_waitq;
208 wait_queue_head_t recovd_ctl_waitq;
209 wait_queue_head_t recovd_waitq;
210 struct task_struct *recovd_thread;
215 struct obdtrace_opstats *stats;
220 unsigned int snap_index; /* which snapshot index are we accessing */
227 struct ptlrpc_service *ost_service;
230 struct echo_client_obd {
231 struct lustre_handle ec_conn; /* the local connection to osc/lov */
233 struct list_head ec_objects;
240 struct lustre_handle cobd_target; /* local connection to target obd */
241 struct lustre_handle cobd_cache; /* local connection to cache obd */
244 struct lov_tgt_desc {
245 struct obd_uuid uuid;
246 struct lustre_handle conn;
247 int active; /* is this target available for requests, etc */
252 struct obd_device *mdcobd;
253 struct lov_desc desc;
256 struct lov_tgt_desc *tgts;
259 struct niobuf_local {
266 void *target_private;
267 struct dentry *dentry;
270 struct obd_trans_info {
274 #define N_LOCAL_TEMP_PAGE 0x00000001
276 /* corresponds to one of the obd's */
278 struct obd_type *obd_type;
280 /* common and UUID name of this device */
282 struct obd_uuid obd_uuid;
286 struct proc_dir_entry *obd_proc_entry;
287 struct list_head obd_exports;
288 struct list_head obd_imports;
289 struct ldlm_namespace *obd_namespace;
290 struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
291 /* a spinlock is OK for what we do now, may need a semaphore later */
292 spinlock_t obd_dev_lock;
293 __u64 obd_last_committed;
294 struct fsfilt_operations *obd_fsops;
296 struct ext2_obd ext2;
297 struct filter_obd filter;
299 struct client_obd cli;
301 struct echo_client_obd echo_client;;
302 struct ldlm_obd ldlm;
303 struct echo_obd echo;
304 struct recovd_obd recovd;
305 struct trace_obd trace;
307 struct cache_obd cobd;
308 struct ptlbd_obd ptlbd;
310 struct snap_obd snap;
313 /* Fields used by LProcFS */
314 unsigned int cntr_mem_size;
319 struct module *o_owner;
320 int (*o_iocontrol)(unsigned int cmd, struct lustre_handle *, int len,
321 void *karg, void *uarg);
322 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
323 obd_count *vallen, void **val);
324 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
325 obd_count vallen, void *val);
326 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
327 int (*o_detach)(struct obd_device *dev);
328 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
329 int (*o_cleanup)(struct obd_device *dev);
330 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
331 struct obd_uuid *cluuid, struct recovd_obd *recovd,
332 ptlrpc_recovery_cb_t recover);
333 int (*o_disconnect)(struct lustre_handle *conn);
336 int (*o_statfs)(struct lustre_handle *conn, struct obd_statfs *osfs);
337 int (*o_packmd)(struct lustre_handle *, struct lov_mds_md **wire_tgt,
338 struct lov_stripe_md *mem_src);
339 int (*o_unpackmd)(struct lustre_handle *,
340 struct lov_stripe_md **mem_tgt,
341 struct lov_mds_md *wire_src);
342 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
344 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
345 struct lov_stripe_md **ea, struct obd_trans_info *oti);
346 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
347 struct lov_stripe_md *ea, struct obd_trans_info *oti);
348 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
349 struct lov_stripe_md *ea, struct obd_trans_info *oti);
350 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
351 struct lov_stripe_md *ea);
352 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
353 struct lov_stripe_md *ea, struct obd_trans_info *oti);
354 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
355 struct lov_stripe_md *ea, struct obd_trans_info *oti);
356 int (*o_brw)(int rw, struct lustre_handle *conn,
357 struct lov_stripe_md *ea, obd_count oa_bufs,
358 struct brw_page *pgarr, struct obd_brw_set *,
359 struct obd_trans_info *oti);
360 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
361 struct lov_stripe_md *ea, obd_size count,
362 obd_off offset, struct obd_trans_info *oti);
363 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
364 obd_size count, obd_off offset);
365 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
366 struct obdo *src, obd_size count, obd_off offset);
367 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
368 struct lustre_handle *srconn, struct obdo *src,
369 obd_size count, obd_off offset, struct obd_trans_info *);
370 int (*o_iterate)(struct lustre_handle *conn,
371 int (*)(obd_id, obd_gr, void *),
372 obd_id *startid, obd_gr group, void *data);
373 int (*o_preprw)(int cmd, struct lustre_handle *conn,
374 int objcount, struct obd_ioobj *obj,
375 int niocount, struct niobuf_remote *remote,
376 struct niobuf_local *local, void **desc_private,
377 struct obd_trans_info *oti);
378 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
379 int objcount, struct obd_ioobj *obj,
380 int niocount, struct niobuf_local *local,
381 void *desc_private, struct obd_trans_info *oti);
382 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
383 struct lustre_handle *parent_lock,
384 __u32 type, void *cookie, int cookielen, __u32 mode,
385 int *flags, void *cb, void *data, int datalen,
386 struct lustre_handle *lockh);
387 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md,
388 __u32 mode, struct lustre_handle *);
389 int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *,
392 #endif /* __KERNEL */