Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / disksort.9f
blobb6943f5009f51175a486567efa5b67e5c0d99f2d
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH DISKSORT 9F "Jan 16, 2006"
7 .SH NAME
8 disksort \- single direction elevator seek sort for buffers
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/conf.h>
13 #include <sys/ddi.h>
14 #include <sys/sunddi.h>
15 void
17 \fB\fR\fBdisksort\fR(\fBstruct diskhd\fR \fI*dp\fR, \fBstruct buf\fR \fI*bp\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Solaris DDI specific (Solaris DDI).
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fIdp\fR\fR
29 .ad
30 .RS 6n
31 A pointer to a \fBdiskhd\fR structure. A \fBdiskhd\fR structure is essentially
32 identical to head of a buffer structure (see \fBbuf\fR(9S)). The only defined
33 items of interest for this structure are the \fBav_forw\fR and \fBav_back\fR
34 structure elements which are used to maintain the front and tail pointers of
35 the forward linked \fBI/O\fR request queue.
36 .RE
38 .sp
39 .ne 2
40 .na
41 \fB\fIbp\fR\fR
42 .ad
43 .RS 6n
44 A pointer to a buffer structure. Typically this is the \fBI/O\fR request that
45 the driver receives in its strategy routine (see \fBstrategy\fR(9E)). The
46 driver is responsible for initializing the \fBb_resid\fR structure element to a
47 meaningful sort key value prior to calling \fBdisksort()\fR.
48 .RE
50 .SH DESCRIPTION
51 .sp
52 .LP
53 The function \fBdisksort()\fR sorts a pointer to a buffer into a single forward
54 linked list headed by the \fBav_forw\fR element of the argument \fI*dp\fR.
55 .sp
56 .LP
57 It uses a one-way elevator algorithm that sorts buffers into the queue in
58 ascending order based upon a key value held in the argument buffer structure
59 element \fBb_resid\fR.
60 .sp
61 .LP
62 This value can either be the driver calculated cylinder number for the
63 \fBI/O\fR request described by the buffer argument, or simply the absolute
64 logical block for the \fBI/O\fR request, depending on how fine grained the sort
65 is desired to be or how applicable either quantity is to the device in
66 question.
67 .sp
68 .LP
69 The head of the linked list is found by use of the \fBav_forw\fR structure
70 element of the argument \fI*dp\fR. The tail of the linked list is found by use
71 of the \fBav_back\fR structure element of the argument \fI*dp\fR. The
72 \fBav_forw\fR element of the \fI*bp\fR argument is used by \fBdisksort()\fR to
73 maintain the forward linkage. The value at the head of the list presumably
74 indicates the currently active disk area.
75 .SH CONTEXT
76 .sp
77 .LP
78 This function can be called from user, interrupt, or kernel context.
79 .SH SEE ALSO
80 .sp
81 .LP
82 \fBstrategy\fR(9E), \fBbuf\fR(9S)
83 .sp
84 .LP
85 \fIWriting Device Drivers\fR
86 .SH WARNINGS
87 .sp
88 .LP
89 The \fBdisksort()\fR function does no locking. Therefore, any locking is
90 completely the responsibility of the caller.