1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
10 #elif defined(__APPLE__)
11 #include <darwin/obd.h>
12 #elif defined(__WINNT__)
13 #include <winnt/obd.h>
15 #error Unsupported operating system.
18 #define IOC_OSC_TYPE 'h'
19 #define IOC_OSC_MIN_NR 20
20 #define IOC_OSC_SET_ACTIVE _IOWR(IOC_OSC_TYPE, 21, struct obd_device *)
21 #define IOC_OSC_MAX_NR 50
23 #define IOC_MDC_TYPE 'i'
24 #define IOC_MDC_MIN_NR 20
25 /* Moved to lustre_user.h
26 #define IOC_MDC_LOOKUP _IOWR(IOC_MDC_TYPE, 20, struct obd_ioctl_data *)
27 #define IOC_MDC_GETSTRIPE _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *) */
28 #define IOC_MDC_MAX_NR 50
30 #include <lustre/lustre_idl.h>
31 #include <lu_object.h>
32 #include <lustre_lib.h>
33 #include <lustre_export.h>
34 #include <lustre_quota.h>
35 #include <lustre_fld.h>
36 #include <lustre_capa.h>
38 #define MAX_OBD_DEVICES 8192
40 /* this is really local to the OSC */
41 struct loi_oap_pages {
42 struct list_head lop_pending;
43 struct list_head lop_urgent;
44 struct list_head lop_pending_group;
54 struct lov_oinfo { /* per-stripe data structure */
55 __u64 loi_id; /* object ID on the target OST */
56 __u64 loi_gr; /* object group on the target OST */
57 int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */
58 int loi_ost_gen; /* generation of this loi_ost_idx */
60 /* used by the osc to keep track of what objects to build into rpcs */
61 struct loi_oap_pages loi_read_lop;
62 struct loi_oap_pages loi_write_lop;
63 /* _cli_ is poorly named, it should be _ready_ */
64 struct list_head loi_cli_item;
65 struct list_head loi_write_item;
66 struct list_head loi_read_item;
68 unsigned loi_kms_valid:1;
69 __u64 loi_kms; /* known minimum size */
70 struct ost_lvb loi_lvb;
71 struct osc_async_rc loi_ar;
74 static inline void loi_init(struct lov_oinfo *loi)
76 CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending);
77 CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_urgent);
78 CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending_group);
79 CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending);
80 CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_urgent);
81 CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending_group);
82 CFS_INIT_LIST_HEAD(&loi->loi_cli_item);
83 CFS_INIT_LIST_HEAD(&loi->loi_write_item);
84 CFS_INIT_LIST_HEAD(&loi->loi_read_item);
87 /*extent array item for describing the joined file extent info*/
89 __u64 le_start; /* extent start */
90 __u64 le_len; /* extent length */
91 int le_loi_idx; /* extent #1 loi's index in lsm loi array */
92 int le_stripe_count; /* extent stripe count*/
95 /*Lov array info for describing joined file array EA info*/
96 struct lov_array_info {
97 struct llog_logid lai_array_id; /* MDS med llog object id */
98 unsigned lai_ext_count; /* number of extent count */
99 struct lov_extent *lai_ext_array; /* extent desc array */
102 struct lov_stripe_md {
104 void *lsm_lock_owner; /* debugging */
107 /* Public members. */
108 __u64 lw_object_id; /* lov object id */
109 __u64 lw_object_gr; /* lov object group */
110 __u64 lw_maxbytes; /* maximum possible file size */
112 /* LOV-private members start here -- only for use in lov/. */
114 __u32 lw_stripe_size; /* size of the stripe */
115 __u32 lw_pattern; /* striping pattern (RAID0, RAID1) */
116 unsigned lw_stripe_count; /* number of objects being striped over */
119 struct lov_array_info *lsm_array; /*Only for joined file array info*/
120 struct lov_oinfo *lsm_oinfo[0];
123 #define lsm_object_id lsm_wire.lw_object_id
124 #define lsm_object_gr lsm_wire.lw_object_gr
125 #define lsm_maxbytes lsm_wire.lw_maxbytes
126 #define lsm_magic lsm_wire.lw_magic
127 #define lsm_stripe_size lsm_wire.lw_stripe_size
128 #define lsm_pattern lsm_wire.lw_pattern
129 #define lsm_stripe_count lsm_wire.lw_stripe_count
133 typedef int (*obd_enqueue_update_f)(struct obd_info *oinfo, int rc);
135 /* obd_enqueue parameters common for all levels (lov, osc). */
136 struct obd_enqueue_info {
137 /* Flags used while lock handling. */
139 /* Type of the lock being enqueued. */
141 /* Mode of the lock being enqueued. */
143 /* Different callbacks for lock handling (blocking, completion,
148 /* Data to be passed into callbacks. */
150 /* Request set for OSC async requests. */
151 struct ptlrpc_request_set *ei_rqset;
154 /* obd info for a particular level (lov, osc). */
156 /* Lock policy. It keeps an extent which is specific for a particular
157 * OSC. (e.g. lov_prep_enqueue_set initialises extent of the policy,
158 * and osc_enqueue passes it into ldlm_lock_match & ldlm_cli_enqueue. */
159 ldlm_policy_data_t oi_policy;
160 /* Lock handle specific for every OSC lock. */
161 struct lustre_handle *oi_lockh;
162 /* lsm data specific for every OSC. */
163 struct lov_stripe_md *oi_md;
164 /* obdo data specific for every OSC, if needed at all. */
166 /* statfs data specific for every OSC, if needed at all. */
167 struct obd_statfs *oi_osfs;
168 /* An update callback which is called to update some data on upper
169 * level. E.g. it is used for update lsm->lsm_oinfo at every recieved
170 * request in osc level for enqueue requests. It is also possible to
171 * update some caller data from LOV layer if needed. */
172 obd_enqueue_update_f oi_cb_up;
173 /* oss capability, its type is obd_capa in client to avoid copy.
174 * in contrary its type is lustre_capa in OSS. */
178 /* compare all relevant fields. */
179 static inline int lov_stripe_md_cmp(struct lov_stripe_md *m1,
180 struct lov_stripe_md *m2)
183 * ->lsm_wire contains padding, but it should be zeroed out during
186 return memcmp(&m1->lsm_wire, &m2->lsm_wire, sizeof m1->lsm_wire);
189 void lov_stripe_lock(struct lov_stripe_md *md);
190 void lov_stripe_unlock(struct lov_stripe_md *md);
193 struct list_head typ_chain;
194 struct obd_ops *typ_dt_ops;
195 struct md_ops *typ_md_ops;
196 cfs_proc_dir_entry_t *typ_procroot;
199 struct lu_device_type *typ_lu;
200 spinlock_t obd_type_lock;
211 ASYNC_READY = 0x1, /* ap_make_ready will not be called before this
212 page is added to an rpc */
213 ASYNC_URGENT = 0x2, /* page must be put into an RPC before return */
214 ASYNC_COUNT_STABLE = 0x4, /* ap_refresh_count will not be called
215 to give the caller a chance to update
216 or cancel the size of the io */
217 ASYNC_GROUP_SYNC = 0x8, /* ap_completion will not be called, instead
218 the page is accounted for in the
219 obd_io_group given to
220 obd_queue_group_io */
223 struct obd_async_page_ops {
224 int (*ap_make_ready)(void *data, int cmd);
225 int (*ap_refresh_count)(void *data, int cmd);
226 void (*ap_fill_obdo)(void *data, int cmd, struct obdo *oa);
227 void (*ap_update_obdo)(void *data, int cmd, struct obdo *oa,
229 int (*ap_completion)(void *data, int cmd, struct obdo *oa, int rc);
230 struct obd_capa *(*ap_lookup_capa)(void *data, int cmd);
233 /* the `oig' is passed down from a caller of obd rw methods. the callee
234 * records enough state such that the caller can sleep on the oig and
235 * be woken when all the callees have finished their work */
236 struct obd_io_group {
238 atomic_t oig_refcount;
241 struct list_head oig_occ_list;
242 cfs_waitq_t oig_waitq;
245 /* the oig callback context lets the callee of obd rw methods register
246 * for callbacks from the caller. */
247 struct oig_callback_context {
248 struct list_head occ_oig_item;
249 /* called when the caller has received a signal while sleeping.
250 * callees of this method are encouraged to abort their state
251 * in the oig. This may be called multiple times. */
252 void (*occ_interrupted)(struct oig_callback_context *occ);
253 unsigned int interrupted:1;
256 /* Individual type definitions */
258 struct ost_server_data;
260 /* hold common fields for "target" device */
261 struct obd_device_target {
262 struct super_block *obt_sb;
263 atomic_t obt_quotachecking;
264 struct lustre_quota_ctxt obt_qctxt;
269 LLOG_CONFIG_ORIG_CTXT = 0,
270 LLOG_CONFIG_REPL_CTXT = 1,
271 LLOG_MDS_OST_ORIG_CTXT = 2,
272 LLOG_MDS_OST_REPL_CTXT = 3,
273 LLOG_SIZE_ORIG_CTXT = 4,
274 LLOG_SIZE_REPL_CTXT = 5,
275 LLOG_MD_ORIG_CTXT = 6,
276 LLOG_MD_REPL_CTXT = 7,
277 LLOG_RD1_ORIG_CTXT = 8,
278 LLOG_RD1_REPL_CTXT = 9,
279 LLOG_TEST_ORIG_CTXT = 10,
280 LLOG_TEST_REPL_CTXT = 11,
281 LLOG_LOVEA_ORIG_CTXT = 12,
282 LLOG_LOVEA_REPL_CTXT = 13,
286 #define FILTER_SUBDIR_COUNT 32 /* set to zero for no subdirs */
288 #define FILTER_GROUP_LLOG 1
289 #define FILTER_GROUP_ECHO 2
290 #define FILTER_GROUP_MDS0 3
292 struct filter_subdirs {
293 cfs_dentry_t *dentry[FILTER_SUBDIR_COUNT];
303 struct llog_ctxt *llog_ctxt[LLOG_MAX_CTXTS];
306 struct filter_group_llog {
307 struct list_head list;
309 struct obd_llogs *llogs;
310 struct obd_export *exp;
314 /* NB this field MUST be first */
315 struct obd_device_target fo_obt;
316 const char *fo_fstype;
317 struct vfsmount *fo_vfsmnt;
320 cfs_dentry_t *fo_dentry_O;
321 cfs_dentry_t **fo_dentry_O_groups;
322 struct filter_subdirs *fo_dentry_O_sub;
323 struct semaphore fo_init_lock; /* group initialization lock */
324 int fo_committed_group;
327 spinlock_t fo_objidlock; /* protect fo_lastobjid */
328 spinlock_t fo_translock; /* protect fsd_last_transno */
329 struct file *fo_rcvd_filp;
330 struct file *fo_health_check_filp;
331 struct lr_server_data *fo_fsd;
332 unsigned long *fo_last_rcvd_slots;
333 __u64 fo_mount_count;
335 unsigned long fo_destroys_in_progress;
336 struct semaphore fo_create_locks[FILTER_SUBDIR_COUNT];
338 struct list_head fo_export_list;
341 obd_size fo_tot_dirty; /* protected by obd_osfs_lock */
342 obd_size fo_tot_granted; /* all values in bytes */
343 obd_size fo_tot_pending;
345 obd_size fo_readcache_max_filesize;
347 struct obd_import *fo_mdc_imp;
348 struct obd_uuid fo_mdc_uuid;
349 struct lustre_handle fo_mdc_conn;
350 struct file **fo_last_objid_files;
351 __u64 *fo_last_objids; /* last created objid for groups,
352 * protected by fo_objidlock */
354 struct semaphore fo_alloc_lock;
356 atomic_t fo_r_in_flight;
357 atomic_t fo_w_in_flight;
360 * per-filter pool of kiobuf's allocated by filter_common_setup() and
361 * torn down by filter_cleanup(). Contains OST_NUM_THREADS elements of
362 * which ->fo_iobuf_count were allocated.
364 * This pool contains kiobuf used by
365 * filter_{prep,commit}rw_{read,write}() and is shared by all OST
368 * Locking: none, each OST thread uses only one element, determined by
369 * its "ordinal number", ->t_id.
371 struct filter_iobuf **fo_iobuf_pool;
374 struct list_head fo_llog_list;
375 spinlock_t fo_llog_list_lock;
377 struct brw_stats fo_filter_stats;
378 struct lustre_quota_ctxt fo_quota_ctxt;
379 spinlock_t fo_quotacheck_lock;
380 atomic_t fo_quotachecking;
382 int fo_fmd_max_num; /* per exp filter_mod_data */
383 int fo_fmd_max_age; /* jiffies to fmd expiry */
385 /* capability related */
386 unsigned int fo_fl_oss_capa;
387 struct list_head fo_capa_keys;
388 struct hlist_head *fo_capa_hash;
391 #define OSC_MAX_RIF_DEFAULT 8
392 #define OSC_MAX_RIF_MAX 256
393 #define OSC_MAX_DIRTY_DEFAULT (OSC_MAX_RIF_DEFAULT * 4)
394 #define OSC_MAX_DIRTY_MB_MAX 2048 /* arbitrary, but < MAX_LONG bytes */
396 #define MDC_MAX_RIF_DEFAULT 8
397 #define MDC_MAX_RIF_MAX 512
402 struct semaphore cl_sem;
403 struct obd_uuid cl_target_uuid;
404 struct obd_import *cl_import; /* ptlrpc connection state */
406 /* max_mds_easize is purely a performance thing so we don't have to
407 * call obd_size_diskmd() all the time. */
408 int cl_default_mds_easize;
409 int cl_max_mds_easize;
410 int cl_max_mds_cookiesize;
412 /* security configuration */
413 struct sec_flavor_config cl_sec_conf;
415 //struct llog_canceld_ctxt *cl_llcd; /* it's included by obd_llog_ctxt */
416 void *cl_llcd_offset;
418 /* the grant values are protected by loi_list_lock below */
419 long cl_dirty; /* all _dirty_ in bytes */
420 long cl_dirty_max; /* allowed w/o rpc */
421 long cl_avail_grant; /* bytes of credit for ost */
422 long cl_lost_grant; /* lost credits (trunc) */
423 struct list_head cl_cache_waiters; /* waiting for cache/grant */
425 /* keep track of objects that have lois that contain pages which
426 * have been queued for async brw. this lock also protects the
427 * lists of osc_client_pages that hang off of the loi */
429 * ->cl_loi_list_lock protects consistency of
430 * ->cl_loi_{ready,read,write}_list. ->ap_make_ready() and
431 * ->ap_completion() call-backs are executed under this lock. As we
432 * cannot guarantee that these call-backs never block on all platforms
433 * (as a matter of fact they do block on Mac OS X), type of
434 * ->cl_loi_list_lock is platform dependent: it's a spin-lock on Linux
435 * and blocking mutex on Mac OS X. (Alternative is to make this lock
436 * blocking everywhere, but we don't want to slow down fast-path of
437 * our main platform.)
439 * Exact type of ->cl_loi_list_lock is defined in arch/obd.h together
440 * with client_obd_list_{un,}lock() and
441 * client_obd_list_lock_{init,done}() functions.
443 client_obd_lock_t cl_loi_list_lock;
444 struct list_head cl_loi_ready_list;
445 struct list_head cl_loi_write_list;
446 struct list_head cl_loi_read_list;
449 /* just a sum of the loi/lop pending numbers to be exported by /proc */
450 int cl_pending_w_pages;
451 int cl_pending_r_pages;
452 int cl_max_pages_per_rpc;
453 int cl_max_rpcs_in_flight;
454 struct obd_histogram cl_read_rpc_hist;
455 struct obd_histogram cl_write_rpc_hist;
456 struct obd_histogram cl_read_page_hist;
457 struct obd_histogram cl_write_page_hist;
458 struct obd_histogram cl_read_offset_hist;
459 struct obd_histogram cl_write_offset_hist;
461 struct mdc_rpc_lock *cl_rpc_lock;
462 struct mdc_rpc_lock *cl_setattr_lock;
463 struct mdc_rpc_lock *cl_close_lock;
464 struct osc_creator cl_oscc;
467 struct semaphore cl_mgc_sem;
468 struct vfsmount *cl_mgc_vfsmnt;
469 struct dentry *cl_mgc_configs_dir;
470 atomic_t cl_mgc_refcount;
471 struct obd_export *cl_mgc_mgsexp;
474 unsigned int cl_checksum:1; /* debug checksums */
476 /* also protected by the poorly named _loi_list_lock lock above */
477 struct osc_async_rc cl_ar;
479 /* used by quotacheck */
480 int cl_qchk_stat; /* quotacheck stat of the peer */
482 /* sequence manager */
483 struct lu_client_seq *cl_seq;
485 #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid)
487 #define CL_NOT_QUOTACHECKED 1 /* client->cl_qchk_stat init value */
490 struct ptlrpc_service *mgs_service;
491 struct vfsmount *mgs_vfsmnt;
492 struct super_block *mgs_sb;
493 struct dentry *mgs_configs_dir;
494 struct dentry *mgs_fid_de;
495 struct list_head mgs_fs_db_list;
496 struct semaphore mgs_sem;
497 cfs_proc_dir_entry_t *mgs_proc_live;
500 /* hah, upper limit 64 should be enough */
501 #define N_NOSQUASH_NIDS 64
502 struct rootsquash_info {
505 int rsi_n_nosquash_nids;
506 lnet_nid_t rsi_nosquash_nids[N_NOSQUASH_NIDS];
510 /* NB this field MUST be first */
511 struct obd_device_target mds_obt;
512 struct ptlrpc_service *mds_service;
513 struct ptlrpc_service *mds_setattr_service;
514 struct ptlrpc_service *mds_readpage_service;
515 struct vfsmount *mds_vfsmnt;
516 cfs_dentry_t *mds_fid_de;
518 int mds_max_cookiesize;
519 struct file *mds_rcvd_filp;
520 spinlock_t mds_transno_lock;
521 __u64 mds_last_transno;
522 __u64 mds_mount_count;
524 unsigned long mds_atime_diff;
525 struct semaphore mds_epoch_sem;
526 struct ll_fid mds_rootfid;
527 struct lr_server_data *mds_server_data;
528 cfs_dentry_t *mds_pending_dir;
529 cfs_dentry_t *mds_logs_dir;
530 cfs_dentry_t *mds_objects_dir;
531 struct llog_handle *mds_cfg_llh;
532 // struct llog_handle *mds_catalog;
533 struct obd_device *mds_osc_obd; /* XXX lov_obd */
534 struct obd_uuid mds_lov_uuid;
536 struct obd_export *mds_osc_exp; /* XXX lov_exp */
537 struct lov_desc mds_lov_desc;
539 obd_id *mds_lov_objids;
540 int mds_lov_objids_size;
541 __u32 mds_lov_objids_in_file;
542 unsigned int mds_lov_objids_dirty:1;
543 int mds_lov_nextid_set;
544 struct file *mds_lov_objid_filp;
545 struct file *mds_health_check_filp;
546 unsigned long *mds_client_bitmap;
547 // struct upcall_cache *mds_group_hash;
549 struct lustre_quota_info mds_quota_info;
550 struct semaphore mds_qonoff_sem;
551 struct semaphore mds_health_sem;
552 unsigned long mds_lov_objids_valid:1,
557 struct upcall_cache *mds_identity_cache;
558 struct upcall_cache *mds_rmtacl_cache;
561 struct rootsquash_info *mds_rootsquash_info;
563 /* for capability keys update */
564 struct lustre_capa_key *mds_capa_keys;
571 struct lustre_handle eo_nl_lock;
576 struct ptlrpc_service *ost_service;
577 struct ptlrpc_service *ost_create_service;
578 struct ptlrpc_service *ost_io_service;
579 struct semaphore ost_health_sem;
582 struct echo_client_obd {
583 struct obd_export *ec_exp; /* the local connection to osc/lov */
585 struct list_head ec_objects;
591 struct obd_uuid lqo_uuid; /* ptlrpc's c_remote_uuid */
592 struct list_head lqo_oss_list; /* link to lov_qos */
593 __u32 lqo_ost_count; /* number of osts on this oss */
594 __u64 lqo_bavail; /* total bytes avail on OSS */
595 __u64 lqo_penalty; /* current penalty */
596 __u64 lqo_penalty_per_obj; /* penalty decrease every obj*/
600 struct lov_qos_oss *ltq_oss; /* oss info */
601 __u64 ltq_penalty; /* current penalty */
602 __u64 ltq_penalty_per_obj; /* penalty decrease every obj*/
603 __u64 ltq_weight; /* net weighting */
604 unsigned int ltq_usable:1; /* usable for striping */
608 struct list_head lq_oss_list; /* list of OSSs that targets use */
609 struct rw_semaphore lq_rw_sem;
610 __u32 lq_active_oss_count;
611 __u32 *lq_rr_array; /* round-robin optimized list */
612 unsigned int lq_rr_size; /* rr array size */
613 unsigned int lq_prio_free; /* priority for free space */
614 unsigned int lq_dirty:1, /* recalc qos data */
615 lq_dirty_rr:1, /* recalc round-robin list */
616 lq_same_space:1,/* the ost's all have approx.
617 the same space avail */
618 lq_reset:1; /* zero current penalties */
621 struct lov_tgt_desc {
622 struct obd_uuid ltd_uuid;
623 struct obd_export *ltd_exp;
624 struct ltd_qos ltd_qos; /* qos info per target */
626 __u32 ltd_index; /* index in lov_obd->tgts */
627 unsigned int ltd_active:1,/* is this target up for requests */
628 ltd_activate:1,/* should this target be activated */
629 ltd_reap:1; /* should this target be deleted */
633 struct lov_desc desc;
634 struct lov_tgt_desc **lov_tgts;
635 struct semaphore lov_lock;
636 struct obd_connect_data lov_ocd;
637 struct lov_qos lov_qos; /* qos info per lov */
638 atomic_t lov_refcount;
639 __u32 lov_tgt_count; /* how many OBD's */
640 __u32 lov_active_tgt_count; /* how many active */
641 __u32 lov_death_row;/* tgts scheduled to be deleted */
642 __u32 lov_tgt_size; /* size of tgts array */
643 __u32 lov_start_idx; /* start index of new inode */
644 __u32 lov_offset_idx; /* aliasing for start_idx */
645 int lov_start_count;/* reseed counter */
649 struct lmv_tgt_desc {
650 struct obd_uuid ltd_uuid;
651 struct obd_export *ltd_exp;
652 int ltd_active; /* is this target up for requests */
654 struct semaphore ltd_fid_sem;
659 struct lu_client_fld lmv_fld;
661 struct lmv_desc desc;
662 struct obd_uuid cluuid;
663 struct obd_export *exp;
670 struct semaphore init_sem;
672 struct lmv_tgt_desc *tgts;
675 struct obd_connect_data *datas;
678 struct obd_connect_data conn_data;
681 struct niobuf_local {
686 cfs_dentry_t *dentry;
691 #define LUSTRE_FLD_NAME "fld"
692 #define LUSTRE_SEQ_NAME "seq"
694 #define LUSTRE_CMM_NAME "cmm"
695 #define LUSTRE_MDD_NAME "mdd"
696 #define LUSTRE_OSD_NAME "osd"
697 #define LUSTRE_LMV_NAME "lmv"
698 #define LUSTRE_CMM_MDC_NAME "cmm-mdc"
700 /* obd device type names */
701 /* FIXME all the references to LUSTRE_MDS_NAME should be swapped with LUSTRE_MDT_NAME */
702 #define LUSTRE_MDS_NAME "mds"
703 #define LUSTRE_MDT_NAME "mdt"
704 #define LUSTRE_MDC_NAME "mdc"
705 #define LUSTRE_OSS_NAME "ost" /* FIXME change name to oss */
706 #define LUSTRE_OST_NAME "obdfilter" /* FIXME change name to ost */
707 #define LUSTRE_OSC_NAME "osc"
708 #define LUSTRE_LOV_NAME "lov"
709 #define LUSTRE_MGS_NAME "mgs"
710 #define LUSTRE_MGC_NAME "mgc"
712 #define LUSTRE_CACHEOBD_NAME "cobd"
713 #define LUSTRE_ECHO_NAME "obdecho"
714 #define LUSTRE_ECHO_CLIENT_NAME "echo_client"
716 /* Constant obd names (post-rename) */
717 #define LUSTRE_MDS_OBDNAME "MDS"
718 #define LUSTRE_OSS_OBDNAME "OSS"
719 #define LUSTRE_MGS_OBDNAME "MGS"
720 #define LUSTRE_MGC_OBDNAME "MGC"
722 /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */
723 #define N_LOCAL_TEMP_PAGE 0x10000000
725 struct obd_trans_info {
729 /* Only used on the server side for tracking acks. */
730 struct oti_req_ack_lock {
731 struct lustre_handle lock;
735 struct llog_cookie oti_onecookie;
736 struct llog_cookie *oti_logcookies;
739 /* initial thread handling transaction */
744 static inline void oti_init(struct obd_trans_info *oti,
745 struct ptlrpc_request *req)
749 memset(oti, 0, sizeof *oti);
754 oti->oti_xid = req->rq_xid;
756 if (req->rq_repmsg && req->rq_reqmsg != 0)
757 oti->oti_transno = lustre_msg_get_transno(req->rq_repmsg);
758 oti->oti_thread_id = req->rq_svc_thread ? req->rq_svc_thread->t_id : -1;
759 oti->oti_conn_cnt = lustre_msg_get_conn_cnt(req->rq_reqmsg);
762 static inline void oti_alloc_cookies(struct obd_trans_info *oti,int num_cookies)
767 if (num_cookies == 1)
768 oti->oti_logcookies = &oti->oti_onecookie;
770 OBD_ALLOC(oti->oti_logcookies,
771 num_cookies * sizeof(oti->oti_onecookie));
773 oti->oti_numcookies = num_cookies;
776 static inline void oti_free_cookies(struct obd_trans_info *oti)
778 if (!oti || !oti->oti_logcookies)
781 if (oti->oti_logcookies == &oti->oti_onecookie)
782 LASSERT(oti->oti_numcookies == 1);
784 OBD_FREE(oti->oti_logcookies,
785 oti->oti_numcookies * sizeof(oti->oti_onecookie));
786 oti->oti_logcookies = NULL;
787 oti->oti_numcookies = 0;
791 * Events signalled through obd_notify() upcall-chain.
793 enum obd_notify_event {
794 /* Device activated */
796 /* Device deactivated */
798 /* Device disconnected */
800 /* Connect data for import were changed */
803 OBD_NOTIFY_SYNC_NONBLOCK,
805 /* Configuration event */
810 * Data structure used to pass obd_notify()-event to non-obd listeners (llite
811 * and liblustre being main examples).
813 struct obd_notify_upcall {
814 int (*onu_upcall)(struct obd_device *host, struct obd_device *watched,
815 enum obd_notify_event ev, void *owner);
816 /* Opaque datum supplied by upper layer listener */
820 struct target_recovery_data {
821 svc_handler_t trd_recovery_handler;
822 pid_t trd_processing_task;
823 struct completion trd_starting;
824 struct completion trd_finishing;
827 /* corresponds to one of the obd's */
828 #define MAX_OBD_NAME 128
829 #define OBD_DEVICE_MAGIC 0XAB5CD6EF
831 struct obd_type *obd_type;
834 /* common and UUID name of this device */
835 char obd_name[MAX_OBD_NAME];
836 struct obd_uuid obd_uuid;
838 struct lu_device *obd_lu_dev;
841 unsigned int obd_attached:1, /* finished attach */
842 obd_set_up:1, /* finished setup */
843 obd_recovering:1, /* there are recoverable clients */
844 obd_abort_recovery:1,/* somebody ioctl'ed us to abort */
845 obd_replayable:1, /* recovery is enabled; inform clients */
846 obd_no_transno:1, /* no committed-transno notification */
847 obd_no_recov:1, /* fail instead of retry messages */
848 obd_req_replaying:1, /* replaying requests */
849 obd_stopping:1, /* started cleanup */
850 obd_starting:1, /* started setup */
851 obd_force:1, /* cleanup with > 0 obd refcount */
852 obd_fail:1, /* cleanup with failover */
853 obd_async_recov:1, /* allow asyncronous orphan cleanup */
854 obd_no_conn:1; /* deny new connections */
855 atomic_t obd_refcount;
856 cfs_waitq_t obd_refcount_waitq;
857 struct list_head obd_exports;
859 struct ldlm_namespace *obd_namespace;
860 struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
861 /* a spinlock is OK for what we do now, may need a semaphore later */
862 spinlock_t obd_dev_lock;
863 struct semaphore obd_dev_sem;
864 __u64 obd_last_committed;
865 struct fsfilt_operations *obd_fsops;
866 spinlock_t obd_osfs_lock;
867 struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */
869 struct lvfs_run_ctxt obd_lvfs_ctxt;
870 struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS];
871 struct obd_device *obd_observer;
872 struct obd_notify_upcall obd_upcall;
873 struct obd_export *obd_self_export;
874 /* list of exports in LRU order, for ping evictor, with obd_dev_lock */
875 struct list_head obd_exports_timed;
876 time_t obd_eviction_timer; /* for ping evictor */
878 /* XXX encapsulate all this recovery data into one struct */
879 svc_handler_t obd_recovery_handler;
880 pid_t obd_processing_task;
882 int obd_max_recoverable_clients;
883 int obd_connected_clients;
884 int obd_recoverable_clients;
885 spinlock_t obd_processing_task_lock; /* BH lock (timer) */
886 __u64 obd_next_recovery_transno;
887 int obd_replayed_requests;
888 int obd_requests_queued_for_recovery;
889 cfs_waitq_t obd_next_transno_waitq;
890 struct list_head obd_uncommitted_replies;
891 spinlock_t obd_uncommitted_replies_lock;
892 cfs_timer_t obd_recovery_timer;
893 time_t obd_recovery_start;
894 time_t obd_recovery_end;
896 /* new recovery stuff from CMD2 */
897 struct target_recovery_data obd_recovery_data;
898 int obd_replayed_locks;
899 atomic_t obd_req_replay_clients;
900 atomic_t obd_lock_replay_clients;
901 struct list_head obd_req_replay_queue;
902 struct list_head obd_lock_replay_queue;
903 struct list_head obd_final_req_queue;
904 int obd_recovery_stage;
907 struct obd_device_target obt;
908 struct filter_obd filter;
910 struct client_obd cli;
912 struct echo_client_obd echo_client;
913 struct echo_obd echo;
918 /* Fields used by LProcFS */
919 unsigned int obd_cntr_base;
920 struct lprocfs_stats *obd_stats;
922 unsigned int md_cntr_base;
923 struct lprocfs_stats *md_stats;
925 cfs_proc_dir_entry_t *obd_proc_entry;
926 cfs_proc_dir_entry_t *obd_proc_exports;
927 cfs_proc_dir_entry_t *obd_svc_procroot;
928 struct lprocfs_stats *obd_svc_stats;
929 struct semaphore obd_proc_exp_sem;
932 #define OBD_OPT_FORCE 0x0001
933 #define OBD_OPT_FAILOVER 0x0002
935 #define OBD_LLOG_FL_SENDNOW 0x0001
937 enum obd_cleanup_stage {
938 /* Special case hack for MDS LOVs */
940 /* Precleanup stage 1, we must make sure all exports (other than the
941 self-export) get destroyed. */
943 /* Precleanup stage 2, do other type-specific cleanup requiring the
945 OBD_CLEANUP_SELF_EXP,
946 /* FIXME we should eliminate the "precleanup" function and make them stages
947 of the "cleanup" function. */
951 /* get/set_info keys */
952 #define KEY_READ_ONLY "read-only"
953 #define KEY_MDS_CONN "mds_conn"
954 #define KEY_NEXT_ID "next_id"
955 #define KEY_LOVDESC "lovdesc"
956 #define KEY_INIT_RECOV "initial_recov"
957 #define KEY_INIT_RECOV_BACKUP "init_recov_bk"
958 #define KEY_FLUSH_CTX "flush_ctx"
959 #define KEY_CAPA_KEY "capa_key"
960 #define KEY_CONN_DATA "conn_data"
961 #define KEY_MAX_EASIZE "max_easize"
962 #define KEY_REVIMP_UPD "revimp_update"
967 struct lu_fid op_fid1; /* operation fid1 (usualy parent) */
968 struct lu_fid op_fid2; /* operation fid2 (usualy child) */
969 struct lu_fid op_fid3; /* 2 extra fids to find conflicting */
970 struct lu_fid op_fid4; /* to the operation locks. */
971 mdsno_t op_mds; /* what mds server open will go to */
972 struct lustre_handle op_handle;
977 struct lmv_stripe_md *op_mea1;
978 struct lmv_stripe_md *op_mea2;
979 __u32 op_suppgids[2];
985 /* iattr fields and blocks. */
986 struct iattr op_attr;
988 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
989 unsigned int op_attr_flags;
992 loff_t op_attr_blocks;
994 /* Size-on-MDS epoch and flags. */
999 struct obd_capa *op_capa1;
1000 struct obd_capa *op_capa2;
1002 /* Various operation flags. */
1005 /* Operation type */
1010 struct module *o_owner;
1011 int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
1012 void *karg, void *uarg);
1013 int (*o_get_info)(struct obd_export *, __u32 keylen, void *key,
1014 __u32 *vallen, void *val);
1015 int (*o_set_info_async)(struct obd_export *, __u32 keylen, void *key,
1016 __u32 vallen, void *val,
1017 struct ptlrpc_request_set *set);
1018 int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
1019 int (*o_detach)(struct obd_device *dev);
1020 int (*o_setup) (struct obd_device *dev, struct lustre_cfg *cfg);
1021 int (*o_precleanup)(struct obd_device *dev,
1022 enum obd_cleanup_stage cleanup_stage);
1023 int (*o_cleanup)(struct obd_device *dev);
1024 int (*o_process_config)(struct obd_device *dev, obd_count len,
1026 int (*o_postrecov)(struct obd_device *dev);
1027 int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid,
1029 int (*o_del_conn)(struct obd_import *imp, struct obd_uuid *uuid);
1030 /* connect to the target device with given connection
1031 * data. @ocd->ocd_connect_flags is modified to reflect flags actually
1032 * granted by the target, which are guaranteed to be a subset of flags
1033 * asked for. If @ocd == NULL, use default parameters. */
1034 int (*o_connect)(const struct lu_env *env,
1035 struct lustre_handle *conn, struct obd_device *src,
1036 struct obd_uuid *cluuid, struct obd_connect_data *ocd);
1037 int (*o_reconnect)(struct obd_export *exp, struct obd_device *src,
1038 struct obd_uuid *cluuid,
1039 struct obd_connect_data *ocd);
1040 int (*o_disconnect)(struct obd_export *exp);
1042 /* Initialize/finalize fids infrastructure. */
1043 int (*o_fid_init)(struct obd_export *exp);
1044 int (*o_fid_fini)(struct obd_export *exp);
1046 /* Allocate new fid according to passed @hint. */
1047 int (*o_fid_alloc)(struct obd_export *exp, struct lu_fid *fid,
1048 struct md_op_data *op_data);
1051 * Object with @fid is getting deleted, we may want to do something
1054 int (*o_fid_delete)(struct obd_export *exp, const struct lu_fid *fid);
1056 int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs,
1058 int (*o_statfs_async)(struct obd_device *obd, struct obd_info *oinfo,
1059 __u64 max_age, struct ptlrpc_request_set *set);
1060 int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt,
1061 struct lov_stripe_md *mem_src);
1062 int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
1063 struct lov_mds_md *disk_src, int disk_len);
1064 int (*o_checkmd)(struct obd_export *exp, struct obd_export *md_exp,
1065 struct lov_stripe_md *mem_tgt);
1066 int (*o_preallocate)(struct lustre_handle *, obd_count *req,
1068 /* FIXME: add fid capability support for create & destroy! */
1069 int (*o_precreate)(struct obd_export *exp, int need_create);
1070 int (*o_create)(struct obd_export *exp, struct obdo *oa,
1071 struct lov_stripe_md **ea, struct obd_trans_info *oti);
1072 int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
1073 struct lov_stripe_md *ea, struct obd_trans_info *oti,
1074 struct obd_export *md_exp);
1075 int (*o_setattr)(struct obd_export *exp, struct obd_info *oinfo,
1076 struct obd_trans_info *oti);
1077 int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo,
1078 struct obd_trans_info *oti,
1079 struct ptlrpc_request_set *rqset);
1080 int (*o_getattr)(struct obd_export *exp, struct obd_info *oinfo);
1081 int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo,
1082 struct ptlrpc_request_set *set);
1083 int (*o_brw)(int rw, struct obd_export *exp, struct obd_info *oinfo,
1084 obd_count oa_bufs, struct brw_page *pgarr,
1085 struct obd_trans_info *oti);
1086 int (*o_brw_async)(int rw, struct obd_export *exp,
1087 struct obd_info *oinfo, obd_count oa_bufs,
1088 struct brw_page *pgarr, struct obd_trans_info *oti,
1089 struct ptlrpc_request_set *);
1090 int (*o_prep_async_page)(struct obd_export *exp,
1091 struct lov_stripe_md *lsm,
1092 struct lov_oinfo *loi,
1093 cfs_page_t *page, obd_off offset,
1094 struct obd_async_page_ops *ops, void *data,
1096 int (*o_queue_async_io)(struct obd_export *exp,
1097 struct lov_stripe_md *lsm,
1098 struct lov_oinfo *loi, void *cookie,
1099 int cmd, obd_off off, int count,
1100 obd_flag brw_flags, obd_flag async_flags);
1101 int (*o_queue_group_io)(struct obd_export *exp,
1102 struct lov_stripe_md *lsm,
1103 struct lov_oinfo *loi,
1104 struct obd_io_group *oig,
1105 void *cookie, int cmd, obd_off off, int count,
1106 obd_flag brw_flags, obd_flag async_flags);
1107 int (*o_trigger_group_io)(struct obd_export *exp,
1108 struct lov_stripe_md *lsm,
1109 struct lov_oinfo *loi,
1110 struct obd_io_group *oig);
1111 int (*o_set_async_flags)(struct obd_export *exp,
1112 struct lov_stripe_md *lsm,
1113 struct lov_oinfo *loi, void *cookie,
1114 obd_flag async_flags);
1115 int (*o_teardown_async_page)(struct obd_export *exp,
1116 struct lov_stripe_md *lsm,
1117 struct lov_oinfo *loi, void *cookie);
1118 int (*o_merge_lvb)(struct obd_export *exp, struct lov_stripe_md *lsm,
1119 struct ost_lvb *lvb, int kms_only);
1120 int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm,
1121 obd_off size, int shrink);
1122 int (*o_punch)(struct obd_export *exp, struct obd_info *oinfo,
1123 struct obd_trans_info *oti,
1124 struct ptlrpc_request_set *rqset);
1125 int (*o_sync)(struct obd_export *exp, struct obdo *oa,
1126 struct lov_stripe_md *ea, obd_size start, obd_size end,
1128 int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
1129 struct lov_stripe_md *src, obd_size start,
1130 obd_size end, struct obd_trans_info *oti);
1131 int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
1132 struct lustre_handle *srconn, struct lov_stripe_md *src,
1133 obd_size start, obd_size end, struct obd_trans_info *);
1134 int (*o_iterate)(struct lustre_handle *conn,
1135 int (*)(obd_id, obd_gr, void *),
1136 obd_id *startid, obd_gr group, void *data);
1137 int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa,
1138 int objcount, struct obd_ioobj *obj,
1139 int niocount, struct niobuf_remote *remote,
1140 struct niobuf_local *local, struct obd_trans_info *oti,
1141 struct lustre_capa *capa);
1142 int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa,
1143 int objcount, struct obd_ioobj *obj,
1144 int niocount, struct niobuf_local *local,
1145 struct obd_trans_info *oti, int rc);
1146 int (*o_enqueue)(struct obd_export *, struct obd_info *oinfo,
1147 struct obd_enqueue_info *einfo);
1148 int (*o_match)(struct obd_export *, struct lov_stripe_md *, __u32 type,
1149 ldlm_policy_data_t *, __u32 mode, int *flags, void *data,
1150 struct lustre_handle *lockh);
1151 int (*o_change_cbdata)(struct obd_export *, struct lov_stripe_md *,
1152 ldlm_iterator_t it, void *data);
1153 int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
1154 __u32 mode, struct lustre_handle *);
1155 int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
1156 int flags, void *opaque);
1157 int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *,
1159 int (*o_init_export)(struct obd_export *exp);
1160 int (*o_destroy_export)(struct obd_export *exp);
1161 int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *,
1162 int cmd, obd_off *);
1164 /* llog related obd_methods */
1165 int (*o_llog_init)(struct obd_device *obd, struct obd_llogs *llog,
1166 struct obd_device *disk_obd, int count,
1167 struct llog_catid *logid, struct obd_uuid *uuid);
1168 int (*o_llog_finish)(struct obd_device *obd, int count);
1169 int (*o_llog_connect)(struct obd_export *, struct llogd_conn_body *);
1171 /* metadata-only methods */
1172 int (*o_pin)(struct obd_export *, const struct lu_fid *fid,
1173 struct obd_capa *, struct obd_client_handle *, int flag);
1174 int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
1176 int (*o_import_event)(struct obd_device *, struct obd_import *,
1177 enum obd_import_event);
1179 int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
1180 enum obd_notify_event ev, void *data);
1182 int (*o_health_check)(struct obd_device *);
1185 int (*o_quotacheck)(struct obd_export *, struct obd_quotactl *);
1186 int (*o_quotactl)(struct obd_export *, struct obd_quotactl *);
1188 int (*o_ping)(struct obd_export *exp);
1190 * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line
1191 * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c.
1192 * Also, add a wrapper function in include/linux/obd_class.h. */
1195 /* TODO: lmv_stripe_md should contain mds capabilities for all slave fids */
1196 struct lmv_stripe_md {
1201 struct lu_fid mea_ids[0];
1205 LUSTRE_OPC_MKDIR = (1 << 0),
1206 LUSTRE_OPC_SYMLINK = (1 << 1),
1207 LUSTRE_OPC_MKNOD = (1 << 2),
1208 LUSTRE_OPC_CREATE = (1 << 3),
1209 LUSTRE_OPC_ANY = (1 << 4)
1212 /* lmv structures */
1213 #define MEA_MAGIC_LAST_CHAR 0xb2221ca1
1214 #define MEA_MAGIC_ALL_CHARS 0xb222a11c
1215 #define MEA_MAGIC_HASH_SEGMENT 0xb222a11b
1217 #define MAX_HASH_SIZE 0x7fffffffUL
1218 #define MAX_HASH_HIGHEST_BIT 0x10000000
1221 struct mdt_body *body;
1222 struct lov_stripe_md *lsm;
1223 struct lmv_stripe_md *mea;
1224 #ifdef CONFIG_FS_POSIX_ACL
1225 struct posix_acl *posix_acl;
1227 struct mdt_remote_perm *remote_perm;
1228 struct obd_capa *mds_capa;
1229 struct obd_capa *oss_capa;
1233 int (*m_getstatus)(struct obd_export *, struct lu_fid *,
1234 struct obd_capa **);
1235 int (*m_change_cbdata)(struct obd_export *, const struct lu_fid *,
1236 ldlm_iterator_t, void *);
1237 int (*m_close)(struct obd_export *, struct md_op_data *,
1238 struct obd_client_handle *, struct ptlrpc_request **);
1239 int (*m_create)(struct obd_export *, struct md_op_data *,
1240 const void *, int, int, __u32, __u32, __u32,
1241 __u64, struct ptlrpc_request **);
1242 int (*m_done_writing)(struct obd_export *, struct md_op_data *,
1243 struct obd_client_handle *);
1244 int (*m_enqueue)(struct obd_export *, int, struct lookup_intent *,
1245 int, struct md_op_data *, struct lustre_handle *,
1246 void *, int, ldlm_completion_callback,
1247 ldlm_blocking_callback, void *, int);
1248 int (*m_getattr)(struct obd_export *, const struct lu_fid *,
1249 struct obd_capa *, obd_valid, int,
1250 struct ptlrpc_request **);
1251 int (*m_getattr_name)(struct obd_export *, const struct lu_fid *,
1252 struct obd_capa *, const char *, int, obd_valid,
1253 int, struct ptlrpc_request **);
1254 int (*m_intent_lock)(struct obd_export *, struct md_op_data *,
1255 void *, int, struct lookup_intent *, int,
1256 struct ptlrpc_request **,
1257 ldlm_blocking_callback, int);
1258 int (*m_link)(struct obd_export *, struct md_op_data *,
1259 struct ptlrpc_request **);
1260 int (*m_rename)(struct obd_export *, struct md_op_data *,
1261 const char *, int, const char *, int,
1262 struct ptlrpc_request **);
1263 int (*m_is_subdir)(struct obd_export *, const struct lu_fid *,
1264 const struct lu_fid *,
1265 struct ptlrpc_request **);
1266 int (*m_setattr)(struct obd_export *, struct md_op_data *, void *,
1267 int , void *, int, struct ptlrpc_request **);
1268 int (*m_sync)(struct obd_export *, const struct lu_fid *,
1269 struct obd_capa *, struct ptlrpc_request **);
1270 int (*m_readpage)(struct obd_export *, const struct lu_fid *,
1271 struct obd_capa *, __u64, struct page *,
1272 struct ptlrpc_request **);
1274 int (*m_unlink)(struct obd_export *, struct md_op_data *,
1275 struct ptlrpc_request **);
1277 int (*m_setxattr)(struct obd_export *, const struct lu_fid *,
1278 struct obd_capa *, obd_valid, const char *,
1279 const char *, int, int, int,
1280 struct ptlrpc_request **);
1282 int (*m_getxattr)(struct obd_export *, const struct lu_fid *,
1283 struct obd_capa *, obd_valid, const char *,
1284 const char *, int, int, int,
1285 struct ptlrpc_request **);
1287 int (*m_init_ea_size)(struct obd_export *, int, int, int);
1289 int (*m_get_lustre_md)(struct obd_export *, struct ptlrpc_request *,
1290 int, struct obd_export *, struct obd_export *,
1291 struct lustre_md *);
1293 int (*m_free_lustre_md)(struct obd_export *, struct lustre_md *);
1295 int (*m_set_open_replay_data)(struct obd_export *,
1296 struct obd_client_handle *,
1297 struct ptlrpc_request *);
1298 int (*m_clear_open_replay_data)(struct obd_export *,
1299 struct obd_client_handle *);
1300 int (*m_set_lock_data)(struct obd_export *, __u64 *, void *);
1302 int (*m_lock_match)(struct obd_export *, int, const struct lu_fid *,
1303 ldlm_type_t, ldlm_policy_data_t *, ldlm_mode_t,
1304 struct lustre_handle *);
1306 int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *,
1307 ldlm_policy_data_t *, ldlm_mode_t, int flags,
1309 int (*m_renew_capa)(struct obd_export *, struct obd_capa *oc,
1310 renew_capa_cb_t cb);
1312 int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *,
1313 struct obd_capa *, struct ptlrpc_request **);
1316 * NOTE: If adding ops, add another LPROCFS_MD_OP_INIT() line to
1317 * lprocfs_alloc_md_stats() in obdclass/lprocfs_status.c. Also, add a
1318 * wrapper function in include/linux/obd_class.h.
1322 struct lsm_operations {
1323 void (*lsm_free)(struct lov_stripe_md *);
1324 int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa,
1325 struct obd_export *md_exp);
1326 void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *,
1328 void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *,
1330 obd_off (*lsm_stripe_offset_by_index)(struct lov_stripe_md *, int);
1331 obd_off (*lsm_stripe_offset_by_offset)(struct lov_stripe_md *, obd_off);
1332 int (*lsm_stripe_index_by_offset)(struct lov_stripe_md *, obd_off);
1333 int (*lsm_revalidate) (struct lov_stripe_md *, struct obd_device *obd);
1334 int (*lsm_lmm_verify) (struct lov_mds_md *lmm, int lmm_bytes,
1336 int (*lsm_unpackmd) (struct lov_obd *lov, struct lov_stripe_md *lsm,
1337 struct lov_mds_md *lmm);
1340 extern struct lsm_operations lsm_plain_ops;
1341 extern struct lsm_operations lsm_join_ops;
1342 static inline struct lsm_operations *lsm_op_find(int magic)
1346 return &lsm_plain_ops;
1347 case LOV_MAGIC_JOIN:
1348 return &lsm_join_ops;
1350 CERROR("Cannot recognize lsm_magic %d\n", magic);
1355 int lvfs_check_io_health(struct obd_device *obd, struct file *file);
1357 /* Requests for obd_extent_calc() */
1358 #define OBD_CALC_STRIPE_START 1
1359 #define OBD_CALC_STRIPE_END 2
1361 static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno,
1365 CERROR("%s: transno "LPD64" commit error: %d\n",
1366 obd->obd_name, transno, error);
1369 CDEBUG(D_HA, "%s: transno "LPD64" committed\n",
1370 obd->obd_name, transno);
1371 if (transno > obd->obd_last_committed) {
1372 obd->obd_last_committed = transno;
1373 ptlrpc_commit_replies (obd);
1377 static inline void init_obd_quota_ops(quota_interface_t *interface,
1378 struct obd_ops *obd_ops)
1384 obd_ops->o_quotacheck = QUOTA_OP(interface, check);
1385 obd_ops->o_quotactl = QUOTA_OP(interface, ctl);
1388 static inline __u64 oinfo_mdsno(struct obd_info *oinfo)
1390 return oinfo->oi_oa->o_gr - FILTER_GROUP_MDS0;
1393 static inline struct lustre_capa *oinfo_capa(struct obd_info *oinfo)
1395 return oinfo->oi_capa;
1398 #endif /* __OBD_H */