From: Tejun Heo <htejun@gmail.com>
To: James.Bottomley@steeleye.com, axboe@suse.de
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH scsi-misc-2.6 01/08] scsi: remove unused bounce-buffer release path
Date: Wed, 23 Mar 2005 11:14:24 +0900 (KST) [thread overview]
Message-ID: <20050323021335.F07B64D9@htj.dyndns.org> (raw)
In-Reply-To: <20050323021335.960F95F8@htj.dyndns.org>
01_scsi_remove_scsi_release_buffers.patch
Buffer bouncing hasn't been done inside the scsi midlayer for
quite sometime now, but bounce-buffer release paths are still
around. This patch removes these unused paths.
Signed-off-by: Tejun Heo <htejun@gmail.com>
scsi_lib.c | 60 +++++-------------------------------------------------------
1 files changed, 5 insertions(+), 55 deletions(-)
Index: scsi-export/drivers/scsi/scsi_lib.c
===================================================================
--- scsi-export.orig/drivers/scsi/scsi_lib.c 2005-03-23 09:39:36.000000000 +0900
+++ scsi-export/drivers/scsi/scsi_lib.c 2005-03-23 09:40:09.000000000 +0900
@@ -622,45 +622,6 @@ static void scsi_free_sgtable(struct sca
}
/*
- * Function: scsi_release_buffers()
- *
- * Purpose: Completion processing for block device I/O requests.
- *
- * Arguments: cmd - command that we are bailing.
- *
- * Lock status: Assumed that no lock is held upon entry.
- *
- * Returns: Nothing
- *
- * Notes: In the event that an upper level driver rejects a
- * command, we must release resources allocated during
- * the __init_io() function. Primarily this would involve
- * the scatter-gather table, and potentially any bounce
- * buffers.
- */
-static void scsi_release_buffers(struct scsi_cmnd *cmd)
-{
- struct request *req = cmd->request;
-
- /*
- * Free up any indirection buffers we allocated for DMA purposes.
- */
- if (cmd->use_sg)
- scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len);
- else if (cmd->request_buffer != req->buffer)
- kfree(cmd->request_buffer);
-
- /*
- * Zero these out. They now point to freed memory, and it is
- * dangerous to hang onto the pointers.
- */
- cmd->buffer = NULL;
- cmd->bufflen = 0;
- cmd->request_buffer = NULL;
- cmd->request_bufflen = 0;
-}
-
-/*
* Function: scsi_io_completion()
*
* Purpose: Completion processing for block device I/O requests.
@@ -703,22 +664,8 @@ void scsi_io_completion(struct scsi_cmnd
if (blk_complete_barrier_rq(q, req, good_bytes >> 9))
return;
- /*
- * Free up any indirection buffers we allocated for DMA purposes.
- * For the case of a READ, we need to copy the data out of the
- * bounce buffer and into the real buffer.
- */
if (cmd->use_sg)
scsi_free_sgtable(cmd->buffer, cmd->sglist_len);
- else if (cmd->buffer != req->buffer) {
- if (rq_data_dir(req) == READ) {
- unsigned long flags;
- char *to = bio_kmap_irq(req->bio, &flags);
- memcpy(to, cmd->buffer, cmd->bufflen);
- bio_kunmap_irq(to, &flags);
- }
- kfree(cmd->buffer);
- }
if (result) {
sense_valid = scsi_command_normalize_sense(cmd, &sshdr);
@@ -963,7 +910,8 @@ static int scsi_init_io(struct scsi_cmnd
req->current_nr_sectors);
/* release the command and kill it */
- scsi_release_buffers(cmd);
+ if (cmd->use_sg)
+ scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len);
scsi_put_command(cmd);
return BLKPREP_KILL;
}
@@ -1140,7 +1088,9 @@ static int scsi_prep_fn(struct request_q
*/
drv = *(struct scsi_driver **)req->rq_disk->private_data;
if (unlikely(!drv->init_command(cmd))) {
- scsi_release_buffers(cmd);
+ if (cmd->use_sg)
+ scsi_free_sgtable(cmd->request_buffer,
+ cmd->sglist_len);
scsi_put_command(cmd);
return BLKPREP_KILL;
}
next prev parent reply other threads:[~2005-03-23 2:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-23 2:14 [PATCH scsi-misc-2.6 00/08] scsi: small fixes & cleanups Tejun Heo
2005-03-23 2:14 ` Tejun Heo [this message]
2005-03-23 4:07 ` [PATCH scsi-misc-2.6 01/08] scsi: remove unused bounce-buffer release path James Bottomley
2005-03-23 6:08 ` Tejun Heo
2005-03-23 15:27 ` Jens Axboe
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 02/08] scsi: don't use blk_insert_request() for requeueing Tejun Heo
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 03/08] scsi: remove unused scsi_cmnd->internal_timeout field Tejun Heo
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 04/08] scsi: remove meaningless volatile qualifiers from structure definitions Tejun Heo
2005-03-23 4:15 ` James Bottomley
2005-03-23 4:22 ` Jeff Garzik
2005-03-23 5:28 ` Tejun Heo
2005-03-23 15:16 ` James Bottomley
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 05/08] scsi: remove a timer race from scsi_queue_insert() and cleanup timer Tejun Heo
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 06/08] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field Tejun Heo
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 07/08] scsi: remove bogus {get|put}_device() calls Tejun Heo
2005-03-23 4:15 ` James Bottomley
2005-03-23 9:13 ` Tejun Heo
2005-03-29 17:02 ` Patrick Mansfield
2005-03-23 2:14 ` [PATCH scsi-misc-2.6 08/08] scsi: fix hot unplug sequence Tejun Heo
2005-03-23 4:08 ` James Bottomley
2005-03-23 4:50 ` Tejun Heo
2005-03-23 7:19 ` Jens Axboe
2005-03-23 15:20 ` James Bottomley
2005-03-23 15:25 ` Jens Axboe
2005-03-25 0:45 ` James Bottomley
2005-03-25 3:15 ` Tejun Heo
2005-03-25 5:02 ` James Bottomley
2005-03-25 5:38 ` Tejun Heo
2005-03-25 19:19 ` James Bottomley
2005-03-25 21:43 ` Tejun Heo
2005-03-25 22:49 ` James Bottomley
2005-03-26 7:27 ` Kai Makisara
2005-03-26 14:48 ` James Bottomley
2005-03-23 15:12 ` James Bottomley
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=20050323021335.F07B64D9@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=James.Bottomley@steeleye.com \
--cc=axboe@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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
all inboxes | Powered by JetHome®