FreeBSD/sys/cam/cam_iosched.c
/*
 * After we're sure we're attaching a device, go ahead and add
 * hooks for any sysctl we may wish to honor.
 */
After we're sure we're attaching a device, go ahead and add
hooks for any sysctl we may wish to honor.
After we ' re sure we ' re attaching a device go ahead and add hooks for any sysctl we may wish to honor .
void cam_iosched_sysctl_init(struct cam_iosched_softc *isc,
    struct sysctl_ctx_list *ctx, struct sysctl_oid *node)
{
#ifdef CAM_IOSCHED_DYNAMIC
	struct sysctl_oid_list *n;
#endif
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(node),
		OID_AUTO, "sort_io_queue", CTLFLAG_RW | CTLFLAG_MPSAFE,
		&isc->sort_io_queue, 0,
		"Sort IO queue to try and optimise disk access patterns");
#ifdef CAM_IOSCHED_DYNAMIC
	if (!do_dynamic_iosched)
		return;
	isc->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx,
	    SYSCTL_CHILDREN(node), OID_AUTO, "iosched",
	    CTLFLAG_RD, 0, "I/O scheduler statistics");
	n = SYSCTL_CHILDREN(isc->sysctl_tree);
	ctx = &isc->sysctl_ctx;
	cam_iosched_iop_stats_sysctl_init(isc, &isc->read_stats, "read");
	cam_iosched_iop_stats_sysctl_init(isc, &isc->write_stats, "write");
	cam_iosched_iop_stats_sysctl_init(isc, &isc->trim_stats, "trim");
	cam_iosched_cl_sysctl_init(isc);
	SYSCTL_ADD_INT(ctx, n,
	    OID_AUTO, "read_bias", CTLFLAG_RW,
	    &isc->read_bias, 100,
	    "How biased towards read should we be independent of limits");
	SYSCTL_ADD_INT(ctx, n,
	    OID_AUTO, "quanta", CTLFLAG_RW,
	    &isc->quanta, 200,
	    "How many quanta per second do we slice the I/O up into");
	SYSCTL_ADD_INT(ctx, n,
	    OID_AUTO, "total_ticks", CTLFLAG_RD,
	    &isc->total_ticks, 0,
	    "Total number of ticks we've done");
#endif
}
void cam_iosched_sysctl_init ( struct cam_iosched_softc * isc , struct sysctl_ctx_list * ctx , struct sysctl_oid * node ) { #ifdef CAM_IOSCHED_DYNAMIC struct sysctl_oid_list * n ; #endif SYSCTL_ADD_INT ( ctx , SYSCTL_CHILDREN ( node ) , OID_AUTO , " " , CTLFLAG_RW | CTLFLAG_MPSAFE , & isc -> sort_io_queue , 0 , " " ) ; #ifdef CAM_IOSCHED_DYNAMIC if ( ! do_dynamic_iosched ) return ; isc -> sysctl_tree = SYSCTL_ADD_NODE ( & isc -> sysctl_ctx , SYSCTL_CHILDREN ( node ) , OID_AUTO , " " , CTLFLAG_RD , 0 , " " ) ; n = SYSCTL_CHILDREN ( isc -> sysctl_tree ) ; ctx = & isc -> sysctl_ctx ; cam_iosched_iop_stats_sysctl_init ( isc , & isc -> read_stats , " " ) ; cam_iosched_iop_stats_sysctl_init ( isc , & isc -> write_stats , " " ) ; cam_iosched_iop_stats_sysctl_init ( isc , & isc -> trim_stats , " " ) ; cam_iosched_cl_sysctl_init ( isc ) ; SYSCTL_ADD_INT ( ctx , n , OID_AUTO , " " , CTLFLAG_RW , & isc -> read_bias , 100 , " " ) ; SYSCTL_ADD_INT ( ctx , n , OID_AUTO , " " , CTLFLAG_RW , & isc -> quanta , 200 , " " ) ; SYSCTL_ADD_INT ( ctx , n , OID_AUTO , " " , CTLFLAG_RD , & isc -> total_ticks , 0 , " " ) ; #endif }
After we're sure we're attaching a device, go ahead and add
 hooks for any sysctl we may wish to honor.
After we ' re sure we ' re attaching a device go ahead and add hooks for any sysctl we may wish to honor .