📄 obd.h
字号:
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: */#ifndef __OBD_H#define __OBD_H#if defined(__linux__)#include <linux/obd.h>#elif defined(__APPLE__)#include <darwin/obd.h>#elif defined(__WINNT__)#include <winnt/obd.h>#else#error Unsupported operating system.#endif#define IOC_OSC_TYPE 'h'#define IOC_OSC_MIN_NR 20#define IOC_OSC_SET_ACTIVE _IOWR(IOC_OSC_TYPE, 21, struct obd_device *)#define IOC_OSC_MAX_NR 50#define IOC_MDC_TYPE 'i'#define IOC_MDC_MIN_NR 20/* Moved to lustre_user.h#define IOC_MDC_LOOKUP _IOWR(IOC_MDC_TYPE, 20, struct obd_ioctl_data *)#define IOC_MDC_GETSTRIPE _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *) */#define IOC_MDC_MAX_NR 50#include <lustre_lib.h>#include <lustre/lustre_idl.h>#include <lustre_export.h>#include <lustre_quota.h>#include <class_hash.h>#include <libcfs/bitmap.h>#define MAX_OBD_DEVICES 8192/* this is really local to the OSC */struct loi_oap_pages { struct list_head lop_pending; struct list_head lop_urgent; struct list_head lop_pending_group; int lop_num_pending;};struct osc_async_rc { int ar_rc; int ar_force_sync; __u64 ar_min_xid;};struct lov_oinfo { /* per-stripe data structure */ __u64 loi_id; /* object ID on the target OST */ __u64 loi_gr; /* object group on the target OST */ int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */ int loi_ost_gen; /* generation of this loi_ost_idx */ /* used by the osc to keep track of what objects to build into rpcs */ struct loi_oap_pages loi_read_lop; struct loi_oap_pages loi_write_lop; /* _cli_ is poorly named, it should be _ready_ */ struct list_head loi_cli_item; struct list_head loi_write_item; struct list_head loi_read_item; unsigned long loi_kms_valid:1; __u64 loi_kms; /* known minimum size */ struct ost_lvb loi_lvb; struct osc_async_rc loi_ar;};static inline void loi_init(struct lov_oinfo *loi){ CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending); CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_urgent); CFS_INIT_LIST_HEAD(&loi->loi_read_lop.lop_pending_group); CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending); CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_urgent); CFS_INIT_LIST_HEAD(&loi->loi_write_lop.lop_pending_group); CFS_INIT_LIST_HEAD(&loi->loi_cli_item); CFS_INIT_LIST_HEAD(&loi->loi_write_item); CFS_INIT_LIST_HEAD(&loi->loi_read_item);}/*extent array item for describing the joined file extent info*/struct lov_extent { __u64 le_start; /* extent start */ __u64 le_len; /* extent length */ int le_loi_idx; /* extent #1 loi's index in lsm loi array */ int le_stripe_count; /* extent stripe count*/};/*Lov array info for describing joined file array EA info*/struct lov_array_info { struct llog_logid lai_array_id; /* MDS med llog object id */ unsigned lai_ext_count; /* number of extent count */ struct lov_extent *lai_ext_array; /* extent desc array */};struct lov_stripe_md { spinlock_t lsm_lock; void *lsm_lock_owner; /* debugging */ struct { /* Public members. */ __u64 lw_object_id; /* lov object id */ __u64 lw_object_gr; /* lov object group */ __u64 lw_maxbytes; /* maximum possible file size */ /* LOV-private members start here -- only for use in lov/. */ __u32 lw_magic; __u32 lw_stripe_size; /* size of the stripe */ __u32 lw_pattern; /* striping pattern (RAID0, RAID1) */ unsigned lw_stripe_count; /* number of objects being striped over */ } lsm_wire; struct lov_array_info *lsm_array; /*Only for joined file array info*/ struct lov_oinfo *lsm_oinfo[0];};#define lsm_object_id lsm_wire.lw_object_id#define lsm_object_gr lsm_wire.lw_object_gr#define lsm_maxbytes lsm_wire.lw_maxbytes#define lsm_magic lsm_wire.lw_magic#define lsm_stripe_size lsm_wire.lw_stripe_size#define lsm_pattern lsm_wire.lw_pattern#define lsm_stripe_count lsm_wire.lw_stripe_countstruct obd_info;typedef int (*obd_enqueue_update_f)(struct obd_info *oinfo, int rc);/* obd info for a particular level (lov, osc). */struct obd_info { /* Lock policy. It keeps an extent which is specific for a particular * OSC. (e.g. lov_prep_enqueue_set initialises extent of the policy, * and osc_enqueue passes it into ldlm_lock_match & ldlm_cli_enqueue. */ ldlm_policy_data_t oi_policy; /* Flags used for set request specific flags: - while lock handling, the flags obtained on the enqueue request are set here. - while stats, the flags used for control delay/resend. */ int oi_flags; /* Lock handle specific for every OSC lock. */ struct lustre_handle *oi_lockh; /* lsm data specific for every OSC. */ struct lov_stripe_md *oi_md; /* obdo data specific for every OSC, if needed at all. */ struct obdo *oi_oa; /* statfs data specific for every OSC, if needed at all. */ struct obd_statfs *oi_osfs; /* An update callback which is called to update some data on upper * level. E.g. it is used for update lsm->lsm_oinfo at every recieved * request in osc level for enqueue requests. It is also possible to * update some caller data from LOV layer if needed. */ obd_enqueue_update_f oi_cb_up;};/* compare all relevant fields. */static inline int lov_stripe_md_cmp(struct lov_stripe_md *m1, struct lov_stripe_md *m2){ /* * ->lsm_wire contains padding, but it should be zeroed out during * allocation. */ return memcmp(&m1->lsm_wire, &m2->lsm_wire, sizeof m1->lsm_wire);}void lov_stripe_lock(struct lov_stripe_md *md);void lov_stripe_unlock(struct lov_stripe_md *md);struct obd_type { struct list_head typ_chain; struct obd_ops *typ_ops; cfs_proc_dir_entry_t *typ_procroot; char *typ_name; int typ_refcnt; spinlock_t obd_type_lock;};struct brw_page { obd_off off; cfs_page_t *pg; int count; obd_flag flag;};enum async_flags { ASYNC_READY = 0x1, /* ap_make_ready will not be called before this page is added to an rpc */ ASYNC_URGENT = 0x2, /* page must be put into an RPC before return */ ASYNC_COUNT_STABLE = 0x4, /* ap_refresh_count will not be called to give the caller a chance to update or cancel the size of the io */ ASYNC_GROUP_SYNC = 0x8, /* ap_completion will not be called, instead the page is accounted for in the obd_io_group given to obd_queue_group_io */};struct obd_async_page_ops { int (*ap_make_ready)(void *data, int cmd); int (*ap_refresh_count)(void *data, int cmd); void (*ap_fill_obdo)(void *data, int cmd, struct obdo *oa); void (*ap_update_obdo)(void *data, int cmd, struct obdo *oa, obd_valid valid); int (*ap_completion)(void *data, int cmd, struct obdo *oa, int rc);};/* the `oig' is passed down from a caller of obd rw methods. the callee * records enough state such that the caller can sleep on the oig and * be woken when all the callees have finished their work */struct obd_io_group { spinlock_t oig_lock; atomic_t oig_refcount; int oig_pending; int oig_rc; struct list_head oig_occ_list; cfs_waitq_t oig_waitq;};/* the oig callback context lets the callee of obd rw methods register * for callbacks from the caller. */struct oig_callback_context { struct list_head occ_oig_item; /* called when the caller has received a signal while sleeping. * callees of this method are encouraged to abort their state * in the oig. This may be called multiple times. */ void (*occ_interrupted)(struct oig_callback_context *occ); unsigned long interrupted:1;};/* Individual type definitions */struct ost_server_data;/* hold common fields for "target" device */struct obd_device_target { struct super_block *obt_sb; atomic_t obt_quotachecking; struct lustre_quota_ctxt obt_qctxt;};typedef void (*obd_pin_extent_cb)(void *data);typedef int (*obd_page_removal_cb_t)(void *data, int discard);typedef int (*obd_lock_cancel_cb)(struct ldlm_lock *,struct ldlm_lock_desc *, void *, int);#define FILTER_GROUP_LLOG 1#define FILTER_GROUP_ECHO 2struct filter_ext { __u64 fe_start; __u64 fe_end;};struct filter_obd { /* NB this field MUST be first */ struct obd_device_target fo_obt; const char *fo_fstype; struct vfsmount *fo_vfsmnt; cfs_dentry_t *fo_dentry_O; cfs_dentry_t **fo_dentry_O_groups; cfs_dentry_t **fo_dentry_O_sub; spinlock_t fo_objidlock; /* protect fo_lastobjid */ spinlock_t fo_translock; /* protect fsd_last_transno */ struct file *fo_rcvd_filp; struct file *fo_health_check_filp; struct lr_server_data *fo_fsd; unsigned long *fo_last_rcvd_slots; __u64 fo_mount_count; int fo_destroy_in_progress; struct semaphore fo_create_lock; struct list_head fo_export_list; int fo_subdir_count; obd_size fo_tot_dirty; /* protected by obd_osfs_lock */ obd_size fo_tot_granted; /* all values in bytes */ obd_size fo_tot_pending; obd_size fo_readcache_max_filesize; struct obd_import *fo_mdc_imp; struct obd_uuid fo_mdc_uuid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -