From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Andrew Morton <akpm@linux-foundation.org>,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: [RFC 6/8] scsi_error.c move to scsi_sgtable implementation
Date: Thu, 05 Jul 2007 16:43:57 +0300 [thread overview]
Message-ID: <468CF59D.7050608@panasas.com> (raw)
In-Reply-To: <468CDB3C.4060500@panasas.com>
- Careful considerations in scsi_send_eh_cmnd. Everything
is kept on the stack as before.
- This code is backward compatible with unconverted drivers.
Compatibility will be removed in last patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
drivers/scsi/scsi_error.c | 46 ++++++++++++++++++++++++++------------------
1 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9adb64a..1105011 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -613,13 +613,10 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
DECLARE_COMPLETION_ONSTACK(done);
unsigned long timeleft;
unsigned long flags;
- struct scatterlist sgl;
unsigned char old_cmnd[MAX_COMMAND_SIZE];
enum dma_data_direction old_data_direction;
- unsigned short old_use_sg;
unsigned char old_cmd_len;
- unsigned old_bufflen;
- void *old_buffer;
+ struct scsi_sgtable *old_sgtable;
int rtn;
/*
@@ -629,31 +626,39 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
* we will need to restore these values prior to running the actual
* command.
*/
- old_buffer = scmd->request_buffer;
- old_bufflen = scmd->request_bufflen;
+ old_sgtable = scmd->sgtable;
memcpy(old_cmnd, scmd->cmnd, sizeof(scmd->cmnd));
old_data_direction = scmd->sc_data_direction;
old_cmd_len = scmd->cmd_len;
- old_use_sg = scmd->use_sg;
memset(scmd->cmnd, 0, sizeof(scmd->cmnd));
memcpy(scmd->cmnd, cmnd, cmnd_size);
if (copy_sense) {
- sg_init_one(&sgl, scmd->sense_buffer,
+ struct {
+ struct scsi_sgtable sgtable;
+ struct scatterlist sgl;
+ } new_sgtable;
+
+ sg_init_one(new_sgtable.sgtable.sglist, scmd->sense_buffer,
sizeof(scmd->sense_buffer));
scmd->sc_data_direction = DMA_FROM_DEVICE;
- scmd->request_bufflen = sgl.length;
- scmd->request_buffer = &sgl;
- scmd->use_sg = 1;
+ new_sgtable.sgtable.length = new_sgtable.sgtable.sglist[0].length;
+ new_sgtable.sgtable.resid = 0;
+ new_sgtable.sgtable.sg_count = 1;
+ new_sgtable.sgtable.sg_pool = -1; /* invalid */
+ scmd->sgtable = &new_sgtable.sgtable;
} else {
- scmd->request_buffer = NULL;
- scmd->request_bufflen = 0;
scmd->sc_data_direction = DMA_NONE;
- scmd->use_sg = 0;
+ scmd->sgtable = NULL;
}
+ /*FIXME: make code backward compatible with old system */
+ cmd->request_buffer = scsi_sglist(scmd);
+ cmd->request_bufflen = scsi_bufflen(scmd);
+ cmd->use_sg = scsi_sg_count(scmd);
+
scmd->underflow = 0;
scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]);
@@ -714,13 +719,17 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
/*
* Restore original data
*/
- scmd->request_buffer = old_buffer;
- scmd->request_bufflen = old_bufflen;
+ scmd->sgtable = old_sgtable;
memcpy(scmd->cmnd, old_cmnd, sizeof(scmd->cmnd));
scmd->sc_data_direction = old_data_direction;
scmd->cmd_len = old_cmd_len;
- scmd->use_sg = old_use_sg;
scmd->result = old_result;
+
+ /*FIXME: make code backward compatible with old system */
+ cmd->request_buffer = scsi_sglist(scmd);
+ cmd->request_bufflen = scsi_bufflen(scmd);
+ cmd->use_sg = scsi_sg_count(scmd);
+
return rtn;
}
@@ -1673,8 +1682,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
scmd->scsi_done = scsi_reset_provider_done_command;
scmd->done = NULL;
- scmd->request_buffer = NULL;
- scmd->request_bufflen = 0;
+ scmd->sgtable = NULL;
scmd->cmd_len = 0;
--
1.5.2.2.249.g45fd
next prev parent reply other threads:[~2007-07-05 13:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-05 11:51 [RFC 0/7] scsi_sgtable implementation Boaz Harrosh
2007-07-05 13:43 ` [RFC 1/8] stex driver BROKEN Boaz Harrosh
2007-07-05 19:12 ` Lin Yu
2007-07-05 13:43 ` [RFC 2/8] Restrict scsi accessors access to read-only Boaz Harrosh
2007-07-05 13:43 ` [RFC 3/8] libata-scsi don't set max_phys_segments higher than scsi-ml Boaz Harrosh
2007-07-05 13:43 ` [RFC 4/8] scsi-ml: scsi_sgtable implementation Boaz Harrosh
2007-07-12 14:43 ` Boaz Harrosh
2007-07-12 19:09 ` Mike Christie
2007-07-13 0:15 ` FUJITA Tomonori
2007-07-18 14:13 ` Boaz Harrosh
2007-07-18 14:19 ` Jens Axboe
2007-07-18 15:00 ` Boaz Harrosh
2007-07-18 18:03 ` Jens Axboe
2007-07-18 19:21 ` Benny Halevy
2007-07-18 20:17 ` Jens Axboe
2007-07-23 14:08 ` [PATCH] sgtable over sglist (Re: [RFC 4/8] scsi-ml: scsi_sgtable implementation) FUJITA Tomonori
2007-07-25 19:53 ` Boaz Harrosh
2007-07-12 22:37 ` [RFC 4/8] scsi-ml: scsi_sgtable implementation FUJITA Tomonori
2007-07-05 13:43 ` [RFC 5/8] Remove old code from scsi_lib.c Boaz Harrosh
2007-07-05 13:43 ` Boaz Harrosh [this message]
2007-07-05 13:44 ` [RFC 7/8] sd.c and sr.c move to scsi_sgtable implementation Boaz Harrosh
2007-07-26 12:21 ` FUJITA Tomonori
2007-07-29 8:21 ` Benny Halevy
2007-07-05 13:44 ` [RFC 8/8] Remove compatibility with unconverted drivers 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=468CF59D.7050608@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.