Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

disksort(9f) [opensolaris man page]

disksort(9F)						   Kernel Functions for Drivers 					      disksort(9F)

NAME
disksort - single direction elevator seek sort for buffers SYNOPSIS
#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h> void disksort(struct diskhd *dp, struct buf *bp); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
dp A pointer to a diskhd structure. A diskhd structure is essentially identical to head of a buffer structure (see buf(9S)). The only defined items of interest for this structure are the av_forw and av_back structure elements which are used to maintain the front and tail pointers of the forward linked I/O request queue. bp A pointer to a buffer structure. Typically this is the I/O request that the driver receives in its strategy routine (see strat- egy(9E)). The driver is responsible for initializing the b_resid structure element to a meaningful sort key value prior to calling disksort(). DESCRIPTION
The function disksort() sorts a pointer to a buffer into a single forward linked list headed by the av_forw element of the argument *dp. It uses a one-way elevator algorithm that sorts buffers into the queue in ascending order based upon a key value held in the argument buf- fer structure element b_resid. This value can either be the driver calculated cylinder number for the I/O request described by the buffer argument, or simply the absolute logical block for the I/O request, depending on how fine grained the sort is desired to be or how applicable either quantity is to the device in question. The head of the linked list is found by use of the av_forw structure element of the argument *dp. The tail of the linked list is found by use of the av_back structure element of the argument *dp. The av_forw element of the *bp argument is used by disksort() to maintain the forward linkage. The value at the head of the list presumably indicates the currently active disk area. CONTEXT
This function can be called from user, interrupt, or kernel context. SEE ALSO
strategy(9E), buf(9S) Writing Device Drivers WARNINGS
The disksort() function does no locking. Therefore, any locking is completely the responsibility of the caller. SunOS 5.11 16 Jan 2006 disksort(9F)

Check Out this Related Man Page

kstat_queue(9F) 					   Kernel Functions for Drivers 					   kstat_queue(9F)

NAME
kstat_queue, kstat_waitq_enter, kstat_waitq_exit, kstat_runq_enter, kstat_runq_exit, kstat_waitq_to_runq, kstat_runq_back_to_waitq - update I/O kstat statistics SYNOPSIS
#include <sys/types.h> #include <sys/kstat.h> void kstat_waitq_enter(kstat_io_t *kiop); void kstat_waitq_exit(kstat_io_t *kiop); void kstat_runq_enter(kstat_io_t *kiop); void kstat_runq_exit(kstat_io_t *kiop); void kstat_waitq_to_runq(kstat_io_t *kiop); void kstat_runq_back_to_waitq(kstat_io_t *kiop); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
kiop Pointer to a kstat_io(9S) structure. DESCRIPTION
A large number of I/O subsystems have at least two basic "lists" (or queues) of transactions they manage: one for transactions that have been accepted for processing but for which processing has yet to begin, and one for transactions which are actively being processed (but not done). For this reason, two cumulative time statistics are kept: wait (pre-service) time, and run (service) time. The kstat_queue() family of functions manage these times based on the transitions between the driver wait queue and run queue. kstat_waitq_enter() kstat_waitq_enter() should be called when a request arrives and is placed into a pre-service state (such as just prior to calling disksort(9F)). kstat_waitq_exit() kstat_waitq_exit() should be used when a request is removed from its pre-service state. (such as just prior to calling the driver's start routine). kstat_runq_enter() kstat_runq_enter() is also called when a request is placed in its service state (just prior to calling the driver's start routine, but after kstat_waitq_exit()). kstat_runq_exit() kstat_runq_exit() is used when a request is removed from its service state (just prior to calling biodone(9F)). kstat_waitq_to_runq() kstat_waitq_to_runq() transitions a request from the wait queue to the run queue. This is useful wherever the driver would have nor- mally done a kstat_waitq_exit() followed by a call to kstat_runq_enter(). kstat_runq_back_to_waitq() kstat_runq_back_to_waitq() transitions a request from the run queue back to the wait queue. This may be necessary in some cases (write throttling is an example). RETURN VALUES
None. CONTEXT
kstat_create() can be called from user or kernel context. WARNINGS
These transitions must be protected by holding the kstat's ks_lock, and must be completely accurate (all transitions are recorded). Forget- ting a transition may, for example, make an idle disk appear 100% busy. SEE ALSO
biodone(9F), disksort(9F), kstat_create(9F), kstat_delete(9F), kstat_named_init(9F), kstat(9S), kstat_io(9S) Writing Device Drivers SunOS 5.10 4 Apr 1994 kstat_queue(9F)
Man Page