📄 obd.h
字号:
OBD_CLEANUP_SELF_EXP,/* FIXME we should eliminate the "precleanup" function and make them stages of the "cleanup" function. */ OBD_CLEANUP_OBD,};/* get/set_info keys */#define KEY_MDS_CONN "mds_conn"#define KEY_NEXT_ID "next_id"#define KEY_LOVDESC "lovdesc"#define KEY_INIT_RECOV "initial_recov"#define KEY_INIT_RECOV_BACKUP "init_recov_bk"#define KEY_LOV_IDX "lov_idx"#define KEY_LAST_ID "last_id"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_async)(struct obd_export *, __u32 keylen, void *key, __u32 vallen, void *val, struct ptlrpc_request_set *set); 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, enum obd_cleanup_stage cleanup_stage); int (*o_cleanup)(struct obd_device *dev); 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); /* connect to the target device with given connection * data. @ocd->ocd_connect_flags is modified to reflect flags actually * granted by the target, which are guaranteed to be a subset of flags * asked for. If @ocd == NULL, use default parameters. */ int (*o_connect)(struct lustre_handle *conn, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *ocd, void *localdata); int (*o_reconnect)(struct obd_export *exp, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *ocd); int (*o_disconnect)(struct obd_export *exp); int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs, __u64 max_age, __u32 flags); int (*o_statfs_async)(struct obd_device *obd, struct obd_info *oinfo, __u64 max_age, struct ptlrpc_request_set *set); 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_checkmd)(struct obd_export *exp, struct obd_export *md_exp, struct lov_stripe_md *mem_tgt); int (*o_preallocate)(struct lustre_handle *, obd_count *req, obd_id *ids); int (*o_precreate)(struct obd_export *exp); int (*o_create)(struct obd_export *exp, struct obdo *oa, 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, struct obd_export *md_exp); int (*o_setattr)(struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti); int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset); int (*o_getattr)(struct obd_export *exp, struct obd_info *oinfo); int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo, struct ptlrpc_request_set *set); int (*o_brw)(int rw, struct obd_export *exp, struct obd_info *oinfo, obd_count oa_bufs, struct brw_page *pgarr, struct obd_trans_info *oti); int (*o_brw_async)(int rw, struct obd_export *exp, struct obd_info *oinfo, obd_count oa_bufs, struct brw_page *pgarr, struct obd_trans_info *oti, struct ptlrpc_request_set *); int (*o_prep_async_page)(struct obd_export *exp, struct lov_stripe_md *lsm, struct lov_oinfo *loi, cfs_page_t *page, obd_off offset, struct obd_async_page_ops *ops, void *data, void **res, int nocache, struct lustre_handle *lockh); 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_flag brw_flags, obd_flag 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_flag brw_flags, obd_flag 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_flag async_flags); int (*o_teardown_async_page)(struct obd_export *exp, struct lov_stripe_md *lsm, struct lov_oinfo *loi, void *cookie); int (*o_merge_lvb)(struct obd_export *exp, struct lov_stripe_md *lsm, struct ost_lvb *lvb, int kms_only); 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 obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset); 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); 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_enqueue)(struct obd_export *, struct obd_info *oinfo, struct ldlm_enqueue_info *einfo, struct ptlrpc_request_set *rqset); 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_join_lru)(struct obd_export *, struct lov_stripe_md *, int join); int (*o_init_export)(struct obd_export *exp); int (*o_destroy_export)(struct obd_export *exp); int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *, int cmd, obd_off *); /* llog related obd_methods */ int (*o_llog_init)(struct obd_device *obd, struct obd_device *disk_obd, int count, struct llog_catid *logid, struct obd_uuid *uuid); int (*o_llog_finish)(struct obd_device *obd, int count); /* metadata-only methods */ int (*o_pin)(struct obd_export *, obd_id ino, __u32 gen, int type, struct obd_client_handle *, int flag); int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int); int (*o_import_event)(struct obd_device *, struct obd_import *, enum obd_import_event); int (*o_notify)(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev, void *data); int (*o_health_check)(struct obd_device *); /* quota methods */ int (*o_quotacheck)(struct obd_export *, struct obd_quotactl *); int (*o_quotactl)(struct obd_export *, struct obd_quotactl *); int (*o_quota_adjust_qunit)(struct obd_export *exp, struct quota_adjust_qunit *oqaq); int (*o_ping)(struct obd_export *exp); int (*o_register_page_removal_cb)(struct obd_export *exp, obd_page_removal_cb_t cb, obd_pin_extent_cb pin_cb); int (*o_unregister_page_removal_cb)(struct obd_export *exp, obd_page_removal_cb_t cb); int (*o_register_lock_cancel_cb)(struct obd_export *exp, obd_lock_cancel_cb cb); int (*o_unregister_lock_cancel_cb)(struct obd_export *exp, obd_lock_cancel_cb cb); /* * NOTE: If adding ops, add another LPROCFS_OBD_OP_INIT() line * to lprocfs_alloc_obd_stats() in obdclass/lprocfs_status.c. * Also, add a wrapper function in include/linux/obd_class.h. */};struct lsm_operations { void (*lsm_free)(struct lov_stripe_md *); int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa, struct obd_export *md_exp); void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *, unsigned long *); void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *, unsigned long *); obd_off (*lsm_stripe_offset_by_index)(struct lov_stripe_md *, int); obd_off (*lsm_stripe_offset_by_offset)(struct lov_stripe_md *, obd_off); int (*lsm_stripe_index_by_offset)(struct lov_stripe_md *, obd_off); int (*lsm_revalidate) (struct lov_stripe_md *, struct obd_device *obd); int (*lsm_lmm_verify) (struct lov_mds_md *lmm, int lmm_bytes, int *stripe_count); int (*lsm_unpackmd) (struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm);};extern struct lsm_operations lsm_plain_ops;extern struct lsm_operations lsm_join_ops;static inline struct lsm_operations *lsm_op_find(int magic){ switch(magic) { case LOV_MAGIC: return &lsm_plain_ops; case LOV_MAGIC_JOIN: return &lsm_join_ops; default: CERROR("Cannot recognize lsm_magic %d", magic); return NULL; }}int lvfs_check_io_health(struct obd_device *obd, struct file *file);/* Requests for obd_extent_calc() */#define OBD_CALC_STRIPE_START 1#define OBD_CALC_STRIPE_END 2static inline void obd_transno_commit_cb(struct obd_device *obd, __u64 transno, int error){ if (error) { CERROR("%s: transno "LPD64" commit error: %d\n", obd->obd_name, transno, error); return; } CDEBUG(D_HA, "%s: transno "LPD64" committed\n", obd->obd_name, transno); if (transno > obd->obd_last_committed) { obd->obd_last_committed = transno; ptlrpc_commit_replies (obd); }}static inline void init_obd_quota_ops(quota_interface_t *interface, struct obd_ops *obd_ops){ if (!interface) return; LASSERT(obd_ops); obd_ops->o_quotacheck = QUOTA_OP(interface, check); obd_ops->o_quotactl = QUOTA_OP(interface, ctl); obd_ops->o_quota_adjust_qunit = QUOTA_OP(interface, adjust_qunit);}/* * Checksums */#ifdef HAVE_ADLER/* Default preferred checksum algorithm to use (if supported by the server) */#define OSC_DEFAULT_CKSUM OBD_CKSUM_ADLER/* Adler-32 is supported */#define CHECKSUM_ADLER OBD_CKSUM_ADLER#else#define OSC_DEFAULT_CKSUM OBD_CKSUM_CRC32#define CHECKSUM_ADLER 0#endif#define OBD_CKSUM_ALL (OBD_CKSUM_CRC32 | CHECKSUM_ADLER)/* Checksum algorithm names. Must be defined in the same order as the * OBD_CKSUM_* flags. */#define DECLARE_CKSUM_NAME char *cksum_name[] = {"crc32", "adler"}#endif /* __OBD_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -