public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ide-scsi + sg scatterlist fixup
@ 2002-02-07  9:16 Jens Axboe
  2002-02-07  9:30 ` Zwane Mwaikambo
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2002-02-07  9:16 UTC (permalink / raw)
  To: Linux Kernel

Hi,

Following is a patch to make ide-scsi and sg work again. Of course
people can just bk pull the latest changes by now...

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.224   -> 1.225  
#	drivers/scsi/ide-scsi.c	1.15    -> 1.16   
#	   drivers/scsi/sg.c	1.12    -> 1.13   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/02/07	axboe@burns.home.kernel.dk	1.225
# scatterlist address fixup
# --------------------------------------------
#
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	Thu Feb  7 10:14:35 2002
+++ b/drivers/scsi/ide-scsi.c	Thu Feb  7 10:14:35 2002
@@ -130,6 +130,7 @@
 static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
 {
 	int count;
+	char *buf;
 
 	while (bcount) {
 		if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
@@ -138,7 +139,8 @@
 			return;
 		}
 		count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
-		atapi_input_bytes (drive, pc->sg->address + pc->b_count, count);
+		buf = page_address(pc->sg->page) + pc->sg->offset;
+		atapi_input_bytes (drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -150,6 +152,7 @@
 static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
 {
 	int count;
+	char *buf;
 
 	while (bcount) {
 		if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
@@ -158,7 +161,8 @@
 			return;
 		}
 		count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
-		atapi_output_bytes (drive, pc->sg->address + pc->b_count, count);
+		buf = page_address(pc->sg->page) + pc->sg->offset;
+		atapi_output_bytes (drive, buf + pc->b_count, count);
 		bcount -= count; pc->b_count += count;
 		if (pc->b_count == pc->sg->length) {
 			pc->sg++;
@@ -750,25 +754,11 @@
 		printk ("ide-scsi: %s: building DMA table, %d segments, %dkB total\n", drive->name, segments, pc->request_transfer >> 10);
 #endif /* IDESCSI_DEBUG_LOG */
 		while (segments--) {
-			struct page *page = sg->page;
-			int offset = sg->offset;
-
-			if (!page) {
-				BUG_ON(!sg->address);
-				page = virt_to_page(sg->address);
-				offset = (unsigned long) sg->address & ~PAGE_MASK;
-			}
-				
-			bh->bi_io_vec[0].bv_page = page;
+			bh->bi_io_vec[0].bv_page = sg->page;
 			bh->bi_io_vec[0].bv_len = sg->length;
-			bh->bi_io_vec[0].bv_offset = offset;
+			bh->bi_io_vec[0].bv_offset = sg->offset;
 			bh->bi_size = sg->length;
 			bh = bh->bi_next;
-			/*
-			 * just until scsi_merge is fixed up...
-			 */
-			BUG_ON(PageHighMem(page));
-			sg->address = page_address(page) + offset;
 			sg++;
 		}
 	} else {
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Thu Feb  7 10:14:35 2002
+++ b/drivers/scsi/sg.c	Thu Feb  7 10:14:35 2002
@@ -76,8 +76,6 @@
 #include <linux/version.h>
 #endif /* LINUX_VERSION_CODE */
 
-#define SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
-
 #define SG_ALLOW_DIO_DEF 0
 #define SG_ALLOW_DIO_CODE	/* compile out be commenting this define */
 #ifdef SG_ALLOW_DIO_CODE
@@ -1714,9 +1712,6 @@
 						rem_sz;
 	sclp->page = kp->maplist[k];
 	sclp->offset = offset;
-#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
-	sclp->address = page_address(kp->maplist[k]) + offset;
-#endif
 	sclp->length = num;
 	mem_src_arr[k] = SG_USER_MEM;
 	rem_sz -= num;
@@ -1804,9 +1799,6 @@
             }
             sclp->page = virt_to_page(p);
             sclp->offset = (unsigned long)p & ~PAGE_MASK;
-#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
-            sclp->address = p;
-#endif
             sclp->length = ret_sz;
 	    mem_src_arr[k] = mem_src;
 
@@ -1967,9 +1959,6 @@
             sg_free(sg_scatg2virt(sclp), sclp->length, mem_src);
 	    sclp->page = NULL;
             sclp->offset = 0;
-#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
-	    sclp->address = 0;
-#endif
             sclp->length = 0;
         }
 	sg_free(schp->buffer, schp->sglist_len, schp->buffer_mem_src);

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ide-scsi + sg scatterlist fixup
  2002-02-07  9:16 [PATCH] ide-scsi + sg scatterlist fixup Jens Axboe
@ 2002-02-07  9:30 ` Zwane Mwaikambo
  2002-02-07  9:39   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Zwane Mwaikambo @ 2002-02-07  9:30 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Linux Kernel

On Thu, 7 Feb 2002, Jens Axboe wrote:

> Following is a patch to make ide-scsi and sg work again. Of course
> people can just bk pull the latest changes by now...

Would this patch allow the box to recover somewhat after an idiot (namely 
me) does an hdparm -w /dev/hdX on srY?

Regards,
	Zwane Mwaikambo



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ide-scsi + sg scatterlist fixup
  2002-02-07  9:30 ` Zwane Mwaikambo
@ 2002-02-07  9:39   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2002-02-07  9:39 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linux Kernel

On Thu, Feb 07 2002, Zwane Mwaikambo wrote:
> On Thu, 7 Feb 2002, Jens Axboe wrote:
> 
> > Following is a patch to make ide-scsi and sg work again. Of course
> > people can just bk pull the latest changes by now...
> 
> Would this patch allow the box to recover somewhat after an idiot (namely 
> me) does an hdparm -w /dev/hdX on srY?

It shouldn't have any effect on that, no. I've yet to closely read your
report on this...

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-07  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-07  9:16 [PATCH] ide-scsi + sg scatterlist fixup Jens Axboe
2002-02-07  9:30 ` Zwane Mwaikambo
2002-02-07  9:39   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox