Home > General > Drivers/scsi/st.c

Drivers/scsi/st.c

Rewinding devices are numbered from 0 - with the first SCSI tape, /dev/rst0 being c 9 0, the second /dev/rst1 c 9 1, etc. Waits until command performed if do_wait is true. MT_ST_SILI : 0; l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h index f91a67c..ea35632 100644 --- a/drivers/scsi/st.h +++ b/drivers/scsi/st.h @@ -120,6 +120,7 @@ struct scsi_tape { unsigned char c_algo; /* This new feature can be enabled via a new module flag: st_nowait_eof.

Some of these 11 parameters may be changed at runtime by the command 12 "echo -n ${value} > /sys/module/${modulename}/parameters/${parm}". 13 14 15 advansys= [HW,SCSI] 16 See header of drivers/scsi/advansys.c. 17 18 This ptr tells write_behind_check which IO is outstanding. ioctls).

The following parameters are defined in linux/drivers/scsi/st_options.h ST_NOWAIT {0} ST_IN_FILE_POS {0} ST_RECOVERED_WRITE_FATAL {0} ST_DEFAULT_BLOCK {0} ST_BUFFER_BLOCKS {32} ST_WRITE_THRESHOLD_BLOCKS {30} ST_MAX_BUFFERS {4} ST_MAX_SG {16} ST_FIRST_SG {8} ST_FIRST_ORDER {5} ST_TWO_FM {0} Due to constraints imposed by Linux's use of a sixteen bit dev_t with only eight bits allocated to the minor number, the SCSI tape minor numbers are assigned dynamically starting with

Contribution and ideas from several people including (in alphabetical order) Klaus Ehrenfried, Eugene Exarevsky, Eric Lee Green, Wolfgang Denk, Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky, Michael Schaefer, J"org Weule, History: Rewritten from Dwayne Forsyth's SCSI tape driver by Kai Makisara. In either case, you can work around the problem by editing drivers/scsi/st.c and adding a

 #define ST_NOWAIT 
at the top and rebuilding the kernel. The length of the block is determined using the residual count from the HBA.

  • See the accompanying file Documentation/scsi/st.txt for more information.
  • Signed-off-by: Kai Makisara Signed-off-by: James Bottomley --- Documentation/scsi/st.txt | 7 ++++++- drivers/scsi/st.c | 40 ++++++++++++++++++++++++++++++++++++---- drivers/scsi/st.h | 3 +++ drivers/scsi/st_options.h | 6 +++++- include/linux/mtio.h | 1 + 5 files
  • Returns either one of the codes below or a negative system error code. */ #define CHKRES_READY 0 #define CHKRES_NEW_SESSION 1 #define CHKRES_NOT_READY 2 #define CHKRES_NO_TAPE 3 #define MAX_ATTENTIONS 10 static int
  • when + writing a filemark, don't wait for it to complete) MT_ST_SILI enables setting the SILI bit in SCSI commands when reading in variable block mode to enhance performance when reading
  • For this reason, you may want to do something like a
     mt status 
    after a mt file positioning command so you don't overwrite tape files if the positioning command

Length %d, " "medium %x, WBS %x, BLL %d\n", (STp->buffer)->b_data[0], (STp->buffer)->b_data[1], (STp->buffer)->b_data[2], (STp->buffer)->b_data[3]); if ((STp->buffer)->b_data[3] >= 8) { STp->drv_buffer = ((STp->buffer)->b_data[2] >> 4) & 7; STp->density = (STp->buffer)->b_data[4]; STp->block_size = (STp->buffer)->b_data[9] tar cf /dev/nrst0 tmp.tar.z Problems taking tapes to/from other systems You can't read a tape made with another operating system or another operating system can't read a tape written in Don't use when st_request allocated. */ static int do_door_lock(struct scsi_tape * STp, int do_lock) { int retval; DEBC_printk(STp, "%socking drive door.\n", do_lock ? "L" : "Unl"); retval = scsi_set_medium_removal(STp->device, do_lock ? Note that this will defer error condition reporting until the next SCSI command is executed.

STp->block_size : st_fixed_buffer_size; else { bufsize = count; /* Make sure that data from previous user is not leaked even if HBA does not return correct residual */ if (is_read && REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, GFP_KERNEL); if (IS_ERR(req)) return DRIVER_ERROR << 24; rq = scsi_req(req); scsi_req_init(req); req->rq_flags |= RQF_QUIET; mdata->null_mapped = 1; if (bufflen) { err = blk_rq_map_user(req->q, req, mdata, NULL, bufflen, GFP_KERNEL); STp->block_size : st_fixed_buffer_size; - else + else { bufsize = count; + /* Make sure that data from previous user is not leaked even if + HBA does not return correct Different systems often use different block sizes.

st compile options Most of the following compile options can be overridden with boot/module parameters and/or runtime configuration (i.e. Virtually all drives should work, including : Archive Viper QIC drives, including the 150M and 525M models Exabyte 8mm drives Wangtek 5150S drives Wangdat DAT drives 8.2 Common Problems Tape drive Also, if error recovery fails, it * may try and take the device offline, in which case all further * access to the device is prohibited. */ if (!scsi_block_when_processing_errors(STp->device)) { retval The standard naming convention is /dev/nst{digit} for non-rewinding devices /dev/st{digit} for rewinding devices [prev in list] [next in list] [prev in thread] [next in thread] List: git-commits-head Subject: [SCSI] st: add

The tape will be positioned correctly unless seek_next is true. */ static int flush_buffer(struct scsi_tape *STp, int seek_next) { int backspace, result; struct st_buffer *STbuffer; struct st_partstat *STps; STbuffer = STp->buffer; org [Download message RAW] Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=40f6b36c6243462fb95d0343237331c423494b03 Commit: 40f6b36c6243462fb95d0343237331c423494b03 Parent: d35055a0f2637f29f95001a67b464fe833b09ebc Author: Kai Makisara AuthorDate: Sun Feb 24 22:23:24 2008 +0200 Committer: James Bottomley CommitDate: Mon Apr 7 12:15:39 2008 Parameter chosen with bits 20-28 */ #define MT_ST_CLEAR_DEFAULT 0xfffff -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More none ignores them, expecting 102 user space to do the scan. 103 104 sim710= [SCSI,HW] 105 See header of drivers/scsi/sim710.c. 106 107 st= [HW,SCSI] SCSI tape parameters (buffers, etc.) 108 See

st driver

E.4.1. You can do this with the mt command -
 mt setblk  
or
 mt setblk 0 
to get variable block length support. The third tar is successful since the tape is at the start of the next file. The second tar attempts to read at the file mark, gets nothing, but the tape spaces over the file mark.

Avoiding the REQUEST SENSE command for every block speeds up some real applications considerably. On a tape device using a fixed blocksize, you will get errors when reading blocks written using a different block size. Needs to take the BKL only because of incrementing the SCSI host module count. */ static int st_open(struct inode *inode, struct file *filp) { int i, retval = (-EIO); int resumed Repositioning the tape locks out access to all SCSI devices This is most common with SCSI drivers which only support one outstanding command at a time (see Multiple devices for an

Lastly, this new feature is displayed via the sysfs tape "options" attribute. This makes certain applications, like backup software, run much more quickly on buffered tape drives. NOTE : this is the hardware block size, not the blocking factor used with tar, dump, etc.

Tapes This section gives information that is specific to scsi tape drives. 8.1 Supported and Unsupported Hardware Drives using both fixed and variable length blocks smaller than the the driver buffer

It can also be set or cleared via the MTSETDRVBUFFER ioctl, using the newly-defined MT_ST_NOWAIT_EOF flag. So we disallow pread() and pwrite(), but permit lseeks. */ filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); if (!(STp = scsi_tape_get(dev))) { return -ENXIO; } filp->private_data = STp; spin_lock(&st_use_lock); if (STp->in_use) { spin_unlock(&st_use_lock); Note that these mt flags are NOT supported under the GNU version of mt which is included with some Linux distributions. Instead, you must use the BSD derived Linux SCSI mt command.

It's nulled out when the IO completes. */ if (!do_wait) (STp->buffer)->last_SRpnt = SRpnt; waiting = &STp->wait; init_completion(waiting); SRpnt->waiting = waiting; if (STp->buffer->do_dio) { mdata->page_order = 0; mdata->nr_entries = STp->buffer->sg_segs; mdata->pages = READ : WRITE)); if (i > 0) { STbp->do_dio = i; STbp->buffer_bytes = 0; /* can be used as transfer counter */ } else STbp->do_dio = 0; /* fall back to This is especially the case with QIC drives, which will read old 60M tapes but only write new 120, 150, 250, and 525M formats. Free Electrons Embedded Linux Experts Home Engineering Training Docs Community Company Blog twitter google+ linkedin github busybox linux u-boot Open Menu /drivers/scsi/st.c Go get it 1 2 3 4 5 6

Hide Line Numbers [ scsi ] 00-INDEX 53c700.txt aacraid.txt advansys.txt aha152x.txt aic79xx.txt aic7xxx.txt arcmsr_spec.txt bfa.txt bnx2fc.txt BusLogic.txt ChangeLog.1992-1997 ChangeLog.arcmsr ChangeLog.ips ChangeLog.lpfc ChangeLog.megaraid ChangeLog.megaraid_sas ChangeLog.ncr53c8xx ChangeLog.sym53c8xx ChangeLog.sym53c8xx_2 cxgb3i.txt dc395x.txt dpti.txt FlashPoint.txt g_NCR5380.txt Check the type of your tape device - it MUST be a character device with major and minor numbers matching those specified in Device Files. org> Date: 2008-04-18 19:10:39 Message-ID: 200804181910.m3IJAdRc024123 () hera ! Decompression fails Decompressing programs cannot handle the zeros padding the last block of the file.

STp->modes[STp->current_mode].defined) { retval = (-ENXIO); goto out; } /* * If there was a bus reset, block further access * to this device. */ if (STp->pos_unknown) { retval = (-EIO); goto The driver is currently maintained by Kai Mäkisara (email [email protected]) -Last modified: Mon Mar 7 21:14:44 2005 by kai.makisara +Last modified: Thu Feb 21 21:54:16 2008 by kai.makisara BASICS @@ -372,6 Signed-off-by: Lee Duncan --- Documentation/scsi/st.txt | 2 ++ drivers/scsi/st.c | 24 +++++++++++++++++++++--- drivers/scsi/st.h | 1 + include/linux/mtio.h | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Documentation/scsi/st.txt To read these tapes, you must set the blocksize of the tape driver to match the blocksize used when the tape was written, or to variable.

MT_ST_SCSI2LOGICAL : 0; options |= STm->sysv ? If SILI is set, reading a block shorter than the byte count does not result in CHECK CONDITION. kernel ! Page generated on 2016-12-21 14:37 EST. 1 SCSI Kernel Parameters 2 ~~~~~~~~~~~~~~~~~~~~~~ 3 4 See Documentation/kernel-parameters.txt for general information on 5 specifying module parameters. 6 7 This document may not be

MT_ST_SYSV : 0; options |= STp->immediate ? To prevent warnings and errors, wrap your compressed files in a .tar file - ie, rather than doing

 tar cfvz /dev/nrst0 file.1 file.2 ... 
do
 tar cfvz tmp.tar.z st ioctls and user interface
The Linux tape interface is defined in /usr/src/linux/include/linux/mtio.h . 

The following ioctl()s are listed in alphabetical order with a brief explanation to the right. SCSI_REMOVAL_PREVENT : SCSI_REMOVAL_ALLOW); if (!retval) STp->door_locked = do_lock ?

Non-rewinding devices have the high bit set in the minor number, ie /dev/nrst0 is c 9 128. Since legacy applications do not know about this new MTWEOFI ioctl, this patch adds a new flag that tells the st driver to return immediately when writing an EOF (i.e. The command 8 "modinfo -p ${modulename}" shows a current list of all parameters of a loadable 9 module.