📄 grio.h
字号:
*/#define GRIO_ADD_DISK_INFO 21#define GRIO_UPDATE_DISK_INFO 22#define GRIO_ADD_STREAM_INFO 23#define GRIO_ADD_STREAM_DISK_INFO 24#define GRIO_ASSOCIATE_FILE_WITH_STREAM 25#define GRIO_REMOVE_STREAM_INFO 26#define GRIO_REMOVE_ALL_STREAMS_INFO 27#define GRIO_GET_FILE_EXTENTS 28#define GRIO_GET_FS_BLOCK_SIZE 29#define GRIO_GET_FILE_RT 30#define GRIO_WRITE_GRIO_REQ 31#define GRIO_READ_GRIO_REQ 32#define GRIO_WRITE_GRIO_RESP 33#define GRIO_GET_STREAM_ID 34#define GRIO_GET_ALL_STREAMS 35#define GRIO_GET_VOD_DISK_INFO 36#define GRIO_MONITOR_START 37#define GRIO_MONITOR_GET 38#define GRIO_MONITOR_END 39#define GRIO_READ_NUM_CMDS 40#define GRIO_GET_HWGRAPH_PATH 41#define GRIO_GET_MLD_CNODE 42#define GRIO_GET_FP 43#define GRIO_DISSOCIATE_STREAM 44#define COPY_STREAM_ID(from, to) ( bcopy(&(from),&(to), sizeof(uuid_t)) )#define EQUAL_STREAM_ID(one, two) ( uuid_equal( &one, &two, &status) )#define SET_GRIO_IOPRI(bp, iopri) BUF_GRIO_PRIVATE(bp)->grio_iopri = iopri#define GET_GRIO_IOPRI(bp, iopri) iopri = BUF_GRIO_PRIVATE(bp)->grio_iopritypedef struct grio_add_disk_info_struct { dev_t gdev; int num_iops_rsv; int num_iops_max; int opt_io_size; int rotation_slot; int realtime_disk;} grio_add_disk_info_struct_t;typedef struct grio_stream_stat { stream_id_t stream_id; gr_ino_t ino; dev_t fs_dev; pid_t procid;} grio_stream_stat_t;typedef struct grio_vod_info { int num_rotor_slots; int rotor_position; int num_rotor_streams; int num_nonrotor_streams; int rotor_slot[MAX_ROTOR_SLOTS];} grio_vod_info_t;#ifdef __KERNEL__/* * Kernel buffer scheduling structure. *//* * grio disk information * the kernel allocates and maintains one such structure for * each disk used by the grio subsystem */typedef struct grio_disk_info { int num_iops_max; int num_iops_rsv; int opt_io_size; int active; lock_t lock; struct grio_stream_disk_info *diskstreams; int ops_issued; int ops_complete; int subops_issued; int subops_complete; int rotate_position; int realtime_disk; time_t time_start; int opcount; time_t reset_time; time_t timeout_time; toid_t timeout_id; dev_t diskdev;} grio_disk_info_t;/* * grio disk information used by grioidbg for global op */typedef struct grio_idbg_disk_info { grio_disk_info_t *griodp_ptr; struct grio_idbg_disk_info *next;} grio_idbg_disk_info_t;#define GRIO_STREAM_TABLE_SIZE 50#define GRIO_STREAM_TABLE_INDEX( id ) ( (id / 8) % GRIO_STREAM_TABLE_SIZE )/* * grio stream information * the kernel allocates and maintains one such structure for * each active grio stream */typedef struct grio_stream_info { struct grio_stream_info *nextstream; struct grio_stream_disk_info *diskstreams; lock_t lock; stream_id_t stream_id; __uint64_t fp; pid_t procid; gr_ino_t ino; dev_t fs_dev; int flags; int total_slots; int max_count_per_slot; int rotate_slot; time_t last_stream_op;} grio_stream_info_t;/* * Macros to access the per stream flags. */#define MARK_STREAM_AS_BEING_REMOVED(griosp) \ (griosp->flags |= STREAM_REMOVE_IN_PROGRESS)#define MARK_STREAM_AS_INITIATING_IO(griosp) \ (griosp->flags |= STREAM_INITIATE_IN_PROGRESS)#define CLEAR_STREAM_AS_INITIATING_IO(griosp) \ (griosp->flags &= ~STREAM_INITIATE_IN_PROGRESS)#define STREAM_BEING_REMOVED(griosp) \ (griosp->flags & STREAM_REMOVE_IN_PROGRESS)#define STREAM_INITIATE_IO(griosp) \ (griosp->flags & STREAM_INITIATE_IN_PROGRESS)#define PER_FILE_SYS_STREAM(griosp) \ (griosp->flags & PER_FILE_SYS_GUAR)#define PER_FILE_STREAM(griosp) \ (griosp->flags & PER_FILE_GUAR)#define FIXED_ROTOR_STREAM( griosp ) \ (griosp->flags & FIXED_ROTOR_GUAR)#define SLIP_ROTOR_STREAM( griosp ) \ (griosp->flags & SLIP_ROTOR_GUAR)#define ROTOR_STREAM(griosp) \ (FIXED_ROTOR_STREAM( griosp) || SLIP_ROTOR_STREAM(griosp))#define NON_ROTOR_STREAM(griosp) \ (griosp->flags & NON_ROTOR_GUAR)#define RT_SCHED_STREAM(griosp) \ (griosp->flags & REALTIME_SCHED_GUAR)#define NS_SCHED_STREAM(griosp) \ (griosp->flags & NON_SCHED_GUAR)#define SLIPPED_ONCE_STREAM(griosp) \ (griosp->flags & STREAM_SLIPPED_ONCE)#define MARK_SLIPPED_ONCE_STREAM(griosp) \ (griosp->flags |= STREAM_SLIPPED_ONCE)#define CLEAR_SLIPPED_ONCE_STREAM(griosp) \ (griosp->flags &= ~STREAM_SLIPPED_ONCE)#define MARK_STREAM_AS_ASSOCIATED(griosp) \ (griosp->flags |= STREAM_ASSOCIATED)#define MARK_STREAM_AS_DISSOCIATED(griosp) \ (griosp->flags &= ~STREAM_ASSOCIATED)#define STREAM_IS_ASSOCIATED(griosp) \ (griosp->flags & STREAM_ASSOCIATED)/* * per disk stream information * the kernel allocates and maintaines one such structure for * each (stream id, disk used by that stream) pair. */typedef struct grio_stream_disk_info { struct grio_stream_disk_info *nextdiskinstream; grio_stream_info_t *thisstream; struct grio_stream_disk_info *nextstream; grio_disk_info_t *griodp; lock_t lock; /* lock to protect structure */ time_t period_end; /* time current period will end */ time_t iops_time; /* length of period for this stream */ xfs_buf_t *realbp; /* orignal bp from xlv for this request */ xfs_buf_t *bp_list; /* list of sub bps for this request */ xfs_buf_t *issued_bp_list; /* list of issued sub bps for this request */ xfs_buf_t *queuedbps_front; /* ptrs to queue of bps using this */ xfs_buf_t *queuedbps_back; /* stream id */ int iops_remaining_this_period; /* num grios left for this req this prd */ time_t time_priority_start; time_t last_op_time; /* time last out of band op */ int num_iops; /* num grios for this req this period */ int opt_io_size; /* size of grio request */} grio_stream_disk_info_t;/* This structure defines a linked list of rate guaranteed requests which * have been issued by clients but not yet satisfied by the daemon. */typedef struct grio_cmd_queue { sema_t sema; int num_cmds; grio_cmd_t *griocmd; struct grio_cmd_queue *forw; struct grio_cmd_queue *back;} grio_cmd_queue_t;#define GRIO_NONGUARANTEED_STREAM(griosp) \ ( EQUAL_STREAM_ID( griosp->stream_id, non_guaranteed_id ) )/* * Private data attached to the buffer structures. * This structure may NOT contain any data unique specific to a * per disk I/O request. It is common to all the bps generated from * a single user I/O request. */typedef struct grio_buf_data { uuid_t grio_id; /* stream id of stream associated */ short grio_iopri; /* priority of the io, b_iopri */#ifdef GRIO_DEBUG /* with this I/O request */ time_t start_time; time_t enter_queue_time;#endif} grio_buf_data_t;#ifdef GRIO_DEBUG#define INIT_GRIO_TIMESTAMP( bp ) { \ if ( BUF_IS_GRIO( bp ) ) { \ BUF_GRIO_PRIVATE(bp)->start_time = lbolt; \ } \} #define CHECK_GRIO_TIMESTAMP( bp, maxtime ) { \ if ( BUF_IS_GRIO( bp ) ) { \ if ((lbolt - BUF_GRIO_PRIVATE(bp)->start_time) > maxtime) {\ printf("GRIO TIMESTAMP %d TICKS: file %s, line %d\n", \ lbolt - BUF_GRIO_PRIVATE(bp)->start_time,\ __FILE__,__LINE__); \ } \ } \}#else#define INIT_GRIO_TIMESTAMP( bp )#define CHECK_GRIO_TIMESTAMP( bp, maxtime )#endif#define BUF_GRIO_PRIVATE(bp) ((grio_buf_data_t *)((bp)->b_grio_private))/* * Global lock and unlock macros */#define GRIO_GLOB_LOCK() mutex_spinlock(&grio_global_lock)#define GRIO_GLOB_UNLOCK(s) mutex_spinunlock(&grio_global_lock, s)#define GRIO_STABLE_LOCK() mutex_spinlock(&grio_stream_table_lock)#define GRIO_STABLE_UNLOCK(s) \ mutex_spinunlock(&grio_stream_table_lock, s)#define GRIO_DISK_LOCK(griodp) mutex_spinlock(&griodp->lock)#define GRIO_DISK_UNLOCK(griodp,s) mutex_spinunlock(&griodp->lock, s)#define GRIO_STREAM_LOCK(griosp) mutex_spinlock(&griosp->lock)#define GRIO_STREAM_UNLOCK(griosp,s) mutex_spinunlock(&griosp->lock, s)#define GRIO_STREAM_DISK_LOCK(griosdp) mutex_spinlock(&griosdp->lock)#define GRIO_STREAM_DISK_UNLOCK(griosdp,s) mutex_spinunlock(&griosdp->lock,s)/* Function to convert the device number to an pointer to * structure containing grio_info */grio_disk_info_t *grio_disk_info(dev_t gdev);/* * Macros to set or clear the bits in the b_flags field of the buf structure. */#define BUF_IS_GRIO( bp ) (XFS_BUF_BFLAGS(bp) & B_GR_BUF)#define BUF_IS_GRIO_ISSUED( bp ) (XFS_BUF_BFLAGS(bp) & B_GR_ISD)#define CLR_BUF_GRIO_ISSUED(bp) (XFS_BUF_BFLAGS(bp) &= ~B_GR_ISD)#define MARK_BUF_GRIO_ISSUED(bp) (XFS_BUF_BFLAGS(bp) |= B_GR_ISD)#ifdef DEBUG#define dbg1printf(_x) if (grio_dbg_level > 1 ) { printf _x ; }#define dbg2printf(_x) if (grio_dbg_level > 2 ) { printf _x ; }#define dbg3printf(_x) if (grio_dbg_level > 3 ) { printf _x ; }#else#define dbg1printf(_x)#define dbg2printf(_x)#define dbg3printf(_x)#endif#endif /* __KERNEL__ */#define GRIO_MONITOR_COUNT 100typedef struct grio_monitor_times { time_t starttime; time_t endtime; __int64_t size;} grio_monitor_times_t;typedef struct grio_monitor { grio_monitor_times_t times[GRIO_MONITOR_COUNT]; int start_index; int end_index; stream_id_t stream_id; int monitoring;} grio_monitor_t;/* * syssgi GRIO_GET_HWGRAPH_PATH returns an array of these structures. * The class and type are akin to inventory records. For hardware * components which do not have actual inventory records associated * with the hwgfs vertices, grio determines the class, type and state * fields. This structure can be extended to return unit/controller etc. */typedef struct grio_dev_info { int grio_dev_class; int grio_dev_type; int grio_dev_state; dev_t devnum;} grio_dev_info_t;typedef struct grio_ioctl_info { vertex_hdl_t prev_vhdl; vertex_hdl_t next_vhdl; unsigned long long reqbw;} grio_ioctl_info_t;#endif /* _LINUX_GRIO_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -