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; /* handle for object on OST */
16 int loi_ost_idx; /* OST stripe index in lmd_objects array */
19 struct lov_stripe_md {
21 __u64 lsm_object_id; /* lov object id */
22 __u64 lsm_stripe_size; /* size of the stripe */
23 __u32 lsm_stripe_pattern; /* per-lov object stripe pattern */
24 int lsm_stripe_offset; /* offset of first stripe in lmd_objects */
25 int lsm_stripe_count; /* how many objects are being striped on */
26 struct lov_oinfo lsm_oinfo[0];
30 # include <linux/fs.h>
31 # include <linux/list.h>
32 # include <linux/smp_lock.h>
33 # include <linux/proc_fs.h>
35 # include <linux/lustre_lib.h>
36 # include <linux/lustre_idl.h>
37 # include <linux/lustre_mds.h>
38 # include <linux/lustre_export.h>
41 struct list_head typ_chain;
42 struct obd_ops *typ_ops;
43 struct proc_dir_entry *typ_procroot;
55 /* Individual type definitions */
58 struct super_block *e2_sb;
59 struct vfsmount *e2_vfsmnt;
68 #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA
69 #define OBD_CTXT_DEBUG /* development-only debugging */
71 struct vfsmount *pwdmnt;
84 #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
86 #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
91 struct super_block *fo_sb;
92 struct vfsmount *fo_vfsmnt;
93 struct obd_run_ctxt fo_ctxt;
94 struct dentry *fo_dentry_O;
95 struct dentry *fo_dentry_O_mode[16];
96 spinlock_t fo_objidlock; /* protects fo_lastobjid increment */
98 struct file_operations *fo_fop;
99 struct inode_operations *fo_iop;
100 struct address_space_operations *fo_aops;
101 struct list_head fo_export_list;
102 spinlock_t fo_fddlock; /* protects setting dentry->d_fsdata */
105 struct mds_server_data;
108 struct obd_import cl_import;
109 struct semaphore cl_sem;
111 obd_uuid_t cl_target_uuid; /* XXX -> lustre_name */
112 /* max_mds_easize is purely a performance thing so we don't have to
113 * call obd_size_wiremd() all the time. */
114 int cl_max_mds_easize;
115 struct obd_device *cl_containing_lov;
118 #define IOC_OSC_TYPE 'h'
119 #define IOC_OSC_MIN_NR 20
120 #define IOC_OSC_REGISTER_LOV _IOWR('h', 20, struct obd_device *)
121 #define IOC_OSC_MAX_NR 50
124 struct ptlrpc_service *mds_service;
126 struct super_block *mds_sb;
127 struct vfsmount *mds_vfsmnt;
128 struct obd_run_ctxt mds_ctxt;
129 struct file_operations *mds_fop;
130 struct inode_operations *mds_iop;
131 struct address_space_operations *mds_aops;
134 struct file *mds_rcvd_filp;
135 struct semaphore mds_transno_sem;
136 __u64 mds_last_committed;
138 __u64 mds_mount_count;
139 struct ll_fid mds_rootfid;
140 struct mds_server_data *mds_server_data;
142 wait_queue_head_t mds_next_transno_waitq;
143 __u64 mds_next_recovery_transno;
144 int mds_recoverable_clients;
145 struct list_head mds_recovery_queue;
146 struct list_head mds_delayed_reply_queue;
147 spinlock_t mds_processing_task_lock;
148 pid_t mds_processing_task;
152 struct ptlrpc_service *ldlm_cb_service;
153 struct ptlrpc_service *ldlm_cancel_service;
154 struct ptlrpc_client *ldlm_client;
155 struct ptlrpc_connection *ldlm_server_conn;
173 spinlock_t recovd_lock;
174 struct list_head recovd_managed_items; /* items managed */
175 struct list_head recovd_troubled_items; /* items in recovery */
177 wait_queue_head_t recovd_recovery_waitq;
178 wait_queue_head_t recovd_ctl_waitq;
179 wait_queue_head_t recovd_waitq;
180 struct task_struct *recovd_thread;
185 struct obdtrace_opstats *stats;
190 unsigned int snap_index; /* which snapshot index are we accessing */
197 struct ptlrpc_service *ost_service;
198 struct lustre_handle ost_conn; /* the local connection to the OBD */
201 struct echo_client_obd {
202 struct lustre_handle conn; /* the local connection to osc/lov */
205 struct lov_tgt_desc {
207 struct lustre_handle conn;
208 int active; /* is this target available for requests, etc */
213 struct obd_device *mdcobd;
214 struct lov_desc desc;
217 struct lov_tgt_desc *tgts;
220 struct niobuf_local {
227 void *target_private;
228 struct dentry *dentry;
231 #define N_LOCAL_TEMP_PAGE 0x00000001
233 /* corresponds to one of the obd's */
235 struct obd_type *obd_type;
237 /* common and UUID name of this device */
243 struct proc_dir_entry *obd_proc_entry;
244 struct list_head obd_exports;
245 struct list_head obd_imports;
246 struct ldlm_namespace *obd_namespace;
247 struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
248 /* a spinlock is OK for what we do now, may need a semaphore later */
249 spinlock_t obd_dev_lock;
250 struct fsfilt_operations *obd_fsops;
252 struct ext2_obd ext2;
253 struct filter_obd filter;
255 struct client_obd cli;
257 struct echo_client_obd echo_client;;
258 struct ldlm_obd ldlm;
259 struct echo_obd echo;
260 struct recovd_obd recovd;
261 struct trace_obd trace;
264 struct snap_obd snap;
267 /* Fields used by LProcFS */
268 unsigned int cntr_mem_size;
273 int (*o_iocontrol)(unsigned int cmd, struct lustre_handle *, int len,
274 void *karg, void *uarg);
275 int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
276 obd_count *vallen, void **val);
277 int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
278 obd_count vallen, void *val);
279 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
280 int (*o_detach)(struct obd_device *dev);
281 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
282 int (*o_cleanup)(struct obd_device *dev);
283 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
284 obd_uuid_t cluuid, struct recovd_obd *recovd,
285 ptlrpc_recovery_cb_t recover);
286 int (*o_disconnect)(struct lustre_handle *conn);
289 int (*o_statfs)(struct lustre_handle *conn, struct obd_statfs *osfs);
290 int (*o_packmd)(struct lustre_handle *, struct lov_mds_md **wire_tgt,
291 struct lov_stripe_md *mem_src);
292 int (*o_unpackmd)(struct lustre_handle *,
293 struct lov_stripe_md **mem_tgt,
294 struct lov_mds_md *wire_src);
295 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
297 int (*o_create)(struct lustre_handle *conn, struct obdo *oa,
298 struct lov_stripe_md **ea);
299 int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa,
300 struct lov_stripe_md *ea);
301 int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa,
302 struct lov_stripe_md *ea);
303 int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa,
304 struct lov_stripe_md *ea);
305 int (*o_open)(struct lustre_handle *conn, struct obdo *oa,
306 struct lov_stripe_md *ea);
307 int (*o_close)(struct lustre_handle *conn, struct obdo *oa,
308 struct lov_stripe_md *ea);
309 int (*o_brw)(int rw, struct lustre_handle *conn,
310 struct lov_stripe_md *ea, obd_count oa_bufs,
311 struct brw_page *pgarr, struct obd_brw_set *);
312 int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt,
313 struct lov_stripe_md *ea, obd_size count,
315 int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt,
316 obd_size count, obd_off offset);
317 int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
318 struct obdo *src, obd_size count, obd_off offset);
319 int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
320 struct lustre_handle *srconn, struct obdo *src,
321 obd_size count, obd_off offset);
322 int (*o_iterate)(struct lustre_handle *conn,
323 int (*)(obd_id, obd_gr, void *),
324 obd_id *startid, obd_gr group, void *data);
325 int (*o_preprw)(int cmd, struct lustre_handle *conn,
326 int objcount, struct obd_ioobj *obj,
327 int niocount, struct niobuf_remote *remote,
328 struct niobuf_local *local, void **desc_private);
329 int (*o_commitrw)(int cmd, struct lustre_handle *conn,
330 int objcount, struct obd_ioobj *obj,
331 int niocount, struct niobuf_local *local,
333 int (*o_enqueue)(struct lustre_handle *conn, struct lov_stripe_md *md,
334 struct lustre_handle *parent_lock,
335 __u32 type, void *cookie, int cookielen, __u32 mode,
336 int *flags, void *cb, void *data, int datalen,
337 struct lustre_handle *lockh);
338 int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md,
339 __u32 mode, struct lustre_handle *);
340 int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *,
343 #endif /* __KERNEL */