diff options
Diffstat (limited to 'Documentation/ide')
-rw-r--r-- | Documentation/ide/ChangeLog.ide-tape.1995-2002 | 257 | ||||
-rw-r--r-- | Documentation/ide/ide-tape.txt | 146 |
2 files changed, 403 insertions, 0 deletions
diff --git a/Documentation/ide/ChangeLog.ide-tape.1995-2002 b/Documentation/ide/ChangeLog.ide-tape.1995-2002 new file mode 100644 index 000000000000..877fac8770b3 --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-tape.1995-2002 | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Ver 0.1 Nov 1 95 Pre-working code :-) | ||
3 | * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure | ||
4 | * was successful ! (Using tar cvf ... on the block | ||
5 | * device interface). | ||
6 | * A longer backup resulted in major swapping, bad | ||
7 | * overall Linux performance and eventually failed as | ||
8 | * we received non serial read-ahead requests from the | ||
9 | * buffer cache. | ||
10 | * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the | ||
11 | * character device interface. Linux's responsiveness | ||
12 | * and performance doesn't seem to be much affected | ||
13 | * from the background backup procedure. | ||
14 | * Some general mtio.h magnetic tape operations are | ||
15 | * now supported by our character device. As a result, | ||
16 | * popular tape utilities are starting to work with | ||
17 | * ide tapes :-) | ||
18 | * The following configurations were tested: | ||
19 | * 1. An IDE ATAPI TAPE shares the same interface | ||
20 | * and irq with an IDE ATAPI CDROM. | ||
21 | * 2. An IDE ATAPI TAPE shares the same interface | ||
22 | * and irq with a normal IDE disk. | ||
23 | * Both configurations seemed to work just fine ! | ||
24 | * However, to be on the safe side, it is meanwhile | ||
25 | * recommended to give the IDE TAPE its own interface | ||
26 | * and irq. | ||
27 | * The one thing which needs to be done here is to | ||
28 | * add a "request postpone" feature to ide.c, | ||
29 | * so that we won't have to wait for the tape to finish | ||
30 | * performing a long media access (DSC) request (such | ||
31 | * as a rewind) before we can access the other device | ||
32 | * on the same interface. This effect doesn't disturb | ||
33 | * normal operation most of the time because read/write | ||
34 | * requests are relatively fast, and once we are | ||
35 | * performing one tape r/w request, a lot of requests | ||
36 | * from the other device can be queued and ide.c will | ||
37 | * service all of them after this single tape request. | ||
38 | * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree. | ||
39 | * On each read / write request, we now ask the drive | ||
40 | * if we can transfer a constant number of bytes | ||
41 | * (a parameter of the drive) only to its buffers, | ||
42 | * without causing actual media access. If we can't, | ||
43 | * we just wait until we can by polling the DSC bit. | ||
44 | * This ensures that while we are not transferring | ||
45 | * more bytes than the constant referred to above, the | ||
46 | * interrupt latency will not become too high and | ||
47 | * we won't cause an interrupt timeout, as happened | ||
48 | * occasionally in the previous version. | ||
49 | * While polling for DSC, the current request is | ||
50 | * postponed and ide.c is free to handle requests from | ||
51 | * the other device. This is handled transparently to | ||
52 | * ide.c. The hwgroup locking method which was used | ||
53 | * in the previous version was removed. | ||
54 | * Use of new general features which are provided by | ||
55 | * ide.c for use with atapi devices. | ||
56 | * (Programming done by Mark Lord) | ||
57 | * Few potential bug fixes (Again, suggested by Mark) | ||
58 | * Single character device data transfers are now | ||
59 | * not limited in size, as they were before. | ||
60 | * We are asking the tape about its recommended | ||
61 | * transfer unit and send a larger data transfer | ||
62 | * as several transfers of the above size. | ||
63 | * For best results, use an integral number of this | ||
64 | * basic unit (which is shown during driver | ||
65 | * initialization). I will soon add an ioctl to get | ||
66 | * this important parameter. | ||
67 | * Our data transfer buffer is allocated on startup, | ||
68 | * rather than before each data transfer. This should | ||
69 | * ensure that we will indeed have a data buffer. | ||
70 | * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape | ||
71 | * shared an interface with another device. | ||
72 | * (poll_for_dsc was a complete mess). | ||
73 | * Removed some old (non-active) code which had | ||
74 | * to do with supporting buffer cache originated | ||
75 | * requests. | ||
76 | * The block device interface can now be opened, so | ||
77 | * that general ide driver features like the unmask | ||
78 | * interrupts flag can be selected with an ioctl. | ||
79 | * This is the only use of the block device interface. | ||
80 | * New fast pipelined operation mode (currently only on | ||
81 | * writes). When using the pipelined mode, the | ||
82 | * throughput can potentially reach the maximum | ||
83 | * tape supported throughput, regardless of the | ||
84 | * user backup program. On my tape drive, it sometimes | ||
85 | * boosted performance by a factor of 2. Pipelined | ||
86 | * mode is enabled by default, but since it has a few | ||
87 | * downfalls as well, you may want to disable it. | ||
88 | * A short explanation of the pipelined operation mode | ||
89 | * is available below. | ||
90 | * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition. | ||
91 | * Added pipeline read mode. As a result, restores | ||
92 | * are now as fast as backups. | ||
93 | * Optimized shared interface behavior. The new behavior | ||
94 | * typically results in better IDE bus efficiency and | ||
95 | * higher tape throughput. | ||
96 | * Pre-calculation of the expected read/write request | ||
97 | * service time, based on the tape's parameters. In | ||
98 | * the pipelined operation mode, this allows us to | ||
99 | * adjust our polling frequency to a much lower value, | ||
100 | * and thus to dramatically reduce our load on Linux, | ||
101 | * without any decrease in performance. | ||
102 | * Implemented additional mtio.h operations. | ||
103 | * The recommended user block size is returned by | ||
104 | * the MTIOCGET ioctl. | ||
105 | * Additional minor changes. | ||
106 | * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the | ||
107 | * use of some block sizes during a restore procedure. | ||
108 | * The character device interface will now present a | ||
109 | * continuous view of the media - any mix of block sizes | ||
110 | * during a backup/restore procedure is supported. The | ||
111 | * driver will buffer the requests internally and | ||
112 | * convert them to the tape's recommended transfer | ||
113 | * unit, making performance almost independent of the | ||
114 | * chosen user block size. | ||
115 | * Some improvements in error recovery. | ||
116 | * By cooperating with ide-dma.c, bus mastering DMA can | ||
117 | * now sometimes be used with IDE tape drives as well. | ||
118 | * Bus mastering DMA has the potential to dramatically | ||
119 | * reduce the CPU's overhead when accessing the device, | ||
120 | * and can be enabled by using hdparm -d1 on the tape's | ||
121 | * block device interface. For more info, read the | ||
122 | * comments in ide-dma.c. | ||
123 | * Ver 1.4 Mar 13 96 Fixed serialize support. | ||
124 | * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85. | ||
125 | * Fixed pipelined read mode inefficiency. | ||
126 | * Fixed nasty null dereferencing bug. | ||
127 | * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver. | ||
128 | * Fixed end of media bug. | ||
129 | * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model. | ||
130 | * Ver 1.8 Sep 26 96 Attempt to find a better balance between good | ||
131 | * interactive response and high system throughput. | ||
132 | * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather | ||
133 | * than requiring an explicit FSF command. | ||
134 | * Abort pending requests at end of media. | ||
135 | * MTTELL was sometimes returning incorrect results. | ||
136 | * Return the real block size in the MTIOCGET ioctl. | ||
137 | * Some error recovery bug fixes. | ||
138 | * Ver 1.10 Nov 5 96 Major reorganization. | ||
139 | * Reduced CPU overhead a bit by eliminating internal | ||
140 | * bounce buffers. | ||
141 | * Added module support. | ||
142 | * Added multiple tape drives support. | ||
143 | * Added partition support. | ||
144 | * Rewrote DSC handling. | ||
145 | * Some portability fixes. | ||
146 | * Removed ide-tape.h. | ||
147 | * Additional minor changes. | ||
148 | * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling. | ||
149 | * Use ide_stall_queue() for DSC overlap. | ||
150 | * Use the maximum speed rather than the current speed | ||
151 | * to compute the request service time. | ||
152 | * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data | ||
153 | * corruption, which could occur if the total number | ||
154 | * of bytes written to the tape was not an integral | ||
155 | * number of tape blocks. | ||
156 | * Add support for INTERRUPT DRQ devices. | ||
157 | * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB | ||
158 | * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives. | ||
159 | * Replace cli()/sti() with hwgroup spinlocks. | ||
160 | * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup | ||
161 | * spinlock with private per-tape spinlock. | ||
162 | * Ver 1.16 Sep 1 99 Add OnStream tape support. | ||
163 | * Abort read pipeline on EOD. | ||
164 | * Wait for the tape to become ready in case it returns | ||
165 | * "in the process of becoming ready" on open(). | ||
166 | * Fix zero padding of the last written block in | ||
167 | * case the tape block size is larger than PAGE_SIZE. | ||
168 | * Decrease the default disconnection time to tn. | ||
169 | * Ver 1.16e Oct 3 99 Minor fixes. | ||
170 | * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen, | ||
171 | * niessen@iae.nl / arnold.niessen@philips.com | ||
172 | * GO-1) Undefined code in idetape_read_position | ||
173 | * according to Gadi's email | ||
174 | * AJN-1) Minor fix asc == 11 should be asc == 0x11 | ||
175 | * in idetape_issue_packet_command (did effect | ||
176 | * debugging output only) | ||
177 | * AJN-2) Added more debugging output, and | ||
178 | * added ide-tape: where missing. I would also | ||
179 | * like to add tape->name where possible | ||
180 | * AJN-3) Added different debug_level's | ||
181 | * via /proc/ide/hdc/settings | ||
182 | * "debug_level" determines amount of debugging output; | ||
183 | * can be changed using /proc/ide/hdx/settings | ||
184 | * 0 : almost no debugging output | ||
185 | * 1 : 0+output errors only | ||
186 | * 2 : 1+output all sensekey/asc | ||
187 | * 3 : 2+follow all chrdev related procedures | ||
188 | * 4 : 3+follow all procedures | ||
189 | * 5 : 4+include pc_stack rq_stack info | ||
190 | * 6 : 5+USE_COUNT updates | ||
191 | * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail | ||
192 | * from 5 to 10 minutes | ||
193 | * AJN-5) Changed maximum number of blocks to skip when | ||
194 | * reading tapes with multiple consecutive write | ||
195 | * errors from 100 to 1000 in idetape_get_logical_blk | ||
196 | * Proposed changes to code: | ||
197 | * 1) output "logical_blk_num" via /proc | ||
198 | * 2) output "current_operation" via /proc | ||
199 | * 3) Either solve or document the fact that `mt rewind' is | ||
200 | * required after reading from /dev/nhtx to be | ||
201 | * able to rmmod the idetape module; | ||
202 | * Also, sometimes an application finishes but the | ||
203 | * device remains `busy' for some time. Same cause ? | ||
204 | * Proposed changes to release-notes: | ||
205 | * 4) write a simple `quickstart' section in the | ||
206 | * release notes; I volunteer if you don't want to | ||
207 | * 5) include a pointer to video4linux in the doc | ||
208 | * to stimulate video applications | ||
209 | * 6) release notes lines 331 and 362: explain what happens | ||
210 | * if the application data rate is higher than 1100 KB/s; | ||
211 | * similar approach to lower-than-500 kB/s ? | ||
212 | * 7) 6.6 Comparison; wouldn't it be better to allow different | ||
213 | * strategies for read and write ? | ||
214 | * Wouldn't it be better to control the tape buffer | ||
215 | * contents instead of the bandwidth ? | ||
216 | * 8) line 536: replace will by would (if I understand | ||
217 | * this section correctly, a hypothetical and unwanted situation | ||
218 | * is being described) | ||
219 | * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames. | ||
220 | * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl | ||
221 | * - Add idetape_onstream_mode_sense_tape_parameter_page | ||
222 | * function to get tape capacity in frames: tape->capacity. | ||
223 | * - Add support for DI-50 drives( or any DI- drive). | ||
224 | * - 'workaround' for read error/blank block around block 3000. | ||
225 | * - Implement Early warning for end of media for Onstream. | ||
226 | * - Cosmetic code changes for readability. | ||
227 | * - Idetape_position_tape should not use SKIP bit during | ||
228 | * Onstream read recovery. | ||
229 | * - Add capacity, logical_blk_num and first/last_frame_position | ||
230 | * to /proc/ide/hd?/settings. | ||
231 | * - Module use count was gone in the Linux 2.4 driver. | ||
232 | * Ver 1.17a Apr 2001 Willem Riede osst@riede.org | ||
233 | * - Get drive's actual block size from mode sense block descriptor | ||
234 | * - Limit size of pipeline | ||
235 | * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu> | ||
236 | * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used | ||
237 | * it in the code! | ||
238 | * Actually removed aborted stages in idetape_abort_pipeline | ||
239 | * instead of just changing the command code. | ||
240 | * Made the transfer byte count for Request Sense equal to the | ||
241 | * actual length of the data transfer. | ||
242 | * Changed handling of partial data transfers: they do not | ||
243 | * cause DMA errors. | ||
244 | * Moved initiation of DMA transfers to the correct place. | ||
245 | * Removed reference to unallocated memory. | ||
246 | * Made __idetape_discard_read_pipeline return the number of | ||
247 | * sectors skipped, not the number of stages. | ||
248 | * Replaced errant kfree() calls with __idetape_kfree_stage(). | ||
249 | * Fixed off-by-one error in testing the pipeline length. | ||
250 | * Fixed handling of filemarks in the read pipeline. | ||
251 | * Small code optimization for MTBSF and MTBSFM ioctls. | ||
252 | * Don't try to unlock the door during device close if is | ||
253 | * already unlocked! | ||
254 | * Cosmetic fixes to miscellaneous debugging output messages. | ||
255 | * Set the minimum /proc/ide/hd?/settings values for "pipeline", | ||
256 | * "pipeline_min", and "pipeline_max" to 1. | ||
257 | */ | ||
diff --git a/Documentation/ide/ide-tape.txt b/Documentation/ide/ide-tape.txt new file mode 100644 index 000000000000..658f271a373f --- /dev/null +++ b/Documentation/ide/ide-tape.txt | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * IDE ATAPI streaming tape driver. | ||
3 | * | ||
4 | * This driver is a part of the Linux ide driver. | ||
5 | * | ||
6 | * The driver, in co-operation with ide.c, basically traverses the | ||
7 | * request-list for the block device interface. The character device | ||
8 | * interface, on the other hand, creates new requests, adds them | ||
9 | * to the request-list of the block device, and waits for their completion. | ||
10 | * | ||
11 | * Pipelined operation mode is now supported on both reads and writes. | ||
12 | * | ||
13 | * The block device major and minor numbers are determined from the | ||
14 | * tape's relative position in the ide interfaces, as explained in ide.c. | ||
15 | * | ||
16 | * The character device interface consists of the following devices: | ||
17 | * | ||
18 | * ht0 major 37, minor 0 first IDE tape, rewind on close. | ||
19 | * ht1 major 37, minor 1 second IDE tape, rewind on close. | ||
20 | * ... | ||
21 | * nht0 major 37, minor 128 first IDE tape, no rewind on close. | ||
22 | * nht1 major 37, minor 129 second IDE tape, no rewind on close. | ||
23 | * ... | ||
24 | * | ||
25 | * The general magnetic tape commands compatible interface, as defined by | ||
26 | * include/linux/mtio.h, is accessible through the character device. | ||
27 | * | ||
28 | * General ide driver configuration options, such as the interrupt-unmask | ||
29 | * flag, can be configured by issuing an ioctl to the block device interface, | ||
30 | * as any other ide device. | ||
31 | * | ||
32 | * Our own ide-tape ioctl's can be issued to either the block device or | ||
33 | * the character device interface. | ||
34 | * | ||
35 | * Maximal throughput with minimal bus load will usually be achieved in the | ||
36 | * following scenario: | ||
37 | * | ||
38 | * 1. ide-tape is operating in the pipelined operation mode. | ||
39 | * 2. No buffering is performed by the user backup program. | ||
40 | * | ||
41 | * Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive. | ||
42 | * | ||
43 | * Here are some words from the first releases of hd.c, which are quoted | ||
44 | * in ide.c and apply here as well: | ||
45 | * | ||
46 | * | Special care is recommended. Have Fun! | ||
47 | * | ||
48 | * | ||
49 | * An overview of the pipelined operation mode. | ||
50 | * | ||
51 | * In the pipelined write mode, we will usually just add requests to our | ||
52 | * pipeline and return immediately, before we even start to service them. The | ||
53 | * user program will then have enough time to prepare the next request while | ||
54 | * we are still busy servicing previous requests. In the pipelined read mode, | ||
55 | * the situation is similar - we add read-ahead requests into the pipeline, | ||
56 | * before the user even requested them. | ||
57 | * | ||
58 | * The pipeline can be viewed as a "safety net" which will be activated when | ||
59 | * the system load is high and prevents the user backup program from keeping up | ||
60 | * with the current tape speed. At this point, the pipeline will get | ||
61 | * shorter and shorter but the tape will still be streaming at the same speed. | ||
62 | * Assuming we have enough pipeline stages, the system load will hopefully | ||
63 | * decrease before the pipeline is completely empty, and the backup program | ||
64 | * will be able to "catch up" and refill the pipeline again. | ||
65 | * | ||
66 | * When using the pipelined mode, it would be best to disable any type of | ||
67 | * buffering done by the user program, as ide-tape already provides all the | ||
68 | * benefits in the kernel, where it can be done in a more efficient way. | ||
69 | * As we will usually not block the user program on a request, the most | ||
70 | * efficient user code will then be a simple read-write-read-... cycle. | ||
71 | * Any additional logic will usually just slow down the backup process. | ||
72 | * | ||
73 | * Using the pipelined mode, I get a constant over 400 KBps throughput, | ||
74 | * which seems to be the maximum throughput supported by my tape. | ||
75 | * | ||
76 | * However, there are some downfalls: | ||
77 | * | ||
78 | * 1. We use memory (for data buffers) in proportional to the number | ||
79 | * of pipeline stages (each stage is about 26 KB with my tape). | ||
80 | * 2. In the pipelined write mode, we cheat and postpone error codes | ||
81 | * to the user task. In read mode, the actual tape position | ||
82 | * will be a bit further than the last requested block. | ||
83 | * | ||
84 | * Concerning (1): | ||
85 | * | ||
86 | * 1. We allocate stages dynamically only when we need them. When | ||
87 | * we don't need them, we don't consume additional memory. In | ||
88 | * case we can't allocate stages, we just manage without them | ||
89 | * (at the expense of decreased throughput) so when Linux is | ||
90 | * tight in memory, we will not pose additional difficulties. | ||
91 | * | ||
92 | * 2. The maximum number of stages (which is, in fact, the maximum | ||
93 | * amount of memory) which we allocate is limited by the compile | ||
94 | * time parameter IDETAPE_MAX_PIPELINE_STAGES. | ||
95 | * | ||
96 | * 3. The maximum number of stages is a controlled parameter - We | ||
97 | * don't start from the user defined maximum number of stages | ||
98 | * but from the lower IDETAPE_MIN_PIPELINE_STAGES (again, we | ||
99 | * will not even allocate this amount of stages if the user | ||
100 | * program can't handle the speed). We then implement a feedback | ||
101 | * loop which checks if the pipeline is empty, and if it is, we | ||
102 | * increase the maximum number of stages as necessary until we | ||
103 | * reach the optimum value which just manages to keep the tape | ||
104 | * busy with minimum allocated memory or until we reach | ||
105 | * IDETAPE_MAX_PIPELINE_STAGES. | ||
106 | * | ||
107 | * Concerning (2): | ||
108 | * | ||
109 | * In pipelined write mode, ide-tape can not return accurate error codes | ||
110 | * to the user program since we usually just add the request to the | ||
111 | * pipeline without waiting for it to be serviced. In case an error | ||
112 | * occurs, I will report it on the next user request. | ||
113 | * | ||
114 | * In the pipelined read mode, subsequent read requests or forward | ||
115 | * filemark spacing will perform correctly, as we preserve all blocks | ||
116 | * and filemarks which we encountered during our excess read-ahead. | ||
117 | * | ||
118 | * For accurate tape positioning and error reporting, disabling | ||
119 | * pipelined mode might be the best option. | ||
120 | * | ||
121 | * You can enable/disable/tune the pipelined operation mode by adjusting | ||
122 | * the compile time parameters below. | ||
123 | * | ||
124 | * | ||
125 | * Possible improvements. | ||
126 | * | ||
127 | * 1. Support for the ATAPI overlap protocol. | ||
128 | * | ||
129 | * In order to maximize bus throughput, we currently use the DSC | ||
130 | * overlap method which enables ide.c to service requests from the | ||
131 | * other device while the tape is busy executing a command. The | ||
132 | * DSC overlap method involves polling the tape's status register | ||
133 | * for the DSC bit, and servicing the other device while the tape | ||
134 | * isn't ready. | ||
135 | * | ||
136 | * In the current QIC development standard (December 1995), | ||
137 | * it is recommended that new tape drives will *in addition* | ||
138 | * implement the ATAPI overlap protocol, which is used for the | ||
139 | * same purpose - efficient use of the IDE bus, but is interrupt | ||
140 | * driven and thus has much less CPU overhead. | ||
141 | * | ||
142 | * ATAPI overlap is likely to be supported in most new ATAPI | ||
143 | * devices, including new ATAPI cdroms, and thus provides us | ||
144 | * a method by which we can achieve higher throughput when | ||
145 | * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device. | ||
146 | */ | ||