From: Benny Halevy <bhalevy@panasas.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>, bharrosh@panasas.com
Cc: James.Bottomley@SteelEye.com, akpm@linux-foundation.org,
linux-scsi@vger.kernel.org
Subject: Re: [RFC 7/8] sd.c and sr.c move to scsi_sgtable implementation
Date: Sun, 29 Jul 2007 11:21:56 +0300 [thread overview]
Message-ID: <46AC4E24.7040803@panasas.com> (raw)
In-Reply-To: <20070726212135X.fujita.tomonori@lab.ntt.co.jp>
FUJITA Tomonori wrote:
> From: Boaz Harrosh <bharrosh@panasas.com>
> Subject: [RFC 7/8] sd.c and sr.c move to scsi_sgtable implementation
> Date: Thu, 05 Jul 2007 16:44:04 +0300
>
>> - sd and sr would adjust IO size to align on device's block
>> size. So code needs to change once we move to scsi_sgtable
>> implementation. (Not compatible with un-converted drivers)
>> - Convert code to use scsi_for_each_sg
>> - Use Data accessors wherever is appropriate.
>>
>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>> ---
>> drivers/scsi/sd.c | 10 ++++------
>> drivers/scsi/sr.c | 27 ++++++++++++---------------
>> 2 files changed, 16 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
>> index 448d316..459fd23 100644
>> --- a/drivers/scsi/sd.c
>> +++ b/drivers/scsi/sd.c
>> @@ -338,7 +338,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
>> struct request *rq = SCpnt->request;
>> struct gendisk *disk = rq->rq_disk;
>> sector_t block = rq->sector;
>> - unsigned int this_count = SCpnt->request_bufflen >> 9;
>> + unsigned int this_count = scsi_bufflen(SCpnt) >> 9;
>> unsigned int timeout = sdp->timeout;
>>
>> SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt,
>> @@ -418,9 +418,6 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
>> } else if (rq_data_dir(rq) == READ) {
>> SCpnt->cmnd[0] = READ_6;
>> SCpnt->sc_data_direction = DMA_FROM_DEVICE;
>> - } else {
>> - scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", rq->cmd_flags);
>> - return 0;
>> }
>
> Why?
This seems to be dead code as rq_data_dir can only be either READ or WRITE.
The else case could be a BUG() but I don't see why it should be handled
gracefully.
>
>
>> SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
>> @@ -480,7 +477,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
>> SCpnt->cmnd[4] = (unsigned char) this_count;
>> SCpnt->cmnd[5] = 0;
>> }
>> - SCpnt->request_bufflen = this_count * sdp->sector_size;
>> + BUG_ON(!SCpnt->sgtable);
>> + SCpnt->sgtable->length = this_count * sdp->sector_size;
>>
>> /*
>> * We shouldn't disconnect in the middle of a sector, so with a dumb
>> @@ -892,7 +890,7 @@ static struct block_device_operations sd_fops = {
>> static void sd_rw_intr(struct scsi_cmnd * SCpnt)
>> {
>> int result = SCpnt->result;
>> - unsigned int xfer_size = SCpnt->request_bufflen;
>> + unsigned int xfer_size = scsi_bufflen(SCpnt);
>> unsigned int good_bytes = result ? 0 : xfer_size;
>> u64 start_lba = SCpnt->request->sector;
>> u64 bad_lba;
>> diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
>> index f9a52af..ed61ca9 100644
>> --- a/drivers/scsi/sr.c
>> +++ b/drivers/scsi/sr.c
>> @@ -218,7 +218,7 @@ int sr_media_change(struct cdrom_device_info *cdi, int slot)
>> static void rw_intr(struct scsi_cmnd * SCpnt)
>> {
>> int result = SCpnt->result;
>> - int this_count = SCpnt->request_bufflen;
>> + int this_count = scsi_bufflen(SCpnt);
>> int good_bytes = (result == 0 ? this_count : 0);
>> int block_sectors = 0;
>> long error_sector;
>> @@ -345,23 +345,20 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
>> } else if (rq_data_dir(SCpnt->request) == READ) {
>> SCpnt->cmnd[0] = READ_10;
>> SCpnt->sc_data_direction = DMA_FROM_DEVICE;
>> - } else {
>> - blk_dump_rq_flags(SCpnt->request, "Unknown sr command");
>> - return 0;
>> }
>
> ditto.
ditto :)
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2007-07-29 8:22 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 ` [RFC 6/8] scsi_error.c move to scsi_sgtable implementation Boaz Harrosh
2007-07-05 13:44 ` [RFC 7/8] sd.c and sr.c " Boaz Harrosh
2007-07-26 12:21 ` FUJITA Tomonori
2007-07-29 8:21 ` Benny Halevy [this message]
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=46AC4E24.7040803@panasas.com \
--to=bhalevy@panasas.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@linux-foundation.org \
--cc=bharrosh@panasas.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).