From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@suse.de>,
Alan Stern <stern@rowland.harvard.edu>,
Mike Christie <michaelc@cs.wisc.edu>,
Hannes Reinecke <hare@suse.de>, linux-scsi <linux-scsi@vger.k>
Subject: [PATCH 2/3] scsi_lib: Remove that __scsi_release_buffers contraption
Date: Mon, 04 Jan 2010 14:15:08 +0200 [thread overview]
Message-ID: <4B41DBCC.5030101@panasas.com> (raw)
In-Reply-To: <4B41DADD.4000102@panasas.com>
Remove "do_bidi_check" by checking and nullifying cmd->request
when blk_end_* indicates the request is no longer valid.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
drivers/scsi/scsi_lib.c | 41 +++++++++++++++++------------------------
1 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 05f988a..8d8b4eb 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -512,8 +512,6 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
scsi_run_queue(sdev->request_queue);
}
-static void __scsi_release_buffers(struct scsi_cmnd *, int);
-
/*
* Function: scsi_end_request()
*
@@ -564,11 +562,12 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,
}
}
+ cmd->request = NULL;
/*
* This will goose the queue request function at the end, so we don't
* need to worry about launching another command.
*/
- __scsi_release_buffers(cmd, 0);
+ scsi_release_buffers(cmd);
scsi_next_command(cmd);
return NULL;
}
@@ -624,26 +623,6 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb)
__sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free);
}
-static void __scsi_release_buffers(struct scsi_cmnd *cmd, int do_bidi_check)
-{
-
- if (cmd->sdb.table.nents)
- scsi_free_sgtable(&cmd->sdb);
-
- memset(&cmd->sdb, 0, sizeof(cmd->sdb));
-
- if (do_bidi_check && scsi_bidi_cmnd(cmd)) {
- struct scsi_data_buffer *bidi_sdb =
- cmd->request->next_rq->special;
- scsi_free_sgtable(bidi_sdb);
- kmem_cache_free(scsi_sdb_cache, bidi_sdb);
- cmd->request->next_rq->special = NULL;
- }
-
- if (scsi_prot_sg_count(cmd))
- scsi_free_sgtable(cmd->prot_sdb);
-}
-
/*
* Function: scsi_release_buffers()
*
@@ -663,7 +642,21 @@ static void __scsi_release_buffers(struct scsi_cmnd *cmd, int do_bidi_check)
*/
void scsi_release_buffers(struct scsi_cmnd *cmd)
{
- __scsi_release_buffers(cmd, 1);
+ if (cmd->sdb.table.nents)
+ scsi_free_sgtable(&cmd->sdb);
+
+ memset(&cmd->sdb, 0, sizeof(cmd->sdb));
+
+ if (cmd->request && scsi_bidi_cmnd(cmd)) {
+ struct scsi_data_buffer *bidi_sdb =
+ cmd->request->next_rq->special;
+ scsi_free_sgtable(bidi_sdb);
+ kmem_cache_free(scsi_sdb_cache, bidi_sdb);
+ cmd->request->next_rq->special = NULL;
+ }
+
+ if (scsi_prot_sg_count(cmd))
+ scsi_free_sgtable(cmd->prot_sdb);
}
EXPORT_SYMBOL(scsi_release_buffers);
--
1.6.6
next prev parent reply other threads:[~2010-01-04 12:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-04 12:11 [PATCHSET 0/3] little bit of love to scsi_io_completion Boaz Harrosh
2010-01-04 12:13 ` [PATCH 1/3] scsi_lib: request_queue is only needed inside scsi_requeue_command Boaz Harrosh
2010-01-04 12:15 ` Boaz Harrosh [this message]
2010-01-04 12:17 ` [PATCH 3/3] scsi_lib: Collapse scsi_end_request into only user Boaz Harrosh
2010-01-04 13:23 ` Matthew Wilcox
2010-01-04 13:56 ` Boaz Harrosh
2010-01-04 14:07 ` [PATCH 3/3 version 2] " Boaz Harrosh
2010-01-04 14:12 ` Boaz Harrosh
2010-01-04 18:23 ` Alan Stern
2010-01-05 7:27 ` Boaz Harrosh
2010-01-05 7:53 ` [PATCH 3/3 version 3] " Boaz Harrosh
2010-01-05 8:49 ` Boaz Harrosh
2010-01-05 9:07 ` [PATCH 3/3 version 4] " Boaz Harrosh
2010-01-05 15:20 ` Alan Stern
2010-01-05 16:23 ` Boaz Harrosh
2010-01-05 16:33 ` Alan Stern
-- strict thread matches above, loose matches on Subject: below --
2010-11-08 15:02 [PATCH 0/3] scsi_lib: Some love to scsi_lib Boaz Harrosh
2010-11-08 15:11 ` [PATCH 2/3] scsi_lib: Remove that __scsi_release_buffers contraption Boaz Harrosh
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=4B41DBCC.5030101@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@suse.de \
--cc=hare@suse.de \
--cc=linux-scsi@vger.k \
--cc=michaelc@cs.wisc.edu \
--cc=stern@rowland.harvard.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