⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.st

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻 ST
📖 第 1 页 / 共 2 页
字号:
This file contains brief information about the SCSI tape driver.The driver is currently maintained by Kai M{kisara (emailKai.Makisara@metla.fi)Last modified: Sat Aug  5 10:29:07 2000 by makisara@kai.makisara.localBASICSThe driver is generic, i.e., it does not contain any code tailoredto any specific tape drive. The tape parameters can be specified withone of the following three methods:1. Each user can specify the tape parameters he/she wants to usedirectly with ioctls. This is administratively a very simple andflexible method and applicable to single-user workstations. However,in a multiuser environment the next user finds the tape parameters instate the previous user left them.2. The system manager (root) can define default values for some tapeparameters, like block size and density using the MTSETDRVBUFFER ioctl.These parameters can be programmed to come into effect either when anew tape is loaded into the drive or if writing begins at thebeginning of the tape. The second method is applicable if the tapedrive performs auto-detection of the tape format well (like someQIC-drives). The result is that any tape can be read, writing can becontinued using existing format, and the default format is used ifthe tape is rewritten from the beginning (or a new tape is writtenfor the first time). The first method is applicable if the drivedoes not perform auto-detection well enough and there is a single"sensible" mode for the device. An example is a DAT drive that isused only in variable block mode (I don't know if this is sensibleor not :-).The user can override the parameters defined by the systemmanager. The changes persist until the defaults again come intoeffect.3. Up to four modes can be defined and selected using the minor number(bits 5 and 6). Mode 0 corresponds to the defaults discussedabove. Additional modes are dormant until they are defined by thesystem manager (root). When specification of a new mode is started,the configuration of mode 0 is used to provide a starting point fordefinition of the new mode.Using the modes allows the system manager to give the users choicesover some of the buffering parameters not directly accessible to theusers (buffered and asynchronous writes). The modes also allow choicesbetween formats in multi-tape operations (the explicitly overriddenparameters are reset when a new tape is loaded).If more than one mode is used, all modes should contain definitionsfor the same set of parameters.Many Unices contain internal tables that associate different modes tosupported devices. The Linux SCSI tape driver does not contain suchtables (and will not do that in future). Instead of that, a utilityprogram can be made that fetches the inquiry data sent by the device,scans its database, and sets up the modes using the ioctls. Anotheralternative is to make a small script that uses mt to set the defaultstailored to the system.The driver supports fixed and variable block size (within bufferlimits). Both the auto-rewind (minor equals device number) andnon-rewind devices (minor is 128 + device number) are implemented.In variable block mode, the byte count in write() determines the sizeof the physical block on tape. When reading, the drive reads the nexttape block and returns to the user the data if the read() byte countis at least the block size. Otherwise, error ENOMEM is returned.In fixed block mode, the data transfer between the drive and thedriver is in multiples of the block size. The write() byte count mustbe a multiple of the block size. This is not required when reading butmay be advisable for portability.Support is provided for changing the tape partition and partitioningof the tape with one or two partitions. By default support forpartitioned tape is disabled for each driver and it can be enabledwith the ioctl MTSETDRVBUFFER.By default the driver writes one filemark when the device is closed afterwriting and the last operation has been a write. Two filemarks can beoptionally written. In both cases end of data is signified byreturning zero bytes for two consecutive reads.The compile options are defined in the file linux/drivers/scsi/st_options.h.BSD AND SYS V SEMANTICSThe user can choose between these two behaviours of the tape driver bydefining the value of the symbol ST_SYSV. The semantics differ when afile being read is closed. The BSD semantics leaves the tape where itcurrently is whereas the SYS V semantics moves the tape past the nextfilemark unless the filemark has just been crossed.The default is BSD semantics.BUFFERINGThe driver uses tape buffers allocated either at system initializationor at run-time when needed. One buffer is used for each open tapedevice. The size of the buffers is selectable at compile and/or boottime. The buffers are used to store the data being transferred to/fromthe SCSI adapter. The following buffering options are selectable atcompile time and/or at run time (via ioctl):Buffering of data across write calls in fixed block mode (defineST_BUFFER_WRITES).Asynchronous writing. Writing the buffer contents to the tape isstarted and the write call returns immediately. The status is checkedat the next tape operation.Buffered writes and asynchronous writes may in some rare cases causeproblems in multivolume operations if there is not enough space on thetape after the early-warning mark to flush the driver buffer.Read ahead for fixed block mode (ST_READ_AHEAD). Filling the buffer isattempted even if the user does not want to get all of the data atthis read command. Should be disabled for those drives that don't likea filemark to truncate a read request or that don't like backspacing.The buffer size is defined (in 1024 byte units) by ST_BUFFER_BLOCKS orat boot time. If this size is not large enough, the driver tries totemporarily enlarge the buffer. Buffer allocation uses chunks ofmemory having sizes 2^n * (page size). Because of this the actualbuffer size may be larger than the buffer size specified withST_BUFFER_BLOCKS.A small number of buffers are allocated at driver initialisation. Themaximum number of these buffers is defined by ST_MAX_BUFFERS. Themaximum can be changed with kernel or module startup options. Onebuffer is allocated for each drive detected when the driver isinitialized up to the maximum.The driver tries to allocate new buffers at run-time ifnecessary. These buffers are freed after use. If the maximum number ofinitial buffers is set to zero, all buffer allocation is done atrun-time. The advantage of run-time allocation is that memory is notwasted for buffers not being used. The disadvantage is that there maynot be memory available at the time when a buffer is needed for thefirst time (once a buffer is allocated, it is not released). This riskshould not be big if the tape drive is connected to a PCI adapter thatsupports scatter/gather (the allocation is not limited to "DMA memory"and the buffer can be composed of several fragments).The threshold for triggering asynchronous write in fixed block modeis defined by ST_WRITE_THRESHOLD. This may be optimized for eachuse pattern. The default triggers asynchronous write after threedefault sized writes (10 kB) from tar.Scatter/gather buffers (buffers that consist of chunks non-contiguousin the physical memory) are used if contiguous buffers can't beallocated. To support all SCSI adapters (including those notsupporting scatter/gather), buffer allocation is using the followingthree kinds of chunks:1. The initial segment that is used for all SCSI adapters includingthose not supporting scatter/gather. The size of this buffer will be(PAGE_SIZE << ST_FIRST_ORDER) bytes if the system can give a chunk ofthis size (and it is not larger than the buffer size specified byST_BUFFER_BLOCKS). If this size is not available, the driver halvesthe size and tries again until the size of one page. The defaultsettings in st_options.h make the driver to try to allocate all of thebuffer as one chunk.2. The scatter/gather segments to fill the specified buffer size areallocated so that as many segments as possible are used but the numberof segments does not exceed ST_FIRST_SG.3. The remaining segments between ST_MAX_SG (or the module parametermax_sg_segs) and the number of segments used in phases 1 and 2are used to extend the buffer at run-time if this is necessary. Thenumber of scatter/gather segments allowed for the SCSI adapter is notexceeded if it is smaller than the maximum number of scatter/gathersegments specified. If the maximum number allowed for the SCSI adapteris smaller than the number of segments used in phases 1 and 2,extending the buffer will always fail.MODULE PARAMETERSThe buffer size, write threshold, and the maximum number of allocated buffersare configurable when the driver is loaded as a module. The keywords are:buffer_kbs=xxx             the buffer size in kilobytes is set to xxxwrite_threshold_kbs=xxx    the write threshold in kilobytes set to xxxmax_buffers=xxx            the maximum number of tape buffer set to xxxmax_sg_segs=xxx		   the maximum number of scatter/gather			   segmentsNote that if the buffer size is changed but the write threshold is notset, the write threshold is set to the new buffer size - 2 kB.BOOT TIME CONFIGURATIONIf the driver is compiled into the kernel, the same parameters can bealso set using, e.g., the LILO command line. The preferred syntax isto use the same keywords as when loading the driver as module. Ifseveral parameters are set, the keyword-value pairs are separated witha comma (no spaces allowed). A colon can be used instead of the equalmark. The definition is prepended by the string st=. Here is anexample:	st=buffer_kbs:64,max_buffers:2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -