-/* llog contexts */
-enum llog_ctxt_id {
- LLOG_CONFIG_ORIG_CTXT = 0,
- LLOG_CONFIG_REPL_CTXT = 1,
- LLOG_UNLINK_ORIG_CTXT = 2,
- LLOG_UNLINK_REPL_CTXT = 3,
- LLOG_SIZE_ORIG_CTXT = 4,
- LLOG_SIZE_REPL_CTXT = 5,
- LLOG_MD_ORIG_CTXT = 6,
- LLOG_MD_REPL_CTXT = 7,
- LLOG_RD1_ORIG_CTXT = 8,
- LLOG_RD1_REPL_CTXT = 9,
- LLOG_TEST_ORIG_CTXT = 10,
- LLOG_TEST_REPL_CTXT = 11,
- LLOG_REINT_ORIG_CTXT = 12,
- LLOG_AUDIT_ORIG_CTXT = 13,
- LLOG_MAX_CTXTS
-};
-
-struct obd_llogs {
- struct llog_ctxt *llog_ctxt[LLOG_MAX_CTXTS];
-};
-
-struct target_recovery_data {
- svc_handler_t trd_recovery_handler;
- pid_t trd_processing_task;
- struct completion trd_starting;
- struct completion trd_finishing;
-};
-
-/* corresponds to one of the obd's */
-struct obd_device {
- struct obd_type *obd_type;
-
- /* common and UUID name of this device */
- char *obd_name;
- struct obd_uuid obd_uuid;
-
- int obd_minor;
- unsigned int obd_attached:1, obd_set_up:1, obd_recovering:1,
- obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
- obd_no_recov:1, obd_stopping:1;
- atomic_t obd_refcount;
- wait_queue_head_t obd_refcount_waitq;
- struct proc_dir_entry *obd_proc_entry;
- struct list_head obd_exports;
- int obd_num_exports;
- struct ldlm_namespace *obd_namespace;
- struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
- /* a spinlock is OK for what we do now, may need a semaphore later */
- spinlock_t obd_dev_lock;
- __u64 obd_last_committed;
- struct fsfilt_operations *obd_fsops;
- spinlock_t obd_osfs_lock;
- struct obd_statfs obd_osfs;
- unsigned long obd_osfs_age;
- struct lvfs_run_ctxt obd_lvfs_ctxt;
- struct obd_llogs obd_llogs;
- struct llog_ctxt *obd_llog_ctxt[LLOG_MAX_CTXTS];
- struct obd_device *obd_observer;
- struct obd_export *obd_self_export;
-
- struct target_recovery_data obd_recovery_data;
- /* XXX encapsulate all this recovery data into target_recovery_data */
- int obd_max_recoverable_clients;
- int obd_connected_clients;
- int obd_recoverable_clients;
- spinlock_t obd_processing_task_lock;
- __u64 obd_next_recovery_transno;
- int obd_replayed_requests;
- int obd_replayed_locks;
- int obd_requests_queued_for_recovery;
- wait_queue_head_t obd_next_transno_waitq;
- struct list_head obd_uncommitted_replies;
- spinlock_t obd_uncommitted_replies_lock;
- struct timer_list obd_recovery_timer;
- time_t obd_recovery_start;
- time_t obd_recovery_end;
-
- atomic_t obd_req_replay_clients;
- atomic_t obd_lock_replay_clients;
-
- struct list_head obd_req_replay_queue;
- struct list_head obd_lock_replay_queue;
- struct list_head obd_final_req_queue;
- int obd_recovery_stage;
-
- union {
- struct filter_obd filter;
- struct mds_obd mds;
- struct client_obd cli;
- struct ost_obd ost;
- struct echo_client_obd echocli;
- struct echo_obd echo;
- struct recovd_obd recovd;
- struct lov_obd lov;
- struct cache_obd cobd;
- struct ptlbd_obd ptlbd;
- struct mgmtcli_obd mgmtcli;
- struct lmv_obd lmv;
- struct cm_obd cm;
- struct conf_obd conf;
- struct gks_obd gks;
- } u;
-
- /* fields used by LProcFS */
- unsigned int obd_cntr_base;
- struct lprocfs_stats *obd_stats;
- unsigned int md_cntr_base;
- struct lprocfs_stats *md_stats;
-
- struct proc_dir_entry *obd_svc_procroot;
- struct lprocfs_stats *obd_svc_stats;
-};
-
-#define OBD_OPT_FORCE (1 << 0)
-#define OBD_OPT_FAILOVER (1 << 1)
-#define OBD_OPT_REAL_CLIENT (1 << 2)
-#define OBD_OPT_MDS_CONNECTION (1 << 3)
-
-#define OBD_LLOG_FL_SENDNOW (1 << 0)
-#define OBD_LLOG_FL_CREATE (1 << 1)
-
-struct mdc_op_data;
-
-struct obd_ops {
- struct module *o_owner;
- int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
- void *karg, void *uarg);
- int (*o_get_info)(struct obd_export *, __u32 keylen, void *key,
- __u32 *vallen, void *val);
- int (*o_set_info)(struct obd_export *, __u32 keylen, void *key,
- __u32 vallen, void *val);
- int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
- int (*o_detach)(struct obd_device *dev);
- int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
- int (*o_precleanup)(struct obd_device *dev, int flags);
- int (*o_cleanup)(struct obd_device *dev, int flags);
- int (*o_process_config)(struct obd_device *dev, obd_count len,
- void *data);
- int (*o_postrecov)(struct obd_device *dev);
- int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid,
- int priority);
- int (*o_del_conn)(struct obd_import *imp, struct obd_uuid *uuid);
- int (*o_connect)(struct lustre_handle *conn, struct obd_device *src,
- struct obd_uuid *cluuid, struct obd_connect_data *data,
- unsigned long flags);
- int (*o_connect_post)(struct obd_export *exp, unsigned, unsigned long);
- int (*o_disconnect)(struct obd_export *exp, unsigned long flags);
-
- int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs,
- unsigned long max_age);
- int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt,
- struct lov_stripe_md *mem_src);
- int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
- struct lov_mds_md *disk_src, int disk_len);
- int (*o_revalidate_md)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea,
- struct obd_trans_info *oti);
- int (*o_preallocate)(struct lustre_handle *, obd_count *req,
- obd_id *ids);
- int (*o_create)(struct obd_export *exp, struct obdo *oa,
- void *acl, int acl_size,
- struct lov_stripe_md **ea, struct obd_trans_info *oti);
- int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, struct obd_trans_info *oti);
- int (*o_setattr)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, struct obd_trans_info *oti,
- struct lustre_capa *capa);
- int (*o_getattr)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea);
- int (*o_getattr_async)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea,
- struct ptlrpc_request_set *set);
- int (*o_brw)(int rw, struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, obd_count oa_bufs,
- struct brw_page *pgarr, struct obd_trans_info *oti);
- int (*o_brw_async)(int rw, struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, obd_count oa_bufs,
- struct brw_page *pgarr, struct ptlrpc_request_set *,
- struct obd_trans_info *oti);
- int (*o_prep_async_page)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct page *page, obd_off offset,
- struct obd_async_page_ops *ops, void *data,
- void **res);
- int (*o_queue_async_io)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie,
- int cmd, obd_off off, int count,
- obd_flags brw_flags, obd_flags async_flags);
- int (*o_queue_group_io)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_io_group *oig,
- void *cookie, int cmd, obd_off off, int count,
- obd_flags brw_flags, obd_flags async_flags);
- int (*o_trigger_group_io)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi,
- struct obd_io_group *oig);
- int (*o_set_async_flags)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie,
- obd_flags async_flags);
- int (*o_teardown_async_page)(struct obd_export *exp,
- struct lov_stripe_md *lsm,
- struct lov_oinfo *loi, void *cookie);
- int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm,
- obd_off size, int shrink);
- int (*o_punch)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, obd_size start,
- obd_size end, struct obd_trans_info *oti,
- struct lustre_capa *capa);
- int (*o_sync)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, obd_size start, obd_size end);
- int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
- struct lov_stripe_md *src, obd_size start,
- obd_size end, struct obd_trans_info *oti);
- int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
- struct lustre_handle *srconn, struct lov_stripe_md *src,
- obd_size start, obd_size end, struct obd_trans_info *);
- int (*o_iterate)(struct lustre_handle *conn,
- int (*)(obd_id, obd_gr, void *),
- obd_id *startid, obd_gr group, void *data);
- int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa,
- int objcount, struct obd_ioobj *obj,
- int niocount, struct niobuf_remote *remote,
- struct niobuf_local *local, struct obd_trans_info *oti,
- struct lustre_capa *capa);
- int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa,
- int objcount, struct obd_ioobj *obj,
- int niocount, struct niobuf_local *local,
- struct obd_trans_info *oti, int rc);
- int (*o_do_cow)(struct obd_export *exp, struct obd_ioobj *obj,
- int objcount, struct niobuf_remote *rnb);
- int (*o_write_extents)(struct obd_export *exp, struct obd_ioobj *obj,
- int objcount, int niocount,
- struct niobuf_local *local,int rc);
- int (*o_enqueue)(struct obd_export *, struct lov_stripe_md *,
- __u32 type, ldlm_policy_data_t *, __u32 mode,
- int *flags, void *bl_cb, void *cp_cb, void *gl_cb,
- void *data, __u32 lvb_len, void *lvb_swabber,
- struct lustre_handle *lockh);
- int (*o_match)(struct obd_export *, struct lov_stripe_md *, __u32 type,
- ldlm_policy_data_t *, __u32 mode, int *flags, void *data,
- struct lustre_handle *lockh);
- int (*o_change_cbdata)(struct obd_export *, struct lov_stripe_md *,
- ldlm_iterator_t it, void *data);
- int (*o_cancel)(struct obd_export *, struct lov_stripe_md *md,
- __u32 mode, struct lustre_handle *);
- int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
- int flags, void *opaque);
- int (*o_san_preprw)(int cmd, struct obd_export *exp,
- struct obdo *oa, int objcount,
- struct obd_ioobj *obj, int niocount,
- struct niobuf_remote *remote);
- int (*o_init_export)(struct obd_export *exp);
- int (*o_destroy_export)(struct obd_export *exp);