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