aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorKai Makisara <Kai.Makisara@kolumbus.fi>2010-10-08 17:17:56 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-08 18:16:22 -0400
commit3e51d3c924aea8a1f1372e6c615b0a37b528121d (patch)
tree16cdd955fc95e4e1ca28faaac6524e51e0c271d4 /drivers/scsi/st.c
parent56dd2c0691a5a387b7b05835fe547dc6fade9407 (diff)
[SCSI] st: add MTWEOFI to write filemarks without flushing drive buffer
This patch adds a new MTIOCTOP operation MTWEOFI that writes filemarks with immediate bit set. This means that the drive does not flush its buffer and the next file can be started immediately. This speeds up writing in applications that have to write multiple small files. Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 24211d0efa6d..9e2c3a72ff4d 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -9,7 +9,7 @@
9 Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky, 9 Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky,
10 Michael Schaefer, J"org Weule, and Eric Youngdale. 10 Michael Schaefer, J"org Weule, and Eric Youngdale.
11 11
12 Copyright 1992 - 2008 Kai Makisara 12 Copyright 1992 - 2010 Kai Makisara
13 email Kai.Makisara@kolumbus.fi 13 email Kai.Makisara@kolumbus.fi
14 14
15 Some small formal changes - aeb, 950809 15 Some small formal changes - aeb, 950809
@@ -17,7 +17,7 @@
17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support 17 Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
18 */ 18 */
19 19
20static const char *verstr = "20081215"; 20static const char *verstr = "20100829";
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23 23
@@ -2696,18 +2696,21 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
2696 } 2696 }
2697 break; 2697 break;
2698 case MTWEOF: 2698 case MTWEOF:
2699 case MTWEOFI:
2699 case MTWSM: 2700 case MTWSM:
2700 if (STp->write_prot) 2701 if (STp->write_prot)
2701 return (-EACCES); 2702 return (-EACCES);
2702 cmd[0] = WRITE_FILEMARKS; 2703 cmd[0] = WRITE_FILEMARKS;
2703 if (cmd_in == MTWSM) 2704 if (cmd_in == MTWSM)
2704 cmd[1] = 2; 2705 cmd[1] = 2;
2706 if (cmd_in == MTWEOFI)
2707 cmd[1] |= 1;
2705 cmd[2] = (arg >> 16); 2708 cmd[2] = (arg >> 16);
2706 cmd[3] = (arg >> 8); 2709 cmd[3] = (arg >> 8);
2707 cmd[4] = arg; 2710 cmd[4] = arg;
2708 timeout = STp->device->request_queue->rq_timeout; 2711 timeout = STp->device->request_queue->rq_timeout;
2709 DEBC( 2712 DEBC(
2710 if (cmd_in == MTWEOF) 2713 if (cmd_in != MTWSM)
2711 printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name, 2714 printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name,
2712 cmd[2] * 65536 + cmd[3] * 256 + cmd[4]); 2715 cmd[2] * 65536 + cmd[3] * 256 + cmd[4]);
2713 else 2716 else
@@ -2883,8 +2886,8 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
2883 else if (chg_eof) 2886 else if (chg_eof)
2884 STps->eof = ST_NOEOF; 2887 STps->eof = ST_NOEOF;
2885 2888
2886 if (cmd_in == MTWEOF) 2889 if (cmd_in == MTWEOF || cmd_in == MTWEOFI)
2887 STps->rw = ST_IDLE; 2890 STps->rw = ST_IDLE; /* prevent automatic WEOF at close */
2888 } else { /* SCSI command was not completely successful. Don't return 2891 } else { /* SCSI command was not completely successful. Don't return
2889 from this block without releasing the SCSI command block! */ 2892 from this block without releasing the SCSI command block! */
2890 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat; 2893 struct st_cmdstatus *cmdstatp = &STp->buffer->cmdstat;
@@ -2901,7 +2904,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
2901 else 2904 else
2902 undone = 0; 2905 undone = 0;
2903 2906
2904 if (cmd_in == MTWEOF && 2907 if ((cmd_in == MTWEOF || cmd_in == MTWEOFI) &&
2905 cmdstatp->have_sense && 2908 cmdstatp->have_sense &&
2906 (cmdstatp->flags & SENSE_EOM)) { 2909 (cmdstatp->flags & SENSE_EOM)) {
2907 if (cmdstatp->sense_hdr.sense_key == NO_SENSE || 2910 if (cmdstatp->sense_hdr.sense_key == NO_SENSE ||