aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/st.h
AgeCommit message (Collapse)Author
2012-09-14[SCSI] st: raise device limitJeff Mahoney
The device limit of 128 tape drives was established in 2003 as a significant increase from the 8 tape drives allowed previously. We're seeing customer sites that between a large number of drives and multipath are discovering more than 128 devices and running into problems. Now that we're not stuck having to store a pointer in array and aren't limited by kmalloc failing on higher order allocs we can lift the limit to fill the entire minor range based on the number of modes. Based on the current code, that's 2^17 devices. Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Jeff Mahoney <jeffm@suse.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-09-14[SCSI] st: clean up device file creation and removalJeff Mahoney
This patch cleans up the st device file creation and removal. Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Jeff Mahoney <jeffm@suse.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-09-14[SCSI] st: get rid of scsi_tapes arrayJeff Mahoney
st currently allocates an array to store pointers to all of the scsi_tape objects. It's used to discover available indexes to use as the base for the minor number selection and later to look up scsi_tape devices for character devices. We switch to using an IDR for minor selection and a pointer from st_modedef back to scsi_tape for the lookups. Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Jeff Mahoney <jeffm@suse.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-05-10[SCSI] st: fix memory leak with >1MB tape I/ODavid Jeffery
There is a memory leak in the st driver when sending large enough reads or writes using st's direct I/O path. As part of mapping the application's memory, a buffer to hold page pointers is allocated and the count of mapped pages is stored in field do_dio. A non-zero do_dio marks that direct I/O is in use. But do_dio is only 1 byte in size. Mapping 256 4k pages overflows do_dio and causes it to be set to 0, like direct I/O option was not used. When the I/O completes, the buffer to hold the page pointers is not freed, and the page counts of the mapped pages are not reduced. Every I/O of this size then leaks memory. The size of do_dio needs to be increased to prevent it wrapping around. Signed-off-by: David Jeffery <djeffery@redhat.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-03-27[SCSI] st: expand ability to write immediate filemarksLee Duncan
The st tape driver recently added the MTWEOFI ioctl, which writes a tape filemark (EOF), like the MTWEOF ioctl, except that MTWEOFI returns immediately. This makes certain applications, like backup software, run much more quickly on buffered tape drives. Since legacy applications do not know about this new MTWEOFI ioctl, this patch adds a new ioctl option that tells the st driver to return immediately when writing an EOF (i.e. a filemark). This new flag is much like the existing flag that tells the st driver to perform writes (and certain other IOs) immediately, but this new flag only applies to writing EOFs. This new feature is controlled via the MTSETDRVBUFFER ioctl, using the newly-defined MT_ST_NOWAIT_EOF flag. Use of this new feature is displayed via the sysfs tape "options" attribute. The st documentation was updated to mention this new flag, as well as the problems that can occur from using it. Signed-off-by: Lee Duncan <lduncan@suse.com> Acked-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2009-12-10[SCSI] st: fix mdata->page_order handlingFUJITA Tomonori
dio transfer always resets mdata->page_order to zero. It breaks high-order pages previously allocated for non-dio transfer. This patches adds reserved_page_order to st_buffer structure to save page order for non-dio transfer. http://bugzilla.kernel.org/show_bug.cgi?id=14563 When enlarge_buffer() allocates 524288 from 0, st uses six-order page allocation. So mdata->page_order is 6 and frp_seg is 2. After that, if st uses dio, sgl_map_user_pages() sets mdata->page_order to 0 for st_do_scsi(). After that, when we call normalize_buffer(), it frees only free frp_seg * PAGE_SIZE (2 * 4096) though we should free frp_seg * PAGE_SIZE << 6 (2 * 4096 << 6). So we see buffer_size is set to 516096 (524288 - 8192). Reported-by: Joachim Breuer <linux-kernel@jmbreuer.net> Tested-by: Joachim Breuer <linux-kernel@jmbreuer.net> Acked-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: stable@kernel.org Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2009-01-02[SCSI] st: remove unused frp_sg_currentFUJITA Tomonori
frp_sg_current in struct st_buffer is always zero. We don't need it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: remove unused orig_frp_segsFUJITA Tomonori
orig_frp_segs in struct st_buffer is always zero. We don't need it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: remove struct scatterlistFUJITA Tomonori
This removes the usage of struct scatterlist completely. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: kill struct st_buff_fragmentFUJITA Tomonori
This removes struct st_buff_fragment and use reserved_pages array to store fragment buffer. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: convert dio path to use st_scsi_executeFUJITA Tomonori
This patch converts the dio path (mmap) to use st_scsi_execute. IOW, it removes scsi_execute_async in the non dio path. scsi_execute_async has gone! This also remove unused st_sleep_done. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: add st_scsi_execute helper functionFUJITA Tomonori
st_scsi_execute is a helper function to perform SCSI commands involving data transfer between user and kernel space (st_read and st_write). It's the future plan to combine this with st_scsi_kern_execute helper function. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-01-02[SCSI] st: add struct rq_map_data supportFUJITA Tomonori
This adds struct rq_map_data and the array of pointers to store fragment buffers to struct st_buffer. This patch doesn't remove st_buf_fragment but the latter patch does. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Kai Makisara <Kai.Makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-07[SCSI] st: add option to use SILI in variable block readsKai Makisara
Add new option MT_ST_SILI to enable setting the SILI bit in reads in variable block mode. If SILI is set, reading a block shorter than the byte count does not result in CHECK CONDITION. The length of the block is determined using the residual count from the HBA. Avoiding the REQUEST SENSE command for every block speeds up some real applications considerably. Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-02-22[SCSI] st: compile fix when DEBUG set to oneKai Makisara
Remove the now useless counting of adjacent pages from the debugging code in to make it compile when DEBUG is set non-zero. Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-07-31[SCSI] st: Use mutex instead of semaphoreMatthias Kaehlcke
The SCSI Tape driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-02-03[SCSI] st: fix Tape dies if wrong block size used, bug 7919Kai Makisara
On Thu, 1 Feb 2007, Andrew Morton wrote: > On Thu, 1 Feb 2007 15:34:29 -0800 > bugme-daemon@bugzilla.kernel.org wrote: > > > http://bugzilla.kernel.org/show_bug.cgi?id=7919 > > > > Summary: Tape dies if wrong block size used > > Kernel Version: 2.6.20-rc5 > > Status: NEW > > Severity: normal > > Owner: scsi_drivers-other@kernel-bugs.osdl.org > > Submitter: dmartin@sccd.ctc.edu > > > > > > Most recent kernel where this bug did *NOT* occur: 2.6.17.14 > > > > Other Kernels Tested and Results: > > > > OK 2.6.15.7 > > OK 2.6.16.37 > > OK 2.6.17.14 > > BAD 2.6.18.6 > > BAD 2.6.18-1.2869.fc6 > > BAD 2.6.19.2 + > > BAD 2.6.20-rc5 > > > > NOTE: 2.6.18-1.2869.fc6 is a Fedora modified kernel, all others are from kernel.org > > ... > > Steps to reproduce: > > Get a Adaptec AHA-2940U/UW/D / AIC-7881U card and a tape drive, > > install a recent kernel > > set the tape block size - mt setblk 4096 > > read from or write to tape using wrong block size - tar -b 7 -cvf /dev/tape foo > > Write does not trigger this bug because the driver refuses in fixed block mode writes that are not a multiple of the block size. Read does trigger it in my system. The bug is not associated with any specific HBA. st tries to do direct i/o in fixed block mode with reads that are not a multiple of tape block size. The patch in this message fixes the st problem by switching to using the driver buffer up to the next close of the device file in fixed block mode if the user asks for a read like this. I don't know why the bug has surfaced only after 2.6.17 although the st problem is old. There may be another bug in the block subsystem and this patch works around it. However, the patch fixes a problem in st and in this way it is a valid fix. This patch may also fix the bug 7900. The patch compiles and is lightly tested. Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-29[SCSI] st: remove unused st_buffer.in_useMartin Habets
I noticed that in_use in st_buffer is not used. The patch below against 2.6.17-rc3 removes it, assuming there is no future use for it. It was tested in a sparc SS20 with a DLT4000. Signed-off-by: Martin Habets <errandir_news@mph.eclipse.co.uk> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-14[SCSI] convert st to use scsi_execute_asyncMike Christie
convert st to always send scatterlists and kill scsi_request usage. This is the same as last time as it was posted, but with Kai's patches merged and we now pass the bytes value to scsi_execute_async. TODO: - move DIO code to common place or make block layers usable for ULDs. - move buffer allocation code to common place for all ULDs to use. And make buffer allocation code handle all queue limits so we can find out about problems before calling scsi_execute_async. - move indirect (copy_to/from_user) paths commone place or make block layers usable for ULDs. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-08[SCSI] drivers/scsi/st.c: add reference count and related fixesKai Makisara
I have rediffed the patch against 2.6.13-rc5, done a couple of cosmetic cleanups, and run some tests. Brian King has acknowledged that it fixes the problems he has seen. Seems mature enough for inclusion into 2.6.14 (or later)? Nate's explanation of the changes: I've attached patches against 2.6.13rc2. These are basically identical to my earlier patches, as I found that all issues I'd seen in earlier kernels still existed in this kernel. To summarize, the changes are: (more details in my original email) - add a kref to the scsi_tape structure, and associate reference counting stuff - set sr_request->end_io = blk_end_sync_rq so we get notified when an IO is rejected when the device goes away - check rq_status when IOs complete, else we don't know that IOs rejected for a dead device in fact did not complete - change last_SRpnt so it's set before an async IO is issued (in case st_sleep_done is bypassed) - fix a bogus use of last_SRpnt in st_chk_result Signed-off-by: Nate Dailey <nate.dailey@stratus.com> Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!