[8636] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: reading blocks > 32K with generic device

daemon@ATHENA.MIT.EDU (Kai Makisara)
Sat Apr 15 04:38:11 2000

Date:	Sat, 15 Apr 2000 11:36:43 +0300 (EET DST)
From: Kai Makisara <makisara@metla.fi>
Reply-To: Kai.Makisara@metla.fi
To: Eric Lee Green <eric@estinc.com>
Cc: Jim Hammack <HammackJ@navo.navy.mil>, linux-scsi@vger.rutgers.edu
In-Reply-To: <Pine.OSF.4.10.10004151007350.19645-100000@abies.metla.fi>
Message-ID: <Pine.OSF.4.10.10004151133100.25971-100000@abies.metla.fi>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Sat, 15 Apr 2000, Kai Makisara wrote:

> On Fri, 14 Apr 2000, Eric Lee Green wrote:
> 
> > Jim Hammack wrote:
> > > How can I read > 32 Kbytes from a generic scsi device?  I am running
> > > kernel 2.2.13 and using a Sony SDT-9000 DAT drive.  I have data tapes
> > > with a 40960 byte block size.  I can read these tapes okay on an SGI
> > > under IRIX 6.5, but under Linux I only get 32K bytes.
> > 
> > That is correct. Linux currently by default only allows a maximum of 32K bytes
> > in fixed-block mode. This has been identified as a problem. 
> > 
...
> Looking at the source of the 2.3.99-pre5 source, it should be easy to fix
> this problem. The following patch compiles but I have not tested it at
> all:
> 
It did not work ;-( The following patch has been tested and seems to work:
--------------------------------------8<-------------------------------------
--- /source/linux-2.3/drivers/scsi/st.c	Fri Mar 24 21:44:32 2000
+++ linux-2.3/drivers/scsi/st.c	Sat Apr 15 11:18:32 2000
@@ -2238,7 +2238,7 @@
 		    (arg & MT_ST_BLKSIZE_MASK) != 0 &&
 		    ((arg & MT_ST_BLKSIZE_MASK) < STp->min_block ||
 		     (arg & MT_ST_BLKSIZE_MASK) > STp->max_block ||
-		     (arg & MT_ST_BLKSIZE_MASK) > st_buffer_size)) {
+		     (arg & MT_ST_BLKSIZE_MASK) > (STp->buffer)->buffer_size)) {
 			printk(KERN_WARNING "st%d: Illegal block size.\n", dev);
 			return (-EINVAL);
 		}
@@ -2853,6 +2853,11 @@
 		    mtc.mt_op != MTSETDENSITY && mtc.mt_op != MTWSM &&
 		    mtc.mt_op != MTSETDRVBUFFER && mtc.mt_op != MTSETPART)
 			STps->rw = ST_IDLE;	/* Prevent automatic WEOF and fsf */
+
+		if (mtc.mt_op == MTSETBLK && STp->buffer != NULL &&
+		    mtc.mt_count > (STp->buffer)->buffer_size &&
+		    !enlarge_buffer(STp->buffer, mtc.mt_count, STp->restr_dma))
+			return (-EIO);  /* Buffer resizing for fixed block mode failed */
 
 		if (mtc.mt_op == MTOFFL && STp->door_locked != ST_UNLOCKED)
 			st_int_ioctl(STp, MTUNLOCK, 0);	/* Ignore result! */
--------------------------------------8<-------------------------------------

	Kai



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post