Whamcloud - gitweb
ec90c849853b4317d7e6f4ec11b4a10f48440b23
[fs/lustre-release.git] / lustre / include / linux / obd.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
5  *
6  * This code is issued under the GNU General Public License.
7  * See the file COPYING in this distribution
8  */
9
10 #ifndef __OBD_H
11 #define __OBD_H
12
13 #define IOC_OSC_TYPE         'h'
14 #define IOC_OSC_MIN_NR       20
15 #define IOC_OSC_SET_ACTIVE   _IOWR(IOC_OSC_TYPE, 21, struct obd_device *)
16 #define IOC_OSC_MAX_NR       50
17
18 #define IOC_MDC_TYPE         'i'
19 #define IOC_MDC_MIN_NR       20
20 #define IOC_MDC_LOOKUP       _IOWR(IOC_MDC_TYPE, 20, struct obd_device *)
21 #define IOC_MDC_GETSTRIPE    _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
22 #define IOC_MDC_MAX_NR       50
23
24 #ifdef __KERNEL__
25 # include <linux/fs.h>
26 # include <linux/list.h>
27 # include <linux/sched.h> /* for struct task_struct, for current.h */
28 # include <asm/current.h> /* for smp_lock.h */
29 # include <linux/smp_lock.h>
30 # include <linux/proc_fs.h>
31 # include <linux/mount.h>
32 #endif
33
34 #include <linux/lustre_lib.h>
35 #include <linux/lustre_idl.h>
36 #include <linux/lustre_export.h>
37
38 /* this is really local to the OSC */
39 struct loi_oap_pages {
40         struct list_head        lop_pending;
41         int                     lop_num_pending;
42         struct list_head        lop_urgent;
43         struct list_head        lop_pending_sync;
44 };
45
46 struct lov_oinfo {                 /* per-stripe data structure */
47         __u64 loi_id;              /* object ID on the target OST */
48         __u64 loi_gr;              /* object group on the target OST */
49         int loi_ost_idx;           /* OST stripe index in lov_tgt_desc->tgts */
50         int loi_ost_gen;           /* generation of this loi_ost_idx */
51
52         /* used by the osc to keep track of what objects to build into rpcs */
53         struct loi_oap_pages loi_read_lop;
54         struct loi_oap_pages loi_write_lop;
55         /* _cli_ is poorly named, it should be _ready_ */
56         struct list_head loi_cli_item;
57         struct list_head        loi_write_item;
58 };
59
60 static inline void loi_init(struct lov_oinfo *loi)
61 {
62         INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending);
63         INIT_LIST_HEAD(&loi->loi_read_lop.lop_urgent);
64         INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending_sync);
65         INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending);
66         INIT_LIST_HEAD(&loi->loi_write_lop.lop_urgent);
67         INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending_sync);
68         INIT_LIST_HEAD(&loi->loi_cli_item);
69         INIT_LIST_HEAD(&loi->loi_write_item);
70 }
71
72 struct lov_stripe_md {
73         /* Public members. */
74         __u64 lsm_object_id;        /* lov object id */
75         __u64 lsm_object_gr;        /* lov object id */
76         __u64 lsm_maxbytes;
77
78         /* LOV-private members start here -- only for use in lov/. */
79         __u32 lsm_magic;
80         __u32 lsm_stripe_size;      /* size of the stripe */
81         __u32 lsm_pattern;          /* striping pattern (RAID0, RAID1) */
82         unsigned lsm_stripe_count;  /* number of objects being striped over */
83         struct lov_oinfo lsm_oinfo[0];
84 };
85
86 struct obd_type {
87         struct list_head typ_chain;
88         struct obd_ops *typ_ops;
89         struct proc_dir_entry *typ_procroot;
90         char *typ_name;
91         int  typ_refcnt;
92 };
93
94 struct brw_page {
95         obd_off  off;
96         struct page *pg;
97         int count;
98         obd_flag flag;
99 };
100
101 enum async_flags {
102         ASYNC_READY = 0x1,
103         ASYNC_URGENT = 0x2,
104         ASYNC_COUNT_STABLE = 0x4,
105 };
106
107 struct obd_async_page_ops {
108         int  (*ap_make_ready)(void *data, int cmd);
109         int  (*ap_refresh_count)(void *data, int cmd);
110         void (*ap_fill_obdo)(void *data, int cmd, struct obdo *oa);
111         void (*ap_completion)(void *data, int cmd, int rc);
112 };
113
114 /* the `osic' is passed down from a caller of obd rw methods.  the callee
115  * records enough state such that the caller can sleep on the osic and
116  * be woken when all the callees have finished their work */
117 struct obd_sync_io_container {
118         spinlock_t      osic_lock;
119         atomic_t        osic_refcount;
120         int             osic_pending;
121         int             osic_rc;
122         struct list_head osic_occ_list;
123         wait_queue_head_t osic_waitq;
124 };
125
126 /* the osic callback context lets the callee of obd rw methods register
127  * for callbacks from the caller. */
128 struct osic_callback_context {
129         struct list_head occ_osic_item;
130         /* called when the caller has received a signal while sleeping.
131          * callees of this method are encouraged to abort their state 
132          * in the osic.  This may be called multiple times. */
133         void (*occ_interrupted)(struct osic_callback_context *occ);
134 };
135
136 /* if we find more consumers this could be generalized */
137 #define OBD_HIST_MAX 32
138 struct obd_histogram {
139         spinlock_t      oh_lock;
140         unsigned long   oh_buckets[OBD_HIST_MAX];
141 };
142
143 /* Individual type definitions */
144
145 struct ost_server_data;
146
147 struct filter_obd {
148         const char          *fo_fstype;
149         struct super_block  *fo_sb;
150         struct vfsmount     *fo_vfsmnt;
151         struct dentry       *fo_dentry_O;
152         struct dentry      **fo_dentry_O_groups;
153         struct dentry      **fo_dentry_O_sub;
154         spinlock_t           fo_objidlock; /* protect fo_lastobjid increment */
155         spinlock_t           fo_translock; /* protect fsd_last_rcvd increment */
156         struct file         *fo_rcvd_filp;
157         struct filter_server_data *fo_fsd;
158         unsigned long       *fo_last_rcvd_slots;
159         __u64                fo_mount_count;
160
161         struct file_operations *fo_fop;
162         struct inode_operations *fo_iop;
163         struct address_space_operations *fo_aops;
164
165         struct list_head     fo_export_list;
166         int                  fo_subdir_count;
167         obd_size             fo_tot_dirty;      /* protected by obd_osfs_lock */
168         obd_size             fo_tot_granted;    /* all values in bytes */
169         obd_size             fo_tot_pending;
170
171         obd_size             fo_readcache_max_filesize;
172
173         struct obd_import   *fo_mdc_imp;
174         struct obd_uuid      fo_mdc_uuid;
175         struct lustre_handle fo_mdc_conn;
176 #if 0
177         struct ptlrpc_client fo_mdc_client;
178 #endif
179         struct file        **fo_last_objid_files;
180         __u64               *fo_last_objids; /* last created objid for groups */
181
182         struct semaphore     fo_alloc_lock;
183
184         struct obd_histogram     fo_r_pages;
185         struct obd_histogram     fo_w_pages;
186         struct obd_histogram     fo_r_discont_pages;
187         struct obd_histogram     fo_w_discont_pages;
188         struct obd_histogram     fo_r_discont_blocks;
189         struct obd_histogram     fo_w_discont_blocks;
190 };
191
192 struct mds_server_data;
193
194 #define OSC_MAX_RIF_DEFAULT       4
195 #define OSC_MAX_RIF_MAX          32
196 #define OSC_MAX_DIRTY_DEFAULT     4
197 #define OSC_MAX_DIRTY_MB_MAX    256     /* totally arbitrary */
198
199 struct mdc_rpc_lock;
200 struct client_obd {
201         struct obd_import       *cl_import;
202         struct semaphore         cl_sem;
203         int                      cl_conn_count;
204         /* max_mds_easize is purely a performance thing so we don't have to
205          * call obd_size_wiremd() all the time. */
206         int                      cl_max_mds_easize;
207         int                      cl_max_mds_cookiesize;
208         kdev_t                   cl_sandev;
209
210         //struct llog_canceld_ctxt *cl_llcd; /* it's included by obd_llog_ctxt */
211         void                    *cl_llcd_offset;
212
213         struct obd_device       *cl_mgmtcli_obd;
214
215         /* the grant values are protected by loi_list_lock below */
216         long                     cl_dirty;         /* all _dirty_ in bytes */
217         long                     cl_dirty_max;     /* allowed w/o rpc */
218         long                     cl_avail_grant;   /* bytes of credit for ost */
219         long                     cl_lost_grant;    /* lost credits (trunc) */
220         struct list_head         cl_cache_waiters; /* waiting for cache/grant */
221
222         /* keep track of objects that have lois that contain pages which
223          * have been queued for async brw.  this lock also protects the
224          * lists of osc_client_pages that hang off of the loi */
225         spinlock_t               cl_loi_list_lock;
226         struct list_head         cl_loi_ready_list;
227         struct list_head         cl_loi_write_list;
228         int                      cl_brw_in_flight;
229         /* just a sum of the loi/lop pending numbers to be exported by /proc */
230         int                      cl_pending_w_pages;
231         int                      cl_pending_r_pages;
232         int                      cl_max_pages_per_rpc;
233         int                      cl_max_rpcs_in_flight;
234         struct obd_histogram     cl_read_rpc_hist;
235         struct obd_histogram     cl_write_rpc_hist;
236         struct obd_histogram     cl_read_page_hist;
237         struct obd_histogram     cl_write_page_hist;
238
239         struct mdc_rpc_lock     *cl_rpc_lock;
240         struct mdc_rpc_lock     *cl_setattr_lock;
241 };
242
243 /* Like a client, with some hangers-on.  Keep mc_client_obd first so that we
244  * can reuse the various client setup/connect functions. */
245 struct mgmtcli_obd {
246         struct client_obd        mc_client_obd; /* nested */
247         struct ptlrpc_thread    *mc_ping_thread;
248         struct obd_export       *mc_ping_exp; /* XXX single-target */
249         struct list_head         mc_registered;
250         void                    *mc_hammer;
251 };
252
253 #define mc_import mc_client_obd.cl_import
254
255 struct mds_obd {
256         struct ptlrpc_service           *mds_service;
257         struct ptlrpc_service           *mds_setattr_service;
258         struct ptlrpc_service           *mds_readpage_service;
259         struct super_block              *mds_sb;
260         struct vfsmount                 *mds_vfsmnt;
261         struct dentry                   *mds_fid_de;
262         int                              mds_max_mdsize;
263         int                              mds_max_cookiesize;
264         struct file                     *mds_rcvd_filp;
265         spinlock_t                       mds_transno_lock;
266         __u64                            mds_last_transno;
267         __u64                            mds_mount_count;
268         __u64                            mds_io_epoch;
269         struct semaphore                 mds_epoch_sem;
270         struct ll_fid                    mds_rootfid;
271         struct mds_server_data          *mds_server_data;
272         struct dentry                   *mds_pending_dir;
273         struct dentry                   *mds_logs_dir;
274         struct dentry                   *mds_objects_dir;
275         struct llog_handle              *mds_cfg_llh;
276 //        struct llog_handle              *mds_catalog;
277         struct obd_device               *mds_osc_obd; /* XXX lov_obd */
278         struct obd_uuid                  mds_lov_uuid;
279         char                            *mds_profile;
280         struct obd_export               *mds_osc_exp; /* XXX lov_exp */
281         int                              mds_has_lov_desc;
282         struct lov_desc                  mds_lov_desc;
283         obd_id                          *mds_lov_objids;
284         int                              mds_lov_objids_valid;
285         int                              mds_lov_nextid_set;
286         struct file                     *mds_lov_objid_filp;
287         unsigned long                   *mds_client_bitmap;
288         struct semaphore                 mds_orphan_recovery_sem;
289
290         atomic_t                         mds_open_count;
291 };
292
293 struct echo_obd {
294         struct obdo oa;
295         spinlock_t eo_lock;
296         __u64 eo_lastino;
297         atomic_t eo_getattr;
298         atomic_t eo_setattr;
299         atomic_t eo_create;
300         atomic_t eo_destroy;
301         atomic_t eo_prep;
302         atomic_t eo_read;
303         atomic_t eo_write;
304 };
305
306 /*
307  * this struct does double-duty acting as either a client or
308  * server instance .. maybe not wise.
309  */
310 struct ptlbd_obd {
311         /* server's */
312         struct ptlrpc_service *ptlbd_service;
313         struct file *filp;
314         /* client's */
315         struct ptlrpc_client    bd_client;
316         struct obd_import       *bd_import;
317         struct obd_uuid         bd_server_uuid;
318         struct obd_export       *bd_exp;
319         int refcount; /* XXX sigh */
320 };
321
322 struct recovd_obd {
323         spinlock_t            recovd_lock;
324         struct list_head      recovd_managed_items; /* items managed  */
325         struct list_head      recovd_troubled_items; /* items in recovery */
326
327         wait_queue_head_t     recovd_recovery_waitq;
328         wait_queue_head_t     recovd_ctl_waitq;
329         wait_queue_head_t     recovd_waitq;
330         struct task_struct   *recovd_thread;
331         __u32                 recovd_state;
332 };
333
334 struct ost_obd {
335         struct ptlrpc_service *ost_service;
336         struct ptlrpc_service *ost_create_service;
337 };
338
339 struct echo_client_obd {
340         struct obd_export   *ec_exp;   /* the local connection to osc/lov */
341         spinlock_t           ec_lock;
342         struct list_head     ec_objects;
343         int                  ec_nstripes;
344         __u64                ec_unique;
345 };
346
347 struct cache_obd {
348         struct obd_export *cobd_target_exp;/* local connection to target obd */
349         struct obd_export *cobd_cache_exp; /* local connection to cache obd */
350 };
351
352 struct lov_tgt_desc {
353         struct obd_uuid          uuid;
354         struct obd_export       *ltd_exp;
355         int                      active; /* is this target up for requests */
356 };
357
358 struct lov_obd {
359         spinlock_t lov_lock;
360         struct lov_desc desc;
361         int bufsize;
362         int refcount;
363         int lo_catalog_loaded:1;
364         struct lov_tgt_desc *tgts;
365 };
366
367 struct niobuf_local {
368         __u64 offset;
369         __u32 len;
370         __u32 flags;
371         struct page *page;
372         struct dentry *dentry;
373         int lnb_grant_used;
374         int rc;
375 };
376
377
378 /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */
379 #define N_LOCAL_TEMP_PAGE 0x10000000
380
381 struct obd_trans_info {
382         __u64                    oti_transno;
383         __u64                   *oti_objid;
384         /* Only used on the server side for tracking acks. */
385         struct oti_req_ack_lock {
386                 struct lustre_handle lock;
387                 __u32                mode;
388         }                        oti_ack_locks[4];
389         void                    *oti_handle;
390         struct llog_cookie       oti_onecookie;
391         struct llog_cookie      *oti_logcookies;
392         int                      oti_numcookies;
393 };
394
395 static inline void oti_alloc_cookies(struct obd_trans_info *oti,int num_cookies)
396 {
397         if (!oti)
398                 return;
399
400         if (num_cookies == 1)
401                 oti->oti_logcookies = &oti->oti_onecookie;
402         else
403                 OBD_ALLOC(oti->oti_logcookies,
404                           num_cookies * sizeof(oti->oti_onecookie));
405
406         oti->oti_numcookies = num_cookies;
407 }
408
409 static inline void oti_free_cookies(struct obd_trans_info *oti)
410 {
411         if (!oti || !oti->oti_logcookies)
412                 return;
413
414         if (oti->oti_logcookies == &oti->oti_onecookie)
415                 LASSERT(oti->oti_numcookies == 1);
416         else
417                 OBD_FREE(oti->oti_logcookies,
418                          oti->oti_numcookies * sizeof(oti->oti_onecookie));
419         oti->oti_logcookies = NULL;
420         oti->oti_numcookies = 0;
421 }
422
423 /* llog contexts */
424 enum llog_ctxt_id {
425         LLOG_CONFIG_ORIG_CTXT =  0,
426         LLOG_CONFIG_REPL_CTXT =  1,
427         LLOG_UNLINK_ORIG_CTXT =  2,
428         LLOG_UNLINK_REPL_CTXT =  3,
429         LLOG_SIZE_ORIG_CTXT   =  4,
430         LLOG_SIZE_REPL_CTXT   =  5,
431         LLOG_MD_ORIG_CTXT     =  6,
432         LLOG_MD_REPL_CTXT     =  7,
433         LLOG_RD1_ORIG_CTXT    =  8,
434         LLOG_RD1_REPL_CTXT    =  9,
435         LLOG_TEST_ORIG_CTXT   = 10,
436         LLOG_TEST_REPL_CTXT   = 11,
437         LLOG_MAX_CTXTS
438 };
439
440
441 /* corresponds to one of the obd's */
442 struct obd_device {
443         struct obd_type *obd_type;
444
445         /* common and UUID name of this device */
446         char *obd_name;
447         struct obd_uuid obd_uuid;
448
449         int obd_minor;
450         int obd_attached:1, obd_set_up:1, obd_recovering:1,
451             obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
452             obd_no_recov:1, obd_stopping:1;
453         atomic_t obd_refcount;
454         wait_queue_head_t obd_refcount_waitq;
455         struct proc_dir_entry *obd_proc_entry;
456         struct list_head       obd_exports;
457         int                    obd_num_exports;
458         struct ldlm_namespace *obd_namespace;
459         struct ptlrpc_client   obd_ldlm_client; /* XXX OST/MDS only */
460         /* a spinlock is OK for what we do now, may need a semaphore later */
461         spinlock_t             obd_dev_lock;
462         __u64                  obd_last_committed;
463         struct fsfilt_operations *obd_fsops;
464         spinlock_t              obd_osfs_lock;
465         struct llog_ctxt        *obd_llog_ctxt[LLOG_MAX_CTXTS];
466         struct obd_statfs       obd_osfs;
467         unsigned long           obd_osfs_age;
468         struct obd_run_ctxt     obd_ctxt;
469         struct obd_device       *obd_observer;
470         struct obd_export       *obd_self_export;
471
472         /* XXX encapsulate all this recovery data into one struct */
473         svc_handler_t                    obd_recovery_handler;
474         int                              obd_max_recoverable_clients;
475         int                              obd_connected_clients;
476         int                              obd_recoverable_clients;
477         spinlock_t                       obd_processing_task_lock;
478         pid_t                            obd_processing_task;
479         __u64                            obd_next_recovery_transno;
480         int                              obd_replayed_requests;
481         int                              obd_requests_queued_for_recovery;
482         wait_queue_head_t                obd_next_transno_waitq;
483         struct list_head                 obd_uncommitted_replies;
484         spinlock_t                       obd_uncommitted_replies_lock;
485         struct timer_list                obd_recovery_timer;
486         struct list_head                 obd_recovery_queue;
487         struct list_head                 obd_delayed_reply_queue;
488
489         union {
490                 struct filter_obd filter;
491                 struct mds_obd mds;
492                 struct client_obd cli;
493                 struct ost_obd ost;
494                 struct echo_client_obd echo_client;
495                 struct echo_obd echo;
496                 struct recovd_obd recovd;
497                 struct lov_obd lov;
498                 struct cache_obd cobd;
499                 struct ptlbd_obd ptlbd;
500                 struct mgmtcli_obd mgmtcli;
501         } u;
502        /* Fields used by LProcFS */
503         unsigned int           obd_cntr_base;
504         struct lprocfs_stats  *obd_stats;
505         struct proc_dir_entry *obd_svc_procroot;
506         struct lprocfs_stats  *obd_svc_stats;
507 };
508
509 #define OBD_OPT_FORCE           0x0001
510 #define OBD_OPT_FAILOVER        0x0002
511
512 #define OBD_LLOG_FL_SENDNOW     0x0001
513
514 struct obd_ops {
515         struct module *o_owner;
516         int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
517                            void *karg, void *uarg);
518         int (*o_get_info)(struct obd_export *, __u32 keylen, void *key,
519                           __u32 *vallen, void *val);
520         int (*o_set_info)(struct obd_export *, __u32 keylen, void *key,
521                           __u32 vallen, void *val);
522         int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
523         int (*o_detach)(struct obd_device *dev);
524         int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
525         int (*o_precleanup)(struct obd_device *dev, int flags);
526         int (*o_cleanup)(struct obd_device *dev, int flags);
527         int (*o_postrecov)(struct obd_device *dev);
528         int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
529                          struct obd_uuid *cluuid);
530         int (*o_disconnect)(struct obd_export *exp, int flags);
531
532         int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs,
533                         unsigned long max_age);
534         int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt,
535                         struct lov_stripe_md *mem_src);
536         int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
537                           struct lov_mds_md *disk_src, int disk_len);
538         int (*o_preallocate)(struct lustre_handle *, obd_count *req,
539                              obd_id *ids);
540         int (*o_create)(struct obd_export *exp,  struct obdo *oa,
541                         struct lov_stripe_md **ea, struct obd_trans_info *oti);
542         int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
543                          struct lov_stripe_md *ea, struct obd_trans_info *oti);
544         int (*o_setattr)(struct obd_export *exp, struct obdo *oa,
545                          struct lov_stripe_md *ea, struct obd_trans_info *oti);
546         int (*o_getattr)(struct obd_export *exp, struct obdo *oa,
547                          struct lov_stripe_md *ea);
548         int (*o_getattr_async)(struct obd_export *exp, struct obdo *oa,
549                                struct lov_stripe_md *ea,
550                                struct ptlrpc_request_set *set);
551         int (*o_brw)(int rw, struct obd_export *exp, struct obdo *oa,
552                      struct lov_stripe_md *ea, obd_count oa_bufs,
553                      struct brw_page *pgarr, struct obd_trans_info *oti);
554         int (*o_brw_async)(int rw, struct obd_export *exp, struct obdo *oa,
555                            struct lov_stripe_md *ea, obd_count oa_bufs,
556                            struct brw_page *pgarr, struct ptlrpc_request_set *,
557                            struct obd_trans_info *oti);
558         int (*o_prep_async_page)(struct obd_export *exp, 
559                                  struct lov_stripe_md *lsm,
560                                  struct lov_oinfo *loi, 
561                                  struct page *page, obd_off offset, 
562                                  struct obd_async_page_ops *ops, void *data,
563                                  void **res);
564         int (*o_queue_async_io)(struct obd_export *exp, 
565                                 struct lov_stripe_md *lsm, 
566                                 struct lov_oinfo *loi, void *cookie, 
567                                 int cmd, obd_off off, int count, 
568                                 obd_flag brw_flags, obd_flag async_flags);
569         int (*o_queue_sync_io)(struct obd_export *exp, 
570                                struct lov_stripe_md *lsm, 
571                                struct lov_oinfo *loi, 
572                                struct obd_sync_io_container *osic, 
573                                void *cookie, int cmd, obd_off off, int count, 
574                                obd_flag brw_flags);
575         int (*o_trigger_sync_io)(struct obd_export *exp, 
576                                  struct lov_stripe_md *lsm, 
577                                  struct lov_oinfo *loi, 
578                                  struct obd_sync_io_container *osic);
579         int (*o_set_async_flags)(struct obd_export *exp,
580                                 struct lov_stripe_md *lsm,
581                                 struct lov_oinfo *loi, void *cookie,
582                                 obd_flag async_flags);
583         int (*o_teardown_async_page)(struct obd_export *exp,
584                                      struct lov_stripe_md *lsm,
585                                      struct lov_oinfo *loi, void *cookie);
586         int (*o_punch)(struct obd_export *exp, struct obdo *oa,
587                        struct lov_stripe_md *ea, obd_size start,
588                        obd_size end, struct obd_trans_info *oti);
589         int (*o_sync)(struct obd_export *exp, struct obdo *oa,
590                       struct lov_stripe_md *ea, obd_size start, obd_size end);
591         int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
592                          struct lov_stripe_md *src, obd_size start,
593                          obd_size end, struct obd_trans_info *oti);
594         int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
595                       struct lustre_handle *srconn, struct lov_stripe_md *src,
596                       obd_size start, obd_size end, struct obd_trans_info *);
597         int (*o_iterate)(struct lustre_handle *conn,
598                          int (*)(obd_id, obd_gr, void *),
599                          obd_id *startid, obd_gr group, void *data);
600         int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa,
601                         int objcount, struct obd_ioobj *obj,
602                         int niocount, struct niobuf_remote *remote,
603                         struct niobuf_local *local, struct obd_trans_info *oti);
604         int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa,
605                           int objcount, struct obd_ioobj *obj,
606                           int niocount, struct niobuf_local *local,
607                           struct obd_trans_info *oti);
608         int (*o_enqueue)(struct obd_export *exp, struct lov_stripe_md *md,
609                          struct lustre_handle *parent_lock,
610                          __u32 type, void *cookie, int cookielen, __u32 mode,
611                          int *flags, void *cb, void *data,
612                          struct lustre_handle *lockh);
613         int (*o_match)(struct obd_export *exp, struct lov_stripe_md *md,
614                          __u32 type, void *cookie, int cookielen, __u32 mode,
615                          int *flags, void *data, struct lustre_handle *lockh);
616         int (*o_change_cbdata)(struct obd_export *exp,
617                                struct lov_stripe_md *lsm, ldlm_iterator_t it,
618                                void *data);
619         int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
620                         __u32 mode, struct lustre_handle *);
621         int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
622                                int flags, void *opaque);
623         int (*o_san_preprw)(int cmd, struct obd_export *exp,
624                             struct obdo *oa, int objcount,
625                             struct obd_ioobj *obj, int niocount,
626                             struct niobuf_remote *remote);
627         int (*o_init_export)(struct obd_export *exp);
628         int (*o_destroy_export)(struct obd_export *exp);
629
630         /* llog related obd_methods */
631         int (*o_llog_init)(struct obd_device *obd, struct obd_device *disk_obd,
632                            int count, struct llog_logid *logid);
633         int (*o_llog_finish)(struct obd_device *obd, int count);
634
635         /* only until proper file size mechanics arrive */
636         int (*o_lock_contains)(struct obd_export *exp, 
637                                struct lov_stripe_md *lsm, 
638                                struct ldlm_lock *lock, obd_off offset);
639
640         /* metadata-only methods */
641         int (*o_pin)(struct obd_export *, obd_id ino, __u32 gen, int type,
642                      struct obd_client_handle *, int flag);
643         int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
644
645         int (*o_invalidate_import)(struct obd_device *, struct obd_import *);
646
647         int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
648                         int active);
649         /* 
650          * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
651          * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
652          * Also, add a wrapper function in include/linux/obd_class.h.
653          */
654
655 };
656
657
658 static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno,
659                                          int error)
660 {
661         if (error) {
662                 CERROR("%s: transno "LPD64" commit error: %d\n",
663                        obd->obd_name, transno, error);
664                 return;
665         }
666         CDEBUG(D_HA, "%s: transno "LPD64" committed\n",
667                obd->obd_name, transno);
668         if (transno > obd->obd_last_committed) {
669                 obd->obd_last_committed = transno;
670                 ptlrpc_commit_replies (obd);
671         }
672 }
673
674 #endif /* __OBD_H */