Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Kai Makisara <Kai.Makisara@kolumbus.fi>
To: linux-scsi@vger.kernel.org
Cc: Mike Christie <michaelc@cs.wisc.edu>
Subject: Re: [PATCH 1/2] SCSI tape: fix buffer position in partial write
Date: Sun, 4 May 2008 22:28:58 +0300 (EEST)	[thread overview]
Message-ID: <alpine.LSU.1.10.0805042228200.5805@kai.makisara.local> (raw)
In-Reply-To: <alpine.LSU.1.10.0805042211490.5805@kai.makisara.local>

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;

      reply	other threads:[~2008-05-04 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.1.10.0805042228200.5805@kai.makisara.local \
    --to=kai.makisara@kolumbus.fi \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox