1disksort(9F)             Kernel Functions for Drivers             disksort(9F)
2
3
4

NAME

6       disksort - single direction elevator seek sort for buffers
7

SYNOPSIS

9       #include <sys/conf.h>
10       #include <sys/ddi.h>
11       #include <sys/sunddi.h>
12       void
13
14       disksort(struct diskhd *dp, struct buf *bp);
15
16

INTERFACE LEVEL

18       Solaris DDI specific (Solaris DDI).
19

PARAMETERS

21       dp    A  pointer  to  a  diskhd structure. A diskhd structure is essen‐
22             tially identical to head of a buffer structure (see buf(9S)). The
23             only defined items of interest for this structure are the av_forw
24             and av_back structure elements which are  used  to  maintain  the
25             front and tail pointers of the forward linked I/O request queue.
26
27
28       bp    A  pointer  to  a  buffer  structure.  Typically  this is the I/O
29             request that the driver receives in  its  strategy  routine  (see
30             strategy(9E)).  The  driver  is  responsible for initializing the
31             b_resid structure element to a meaningful sort key value prior to
32             calling disksort().
33
34

DESCRIPTION

36       The  function disksort() sorts a pointer to a buffer into a single for‐
37       ward linked list headed by the av_forw element of the argument *dp.
38
39
40       It uses a one-way elevator algorithm that sorts buffers into the  queue
41       in  ascending  order based upon a key value held in the argument buffer
42       structure element b_resid.
43
44
45       This value can either be the driver calculated cylinder number for  the
46       I/O  request  described  by the buffer argument, or simply the absolute
47       logical block for the I/O request, depending on how  fine  grained  the
48       sort  is  desired  to  be  or  how applicable either quantity is to the
49       device in question.
50
51
52       The head of the linked list is found by use of  the  av_forw  structure
53       element  of  the  argument *dp. The tail of the linked list is found by
54       use of the av_back structure element of the argument *dp.  The  av_forw
55       element  of the *bp argument is used by disksort() to maintain the for‐
56       ward linkage. The value at the head of the  list  presumably  indicates
57       the currently active disk area.
58

CONTEXT

60       This function can be called from user, interrupt, or kernel context.
61

SEE ALSO

63       strategy(9E), buf(9S)
64
65
66       Writing Device Drivers
67

WARNINGS

69       The disksort() function does no locking. Therefore, any locking is com‐
70       pletely the responsibility of the caller.
71
72
73
74SunOS 5.11                        16 Jan 2006                     disksort(9F)
Impressum