1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
<table class="head">
<tr>
<td class="head-ltitle">DA(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">DA(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">da</code> — <span class="Nd">SCSI Direct
Access device driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">device da</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">da</code> driver provides support for all
SCSI devices of the direct access class that are attached to the system
through a supported SCSI Host Adapter. The direct access class includes
disk, magneto-optical, and solid-state devices.</p>
<p class="Pp">A SCSI Host adapter must also be separately configured into the
system before a SCSI direct access device can be configured.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="CACHE_EFFECTS"><a class="permalink" href="#CACHE_EFFECTS">CACHE
EFFECTS</a></h1>
<p class="Pp">Many direct access devices are equipped with read and/or write
caches. Parameters affecting the device's cache are stored in mode page 8,
the caching control page. Mode pages can be examined and modified via the
<a class="Xr">camcontrol(8)</a> utility.</p>
<p class="Pp">The read cache is used to store data from device-initiated read
ahead operations as well as frequently used data. The read cache is
transparent to the user and can be enabled without any adverse effect. Most
devices with a read cache come from the factory with it enabled. The read
cache can be disabled by setting the RCD (Read Cache Disable) bit in the
caching control mode page.</p>
<p class="Pp">The write cache can greatly decrease the latency of write
operations and allows the device to reorganize writes to increase efficiency
and performance. This performance gain comes at a price. Should the device
lose power while its cache contains uncommitted write operations, these
writes will be lost. The effect of a loss of write transactions on a file
system is non-deterministic and can cause corruption. Most devices age write
transactions to limit vulnerability to a few transactions recently reported
as complete, but it is none-the-less recommended that systems with write
cache enabled devices reside on an Uninterruptible Power Supply (UPS). The
<code class="Nm">da</code> device driver ensures that the cache and media
are synchronized upon final close of the device or an unexpected shutdown
(panic) event. This ensures that it is safe to disconnect power once the
operating system has reported that it has halted. The write cache can be
enabled by setting the WCE (Write Cache Enable) bit in the caching control
mode page.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="TAGGED_QUEUING"><a class="permalink" href="#TAGGED_QUEUING">TAGGED
QUEUING</a></h1>
<p class="Pp">The <code class="Nm">da</code> device driver will take full
advantage of the SCSI feature known as tagged queueing. Tagged queueing
allows the device to process multiple transactions concurrently, often
re-ordering them to reduce the number and length of seeks. To ensure that
transactions to distant portions of the media, which may be deferred
indefinitely by servicing requests nearer the current head position, are
completed in a timely fashion, an ordered tagged transaction is sent every
15 seconds during continuous device operation.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="BAD_BLOCK_RECOVERY"><a class="permalink" href="#BAD_BLOCK_RECOVERY">BAD
BLOCK RECOVERY</a></h1>
<p class="Pp">Direct Access devices have the capability of mapping out portions
of defective media. Media recovery parameters are located in mode page 1,
the Read-Write Error Recovery mode page. The most important media remapping
features are 'Auto Write Reallocation' and 'Auto Read Reallocation' which
can be enabled via the AWRE and ARRE bits, respectively, of the Read-Write
Error Recovery page. Many devices do not ship from the factory with these
feature enabled. Mode pages can be examined and modified via the
<a class="Xr">camcontrol(8)</a> utility.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="KERNEL_CONFIGURATION"><a class="permalink" href="#KERNEL_CONFIGURATION">KERNEL
CONFIGURATION</a></h1>
<p class="Pp">It is only necessary to explicitly configure one
<code class="Nm">da</code> device; data structures are dynamically allocated
as disks are found on the SCSI bus.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYSCTL_VARIABLES"><a class="permalink" href="#SYSCTL_VARIABLES">SYSCTL
VARIABLES</a></h1>
<p class="Pp">The following variables are available as both
<a class="Xr">sysctl(8)</a> variables and <a class="Xr">loader(8)</a>
tunables:</p>
<dl class="Bl-tag">
<dt id="kern.cam.da.default_timeout"><var class="Va">kern.cam.da.default_timeout</var></dt>
<dd>This variable determines how long the <code class="Nm">da</code> driver
will wait before timing out an outstanding command. The units for this
value are seconds, and the default is currently 60 seconds.</dd>
<dt id="kern.cam.da.disable_wp_protection"><var class="Va">kern.cam.da.disable_wp_protection</var></dt>
<dd>Disable detection of write-protected disks. Default is disabled.
(detection of write-protected disks is enabled).</dd>
<dt id="kern.cam.da.enable_biospeedup"><var class="Va">kern.cam.da.enable_biospeedup</var></dt>
<dd>Enable <code class="Dv">BIO_SPEEDUP</code> processing. Default is
enabled.</dd>
<dt id="kern.cam.da.enable_uma_ccbs"><var class="Va">kern.cam.da.enable_uma_ccbs</var></dt>
<dd>Use UMA for CCBs. Default is enabled.</dd>
<dt id="kern.cam.da.poll_period"><var class="Va">kern.cam.da.poll_period</var></dt>
<dd>Media polling period in seconds. Default is 3 seconds.</dd>
<dt id="kern.cam.da.retry_count"><var class="Va">kern.cam.da.retry_count</var></dt>
<dd>This variable determines how many times the <code class="Nm">da</code>
driver will retry a READ or WRITE command. This does not affect the number
of retries used during probe time or for the <code class="Nm">da</code>
driver dump routine. This value currently defaults to 4.</dd>
<dt id="kern.cam.da.send_ordered"><var class="Va">kern.cam.da.send_ordered</var></dt>
<dd>Send Ordered Tags. On shutdown, step through all the
<code class="Nm">da</code> peripheral drivers, and if the device is still
open, sync the disk to physical media. Default is enabled.</dd>
<dt id="kern.cam.sort_io_queue"><var class="Va">kern.cam.sort_io_queue</var></dt>
<dd style="width: auto;"> </dd>
<dt id="kern.cam.da"><var class="Va">kern.cam.da</var>.<var class="Ar">X</var><var class="Va">.sort_io_queue</var></dt>
<dd>These variables determine whether request queue should be sorted trying to
optimize head seeks. Set to 1 to enable sorting, 0 to disable, -1 to leave
it as-is. The default is sorting enabled for HDDs and disabled for
SSDs.</dd>
<dt id="kern.cam.da~2"><var class="Va">kern.cam.da</var>.<var class="Ar">X</var><var class="Va">.delete_method</var></dt>
<dd>This variable specifies method to handle BIO_DELETE requests:
<dl class="Bl-tag">
<dt>ATA_TRIM</dt>
<dd>ATA TRIM via ATA COMMAND PASS THROUGH command,</dd>
<dt>UNMAP</dt>
<dd>UNMAP command,</dd>
<dt>WS16</dt>
<dd>WRITE SAME(16) command with UNMAP flag,</dd>
<dt>WS10</dt>
<dd>WRITE SAME(10) command with UNMAP flag,</dd>
<dt>ZERO</dt>
<dd>WRITE SAME(10) command without UNMAP flag,</dd>
<dt>DISABLE</dt>
<dd>disable BIO_DELETE support.</dd>
</dl>
</dd>
<dt id="kern.cam.da~3"><var class="Va">kern.cam.da</var>.<var class="Ar">X</var><var class="Va">.minimum_cmd_size</var></dt>
<dd>This variable determines what the minimum READ/WRITE CDB size is for a
given <code class="Nm">da</code> unit. Valid minimum command size values
are 6, 10, 12 and 16 bytes. The default is 6 bytes.
<p class="Pp">The <code class="Nm">da</code> driver issues a CAM Path
Inquiry CCB at probe time to determine whether the protocol the device
in question speaks (e.g. ATAPI) typically does not allow 6 byte
commands. If it does not, the <code class="Nm">da</code> driver will
default to using at least 10 byte CDBs. If a 6 byte READ or WRITE fails
with an ILLEGAL REQUEST error, the <code class="Nm">da</code> driver
will then increase the default CDB size for the device to 10 bytes and
retry the command. CDB size is always chosen as the smallest READ/WRITE
CDB that will satisfy the specified minimum command size, and the LBA
and length of the READ or WRITE in question. (e.g., a write to an LBA
larger than 2^32 will require a 16 byte CDB.)</p>
</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="NOTES"><a class="permalink" href="#NOTES">NOTES</a></h1>
<p class="Pp">If a device becomes invalidated (media is removed, device becomes
unresponsive) the disklabel and information held within the kernel about the
device will be invalidated. To avoid corruption of a newly inserted piece of
media or a replacement device, all accesses to the device will be discarded
until the last file descriptor referencing the old device is closed. During
this period, all new open attempts will be rejected.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag Bl-compact">
<dt><span class="Pa">/dev/da*</span></dt>
<dd>SCSI disk device nodes</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1>
<p class="Pp">None.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">ada(4)</a>, <a class="Xr">cam(4)</a>,
<a class="Xr">geom(4)</a>, <a class="Xr">nda(4)</a>,
<a class="Xr">gpart(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">da</code> driver was written for the CAM SCSI
subsystem by <span class="An">Justin T. Gibbs</span>. Many ideas were
gleaned from the <code class="Nm">sd</code> device driver written and ported
from Mach 2.5 by <span class="An">Julian Elischer</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">September 10, 2022</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|