1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
13 #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
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_MAX_NR 50
24 # include <linux/fs.h>
25 # include <linux/list.h>
26 # include <linux/sched.h> /* for struct task_struct, for current.h */
27 # include <asm/current.h> /* for smp_lock.h */
28 # include <linux/smp_lock.h>
29 # include <linux/proc_fs.h>
30 # include <linux/mount.h>
33 #include <linux/lvfs.h>
34 #include <linux/lustre_lib.h>
35 #include <linux/lustre_idl.h>
36 #include <linux/lustre_export.h>
38 /* this is really local to the OSC */
39 struct loi_oap_pages {
40 struct list_head lop_pending;
42 struct list_head lop_urgent;
43 struct list_head lop_pending_group;
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 */
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;
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 */
67 static inline void loi_init(struct lov_oinfo *loi)
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);
80 struct lov_stripe_md {
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 */
87 /* LOV-private members start here -- only for use in lov/. */
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];
96 struct list_head typ_chain;
97 struct obd_ops *typ_ops;
98 struct md_ops *typ_md_ops;
99 struct proc_dir_entry *typ_procroot;
112 ASYNC_READY = 0x1, /* ap_make_ready will not be called before this
113 page is added to an rpc */
115 ASYNC_COUNT_STABLE = 0x4, /* ap_refresh_count will not be called
116 to give the caller a chance to update
117 or cancel the size of the io */
118 ASYNC_GROUP_SYNC = 0x8, /* ap_completion will not be called, instead
119 the page is accounted for in the
120 obd_io_group given to
121 obd_queue_group_io */
124 struct obd_async_page_ops {
125 int (*ap_make_ready)(void *data, int cmd);
126 int (*ap_refresh_count)(void *data, int cmd);
127 void (*ap_fill_obdo)(void *data, int cmd, struct obdo *oa);
128 void (*ap_completion)(void *data, int cmd, struct obdo *oa, int rc);
131 /* the `oig' is passed down from a caller of obd rw methods. the callee
132 * records enough state such that the caller can sleep on the oig and
133 * be woken when all the callees have finished their work */
134 struct obd_io_group {
136 atomic_t oig_refcount;
139 struct list_head oig_occ_list;
140 wait_queue_head_t oig_waitq;
143 /* the oig callback context lets the callee of obd rw methods register
144 * for callbacks from the caller. */
145 struct oig_callback_context {
146 struct list_head occ_oig_item;
147 /* called when the caller has received a signal while sleeping.
148 * callees of this method are encouraged to abort their state
149 * in the oig. This may be called multiple times. */
150 void (*occ_interrupted)(struct oig_callback_context *occ);
153 /* if we find more consumers this could be generalized */
154 #define OBD_HIST_MAX 32
155 struct obd_histogram {
157 unsigned long oh_buckets[OBD_HIST_MAX];
160 struct ost_server_data;
162 #define FILTER_SUBDIR_COUNT 32 /* set to zero for no subdirs */
164 #define FILTER_GROUP_LLOG 1
165 #define FILTER_GROUP_ECHO 2
166 #define FILTER_GROUP_FIRST_MDS 3
168 struct filter_subdirs {
169 struct dentry *dentry[FILTER_SUBDIR_COUNT];
172 struct filter_group_llog {
173 struct list_head list;
175 struct obd_llogs *llogs;
179 const char *fo_fstype;
180 struct super_block *fo_sb;
181 struct vfsmount *fo_vfsmnt;
184 struct dentry *fo_dentry_O; /* the "O"bject directory dentry */
185 struct dentry **fo_groups; /* dentries for each group dir */
186 struct filter_subdirs *fo_subdirs; /* subdir array per group */
187 __u64 *fo_last_objids; // per-group last created objid
188 struct file **fo_last_objid_files;
190 spinlock_t fo_objidlock; /* protect fo_lastobjid increment */
191 spinlock_t fo_translock; /* protect fsd_last_rcvd increment */
192 struct file *fo_rcvd_filp;
193 struct filter_server_data *fo_fsd;
194 unsigned long *fo_last_rcvd_slots;
195 __u64 fo_mount_count;
197 unsigned int fo_destroy_in_progress:1;
198 struct semaphore fo_create_lock;
200 struct file_operations *fo_fop;
201 struct inode_operations *fo_iop;
202 struct address_space_operations *fo_aops;
204 struct list_head fo_export_list;
207 obd_size fo_tot_dirty; /* protected by obd_osfs_lock */
208 obd_size fo_tot_granted; /* all values in bytes */
209 obd_size fo_tot_pending;
211 obd_size fo_readcache_max_filesize;
213 struct obd_import *fo_mdc_imp;
214 struct obd_uuid fo_mdc_uuid;
215 struct lustre_handle fo_mdc_conn;
217 struct semaphore fo_alloc_lock;
219 struct obd_histogram fo_r_pages;
220 struct obd_histogram fo_w_pages;
221 struct obd_histogram fo_r_discont_pages;
222 struct obd_histogram fo_w_discont_pages;
223 struct obd_histogram fo_r_discont_blocks;
224 struct obd_histogram fo_w_discont_blocks;
226 struct list_head fo_llog_list;
227 spinlock_t fo_llog_list_lock;
230 struct mds_server_data;
232 #define OSC_MAX_RIF_DEFAULT 4
233 #define OSC_MAX_RIF_MAX 32
234 #define OSC_MAX_DIRTY_DEFAULT 4
235 #define OSC_MAX_DIRTY_MB_MAX 256 /* totally arbitrary */
239 struct obd_import *cl_import;
240 struct semaphore cl_sem;
242 /* max_mds_easize is purely a performance thing so we don't have to
243 * call obd_size_wiremd() all the time. */
244 int cl_max_mds_easize;
245 int cl_max_mds_cookiesize;
248 //struct llog_canceld_ctxt *cl_llcd; /* it's included by obd_llog_ctxt */
249 void *cl_llcd_offset;
251 struct obd_device *cl_mgmtcli_obd;
253 /* the grant values are protected by loi_list_lock below */
254 long cl_dirty; /* all _dirty_ in bytes */
255 long cl_dirty_max; /* allowed w/o rpc */
256 long cl_avail_grant; /* bytes of credit for ost */
257 long cl_lost_grant; /* lost credits (trunc) */
258 struct list_head cl_cache_waiters; /* waiting for cache/grant */
260 /* keep track of objects that have lois that contain pages which
261 * have been queued for async brw. this lock also protects the
262 * lists of osc_client_pages that hang off of the loi */
263 spinlock_t cl_loi_list_lock;
264 struct list_head cl_loi_ready_list;
265 struct list_head cl_loi_write_list;
266 struct list_head cl_loi_read_list;
267 int cl_brw_in_flight;
268 /* just a sum of the loi/lop pending numbers to be exported by /proc */
269 int cl_pending_w_pages;
270 int cl_pending_r_pages;
271 int cl_max_pages_per_rpc;
272 int cl_max_rpcs_in_flight;
273 struct obd_histogram cl_read_rpc_hist;
274 struct obd_histogram cl_write_rpc_hist;
275 struct obd_histogram cl_read_page_hist;
276 struct obd_histogram cl_write_page_hist;
278 struct mdc_rpc_lock *cl_rpc_lock;
279 struct mdc_rpc_lock *cl_setattr_lock;
280 struct osc_creator cl_oscc;
283 /* Like a client, with some hangers-on. Keep mc_client_obd first so that we
284 * can reuse the various client setup/connect functions. */
286 struct client_obd mc_client_obd; /* nested */
287 struct ptlrpc_thread *mc_ping_thread;
288 struct obd_export *mc_ping_exp; /* XXX single-target */
289 struct list_head mc_registered;
293 #define mc_import mc_client_obd.cl_import
296 struct ptlrpc_service *mds_service;
297 struct ptlrpc_service *mds_setattr_service;
298 struct ptlrpc_service *mds_readpage_service;
299 struct super_block *mds_sb;
300 struct vfsmount *mds_vfsmnt;
301 struct dentry *mds_fid_de;
303 int mds_max_cookiesize;
304 struct file *mds_rcvd_filp;
305 spinlock_t mds_transno_lock;
306 __u64 mds_last_transno;
307 __u64 mds_mount_count;
309 struct semaphore mds_epoch_sem;
310 struct ll_fid mds_rootfid;
311 struct mds_server_data *mds_server_data;
312 struct dentry *mds_pending_dir;
313 struct dentry *mds_logs_dir;
314 struct dentry *mds_objects_dir;
315 struct llog_handle *mds_cfg_llh;
316 // struct llog_handle *mds_catalog;
317 struct obd_device *mds_osc_obd; /* XXX lov_obd */
318 struct obd_uuid mds_lov_uuid;
320 struct obd_export *mds_osc_exp; /* XXX lov_exp */
321 int mds_has_lov_desc;
322 struct lov_desc mds_lov_desc;
323 obd_id *mds_lov_objids;
324 int mds_lov_objids_valid;
325 int mds_lov_nextid_set;
326 struct file *mds_lov_objid_filp;
327 unsigned long *mds_client_bitmap;
328 struct semaphore mds_orphan_recovery_sem;
329 /*add mds num here for real mds and cache mds create
330 FIXME later will be totally fixed by b_cmd*/
332 atomic_t mds_open_count;
335 struct obd_device *mds_lmv_obd; /* XXX lmv_obd */
336 struct obd_export *mds_lmv_exp; /* XXX lov_exp */
337 struct ptlrpc_service *mds_create_service;
338 atomic_t mds_real_clients;
339 struct obd_uuid mds_lmv_uuid;
340 struct dentry *mds_fids_dir;
357 * this struct does double-duty acting as either a client or
358 * server instance .. maybe not wise.
362 struct ptlrpc_service *ptlbd_service;
365 struct ptlrpc_client bd_client;
366 struct obd_import *bd_import;
367 struct obd_uuid bd_server_uuid;
368 struct obd_export *bd_exp;
369 int refcount; /* XXX sigh */
373 spinlock_t recovd_lock;
374 struct list_head recovd_managed_items; /* items managed */
375 struct list_head recovd_troubled_items; /* items in recovery */
377 wait_queue_head_t recovd_recovery_waitq;
378 wait_queue_head_t recovd_ctl_waitq;
379 wait_queue_head_t recovd_waitq;
380 struct task_struct *recovd_thread;
385 struct ptlrpc_service *ost_service;
386 struct ptlrpc_service *ost_create_service;
389 struct echo_client_obd {
390 struct obd_export *ec_exp; /* the local connection to osc/lov */
392 struct list_head ec_objects;
398 struct obd_export *cobd_real_exp;/* local connection to target obd */
399 struct obd_export *cobd_cache_exp; /* local connection to cache obd */
404 struct lov_tgt_desc {
405 struct obd_uuid uuid;
406 struct obd_export *ltd_exp;
407 int active; /* is this target up for requests */
412 struct lov_desc desc;
415 int lo_catalog_loaded:1;
416 struct lov_tgt_desc *tgts;
419 struct lmv_tgt_desc {
420 struct obd_uuid uuid;
421 struct obd_export *exp;
428 struct lmv_tgt_desc *tgts;
429 struct obd_uuid cluuid;
430 struct obd_export *exp;
437 struct niobuf_local {
442 struct dentry *dentry;
447 struct cache_manager_obd {
448 struct obd_device *cm_master_obd; /* master lov */
449 struct obd_export *cm_master_exp;
450 struct obd_device *cm_cache_obd; /* cache obdfilter */
451 struct obd_export *cm_cache_exp;
452 int cm_master_group; /* master group*/
453 struct cmobd_write_service *cm_write_srv;
457 /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */
458 #define N_LOCAL_TEMP_PAGE 0x10000000
460 struct obd_trans_info {
463 /* Only used on the server side for tracking acks. */
464 struct oti_req_ack_lock {
465 struct lustre_handle lock;
469 struct llog_cookie oti_onecookie;
470 struct llog_cookie *oti_logcookies;
474 static inline void oti_alloc_cookies(struct obd_trans_info *oti,int num_cookies)
479 if (num_cookies == 1)
480 oti->oti_logcookies = &oti->oti_onecookie;
482 OBD_ALLOC(oti->oti_logcookies,
483 num_cookies * sizeof(oti->oti_onecookie));
485 oti->oti_numcookies = num_cookies;
488 static inline void oti_free_cookies(struct obd_trans_info *oti)
490 if (!oti || !oti->oti_logcookies)
493 if (oti->oti_logcookies == &oti->oti_onecookie)
494 LASSERT(oti->oti_numcookies == 1);
496 OBD_FREE(oti->oti_logcookies,
497 oti->oti_numcookies * sizeof(oti->oti_onecookie));
498 oti->oti_logcookies = NULL;
499 oti->oti_numcookies = 0;
504 LLOG_CONFIG_ORIG_CTXT = 0,
505 LLOG_CONFIG_REPL_CTXT = 1,
506 LLOG_UNLINK_ORIG_CTXT = 2,
507 LLOG_UNLINK_REPL_CTXT = 3,
508 LLOG_SIZE_ORIG_CTXT = 4,
509 LLOG_SIZE_REPL_CTXT = 5,
510 LLOG_MD_ORIG_CTXT = 6,
511 LLOG_MD_REPL_CTXT = 7,
512 LLOG_RD1_ORIG_CTXT = 8,
513 LLOG_RD1_REPL_CTXT = 9,
514 LLOG_TEST_ORIG_CTXT = 10,
515 LLOG_TEST_REPL_CTXT = 11,
516 LLOG_REINT_ORIG_CTXT = 12,
521 struct llog_ctxt *llog_ctxt[LLOG_MAX_CTXTS];
524 /* corresponds to one of the obd's */
526 struct obd_type *obd_type;
528 /* common and UUID name of this device */
530 struct obd_uuid obd_uuid;
533 unsigned int obd_attached:1, obd_set_up:1, obd_recovering:1,
534 obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
535 obd_no_recov:1, obd_stopping:1;
536 atomic_t obd_refcount;
537 wait_queue_head_t obd_refcount_waitq;
538 struct proc_dir_entry *obd_proc_entry;
539 struct list_head obd_exports;
541 struct ldlm_namespace *obd_namespace;
542 struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
543 /* a spinlock is OK for what we do now, may need a semaphore later */
544 spinlock_t obd_dev_lock;
545 __u64 obd_last_committed;
546 struct fsfilt_operations *obd_fsops;
547 spinlock_t obd_osfs_lock;
548 struct obd_statfs obd_osfs;
549 unsigned long obd_osfs_age;
550 struct lvfs_run_ctxt obd_lvfs_ctxt;
551 struct obd_llogs obd_llogs;
552 struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS];
553 struct obd_device *obd_observer;
554 struct obd_export *obd_self_export;
556 /* XXX encapsulate all this recovery data into one struct */
557 svc_handler_t obd_recovery_handler;
558 int obd_max_recoverable_clients;
559 int obd_connected_clients;
560 int obd_recoverable_clients;
561 spinlock_t obd_processing_task_lock;
562 pid_t obd_processing_task;
563 __u64 obd_next_recovery_transno;
564 int obd_replayed_requests;
565 int obd_requests_queued_for_recovery;
566 wait_queue_head_t obd_next_transno_waitq;
567 struct list_head obd_uncommitted_replies;
568 spinlock_t obd_uncommitted_replies_lock;
569 struct timer_list obd_recovery_timer;
570 struct list_head obd_recovery_queue;
571 struct list_head obd_delayed_reply_queue;
574 struct filter_obd filter;
576 struct client_obd cli;
578 struct echo_client_obd echo_client;
579 struct echo_obd echo;
580 struct recovd_obd recovd;
582 struct cache_obd cobd;
583 struct ptlbd_obd ptlbd;
584 struct mgmtcli_obd mgmtcli;
586 struct cache_manager_obd cmobd;
588 /* Fields used by LProcFS */
589 unsigned int obd_cntr_base;
590 struct lprocfs_stats *obd_stats;
591 struct proc_dir_entry *obd_svc_procroot;
592 struct lprocfs_stats *obd_svc_stats;
595 #define OBD_OPT_FORCE 0x0001
596 #define OBD_OPT_FAILOVER 0x0002
597 #define OBD_OPT_REAL_CLIENT 0x0004
599 #define OBD_LLOG_FL_SENDNOW 0x0001
604 struct module *o_owner;
605 int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
606 void *karg, void *uarg);
607 int (*o_get_info)(struct obd_export *, __u32 keylen, void *key,
608 __u32 *vallen, void *val);
609 int (*o_set_info)(struct obd_export *, __u32 keylen, void *key,
610 __u32 vallen, void *val);
611 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
612 int (*o_detach)(struct obd_device *dev);
613 int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
614 int (*o_precleanup)(struct obd_device *dev, int flags);
615 int (*o_cleanup)(struct obd_device *dev, int flags);
616 int (*o_postrecov)(struct obd_device *dev);
617 int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
618 struct obd_uuid *cluuid);
619 int (*o_disconnect)(struct obd_export *exp, int flags);
621 int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs,
622 unsigned long max_age);
623 int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt,
624 struct lov_stripe_md *mem_src);
625 int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
626 struct lov_mds_md *disk_src, int disk_len);
627 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
629 int (*o_create)(struct obd_export *exp, struct obdo *oa,
630 struct lov_stripe_md **ea, struct obd_trans_info *oti);
631 int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
632 struct lov_stripe_md *ea, struct obd_trans_info *oti);
633 int (*o_setattr)(struct obd_export *exp, struct obdo *oa,
634 struct lov_stripe_md *ea, struct obd_trans_info *oti);
635 int (*o_getattr)(struct obd_export *exp, struct obdo *oa,
636 struct lov_stripe_md *ea);
637 int (*o_getattr_async)(struct obd_export *exp, struct obdo *oa,
638 struct lov_stripe_md *ea,
639 struct ptlrpc_request_set *set);
640 int (*o_brw)(int rw, struct obd_export *exp, struct obdo *oa,
641 struct lov_stripe_md *ea, obd_count oa_bufs,
642 struct brw_page *pgarr, struct obd_trans_info *oti);
643 int (*o_brw_async)(int rw, struct obd_export *exp, struct obdo *oa,
644 struct lov_stripe_md *ea, obd_count oa_bufs,
645 struct brw_page *pgarr, struct ptlrpc_request_set *,
646 struct obd_trans_info *oti);
647 int (*o_prep_async_page)(struct obd_export *exp,
648 struct lov_stripe_md *lsm,
649 struct lov_oinfo *loi,
650 struct page *page, obd_off offset,
651 struct obd_async_page_ops *ops, void *data,
653 int (*o_queue_async_io)(struct obd_export *exp,
654 struct lov_stripe_md *lsm,
655 struct lov_oinfo *loi, void *cookie,
656 int cmd, obd_off off, int count,
657 obd_flag brw_flags, obd_flag async_flags);
658 int (*o_queue_group_io)(struct obd_export *exp,
659 struct lov_stripe_md *lsm,
660 struct lov_oinfo *loi,
661 struct obd_io_group *oig,
662 void *cookie, int cmd, obd_off off, int count,
663 obd_flag brw_flags, obd_flag async_flags);
664 int (*o_trigger_group_io)(struct obd_export *exp,
665 struct lov_stripe_md *lsm,
666 struct lov_oinfo *loi,
667 struct obd_io_group *oig);
668 int (*o_set_async_flags)(struct obd_export *exp,
669 struct lov_stripe_md *lsm,
670 struct lov_oinfo *loi, void *cookie,
671 obd_flag async_flags);
672 int (*o_teardown_async_page)(struct obd_export *exp,
673 struct lov_stripe_md *lsm,
674 struct lov_oinfo *loi, void *cookie);
675 int (*o_punch)(struct obd_export *exp, struct obdo *oa,
676 struct lov_stripe_md *ea, obd_size start,
677 obd_size end, struct obd_trans_info *oti);
678 int (*o_sync)(struct obd_export *exp, struct obdo *oa,
679 struct lov_stripe_md *ea, obd_size start, obd_size end);
680 int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
681 struct lov_stripe_md *src, obd_size start,
682 obd_size end, struct obd_trans_info *oti);
683 int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
684 struct lustre_handle *srconn, struct lov_stripe_md *src,
685 obd_size start, obd_size end, struct obd_trans_info *);
686 int (*o_iterate)(struct lustre_handle *conn,
687 int (*)(obd_id, obd_gr, void *),
688 obd_id *startid, obd_gr group, void *data);
689 int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa,
690 int objcount, struct obd_ioobj *obj,
691 int niocount, struct niobuf_remote *remote,
692 struct niobuf_local *local, struct obd_trans_info *oti);
693 int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa,
694 int objcount, struct obd_ioobj *obj,
695 int niocount, struct niobuf_local *local,
696 struct obd_trans_info *oti, int rc);
697 int (*o_write_extents)(struct obd_export *exp, struct obd_ioobj *obj,
698 int niocount, struct niobuf_local *local,int rc);
699 int (*o_enqueue)(struct obd_export *, struct lov_stripe_md *,
700 __u32 type, ldlm_policy_data_t *, __u32 mode,
701 int *flags, void *bl_cb, void *cp_cb, void *gl_cb,
702 void *data, __u32 lvb_len, void *lvb_swabber,
703 struct lustre_handle *lockh);
704 int (*o_match)(struct obd_export *, struct lov_stripe_md *, __u32 type,
705 ldlm_policy_data_t *, __u32 mode, int *flags, void *data,
706 struct lustre_handle *lockh);
707 int (*o_change_cbdata)(struct obd_export *, struct lov_stripe_md *,
708 ldlm_iterator_t it, void *data);
709 int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
710 __u32 mode, struct lustre_handle *);
711 int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
712 int flags, void *opaque);
713 int (*o_san_preprw)(int cmd, struct obd_export *exp,
714 struct obdo *oa, int objcount,
715 struct obd_ioobj *obj, int niocount,
716 struct niobuf_remote *remote);
717 int (*o_init_export)(struct obd_export *exp);
718 int (*o_destroy_export)(struct obd_export *exp);
720 /* llog related obd_methods */
721 int (*o_llog_init)(struct obd_device *, struct obd_llogs *,
722 struct obd_device *, int, struct llog_catid *);
723 int (*o_llog_finish)(struct obd_device *, struct obd_llogs *, int);
724 int (*o_llog_connect)(struct obd_device *, struct llogd_conn_body *);
727 /* metadata-only methods */
728 int (*o_pin)(struct obd_export *, obd_id ino, __u32 gen, int type,
729 struct obd_client_handle *, int flag);
730 int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
732 int (*o_import_event)(struct obd_device *, struct obd_import *,
733 enum obd_import_event);
735 int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
737 int (*o_init_ea_size)(struct obd_export *, int, int);
740 * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
741 * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
742 * Also, add a wrapper function in include/linux/obd_class.h.
749 int (*m_getstatus)(struct obd_export *, struct ll_fid *);
750 int (*m_change_cbdata)(struct obd_export *, struct ll_fid *,
751 ldlm_iterator_t, void *);
752 int (*m_change_cbdata_name)(struct obd_export *, struct ll_fid *,
753 char *, int, struct ll_fid *,
754 ldlm_iterator_t, void *);
755 int (*m_close)(struct obd_export *, struct obdo *,
756 struct obd_client_handle *,
757 struct ptlrpc_request **);
758 int (*m_create)(struct obd_export *, struct mdc_op_data *,
759 const void *, int, int, __u32, __u32,
760 __u64, struct ptlrpc_request **);
761 int (*m_done_writing)(struct obd_export *, struct obdo *);
762 int (*m_enqueue)(struct obd_export *, int, struct lookup_intent *,
763 int, struct mdc_op_data *, struct lustre_handle *,
764 void *, int, ldlm_completion_callback,
765 ldlm_blocking_callback, void *);
766 int (*m_getattr)(struct obd_export *, struct ll_fid *,
767 unsigned long, unsigned int,
768 struct ptlrpc_request **);
769 int (*m_getattr_name)(struct obd_export *, struct ll_fid *,
770 char *, int, unsigned long,
771 unsigned int, struct ptlrpc_request **);
772 int (*m_intent_lock)(struct obd_export *, struct ll_uctxt *,
773 struct ll_fid *, const char *, int,
774 void *, int, struct ll_fid *,
775 struct lookup_intent *, int,
776 struct ptlrpc_request **,
777 ldlm_blocking_callback);
778 int (*m_link)(struct obd_export *, struct mdc_op_data *,
779 struct ptlrpc_request **);
780 int (*m_rename)(struct obd_export *, struct mdc_op_data *,
781 const char *, int, const char *, int,
782 struct ptlrpc_request **);
783 int (*m_setattr)(struct obd_export *, struct mdc_op_data *,
784 struct iattr *, void *, int , void *, int,
785 struct ptlrpc_request **);
786 int (*m_sync)(struct obd_export *, struct ll_fid *,
787 struct ptlrpc_request **);
788 int (*m_readpage)(struct obd_export *, struct ll_fid *,
789 __u64, struct page *, struct ptlrpc_request **);
790 int (*m_unlink)(struct obd_export *, struct mdc_op_data *,
791 struct ptlrpc_request **);
792 int (*m_valid_attrs)(struct obd_export *, struct ll_fid *);
793 struct obd_device * (*m_get_real_obd)(struct obd_export *,
794 char *name, int len);
796 int (*m_req2lustre_md)(struct obd_export *exp,
797 struct ptlrpc_request *req, unsigned int offset,
798 struct obd_export *osc_exp, struct lustre_md *md);
799 int (*m_set_open_replay_data)(struct obd_export *exp,
800 struct obd_client_handle *och,
801 struct ptlrpc_request *open_req);
802 int (*m_clear_open_replay_data)(struct obd_export *exp,
803 struct obd_client_handle *och);
804 int (*m_store_inode_generation)(struct obd_export *exp,
805 struct ptlrpc_request *req, int reqoff,
807 int (*m_set_lock_data)(struct obd_export *exp, __u64 *l, void *data);
810 * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
811 * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
812 * Also, add a wrapper function in include/linux/obd_class.h.
816 static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno,
820 CERROR("%s: transno "LPD64" commit error: %d\n",
821 obd->obd_name, transno, error);
824 CDEBUG(D_HA, "%s: transno "LPD64" committed\n",
825 obd->obd_name, transno);
826 if (transno > obd->obd_last_committed) {
827 obd->obd_last_committed = transno;
828 ptlrpc_commit_replies (obd);