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