* [PATCH 1/2] SCSI tape: fix buffer position in partial write
@ 2008-05-04 19:13 Kai Makisara
2008-05-04 19:28 ` Kai Makisara
0 siblings, 1 reply; 2+ messages in thread
From: Kai Makisara @ 2008-05-04 19:13 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
Move buffer pointer back when data could not be written. Bug found by Mike Christie.
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
---
The patch is against 2.6.26-rc1.
drivers/scsi/st.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.26-rc1-q/drivers/scsi/st.c
===================================================================
--- linux-2.6.26-rc1-q.orig/drivers/scsi/st.c
+++ linux-2.6.26-rc1-q/drivers/scsi/st.c
@@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
*/
-static const char *verstr = "20080224";
+static const char *verstr = "20080504";
#include <linux/module.h>
@@ -1663,6 +1663,7 @@ st_write(struct file *filp, const char _
if (undone <= do_count) {
/* Only data from this write is not written */
count += undone;
+ b_point -= undone;
do_count -= undone;
if (STp->block_size)
blks = (transfer - undone) / STp->block_size;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] SCSI tape: fix buffer position in partial write
2008-05-04 19:13 [PATCH 1/2] SCSI tape: fix buffer position in partial write Kai Makisara
@ 2008-05-04 19:28 ` Kai Makisara
0 siblings, 0 replies; 2+ messages in thread
From: Kai Makisara @ 2008-05-04 19:28 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
Mike Christie noticed a bogus memset. It can be removed as dead code since the
number of bytes in the driver buffer in fixed block mode is always a multiple
of the tape block size.
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
---
The patch is against 2.6.26-rc1.
drivers/scsi/st.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Index: linux-2.6.26-rc1-q/drivers/scsi/st.c
===================================================================
--- linux-2.6.26-rc1-q.orig/drivers/scsi/st.c
+++ linux-2.6.26-rc1-q/drivers/scsi/st.c
@@ -630,7 +630,7 @@ static int cross_eof(struct scsi_tape *
/* Flush the write buffer (never need to write if variable blocksize). */
static int st_flush_write_buffer(struct scsi_tape * STp)
{
- int offset, transfer, blks;
+ int transfer, blks;
int result;
unsigned char cmd[MAX_COMMAND_SIZE];
struct st_request *SRpnt;
@@ -643,14 +643,10 @@ static int st_flush_write_buffer(struct
result = 0;
if (STp->dirty == 1) {
- offset = (STp->buffer)->buffer_bytes;
- transfer = ((offset + STp->block_size - 1) /
- STp->block_size) * STp->block_size;
+ transfer = STp->buffer->buffer_bytes;
DEBC(printk(ST_DEB_MSG "%s: Flushing %d bytes.\n",
tape_name(STp), transfer));
- memset((STp->buffer)->b_data + offset, 0, transfer - offset);
-
memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = WRITE_6;
cmd[1] = 1;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-04 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-04 19:13 [PATCH 1/2] SCSI tape: fix buffer position in partial write Kai Makisara
2008-05-04 19:28 ` Kai Makisara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox