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