[OpenFCoE] [PATCH] Add a missing spin_unlock() found when a BLS frame was mis-delivered.

2007-11-30 Thread Joe Eykholt
Add a missing spin_unlock() found when a BLS frame was mis-delivered.

---
 drivers/scsi/ofc/openfc/openfc_scsi.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c 
b/drivers/scsi/ofc/openfc/openfc_scsi.c
index 86e6895..5fa0ad6 100644
--- a/drivers/scsi/ofc/openfc/openfc_scsi.c
+++ b/drivers/scsi/ofc/openfc/openfc_scsi.c
@@ -548,6 +548,8 @@ void openfc_scsi_abort_iocontext(struct fc_scsi_pkt *fsp)
fsp-status_code = OPENFC_ERROR;
fsp-io_status = (SUGGEST_RETRY  24);
(*fsp-done) (fsp);
+   } else {
+   spin_unlock(qp-scsi_pkt_lock);
}
 }

--
1.5.3.6
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OpenFCoE] [PATCH] (user) Change the default FCoE protocol version to the T11 standard-track one.

2007-11-30 Thread Joe Eykholt
Change the default FCoE protocol version to the T11 standard-track one.

The old version can still be selected using 'fcconf ethX fcoe_version old'.
---
 usr/ofc/tools/fcconf/src/fcc_adapt.c |1 +
 usr/ofc/tools/fcconf/src/fcc_eth.c   |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/usr/ofc/tools/fcconf/src/fcc_adapt.c 
b/usr/ofc/tools/fcconf/src/fcc_adapt.c
index eca2d1d..e0fae76 100644
--- a/usr/ofc/tools/fcconf/src/fcc_adapt.c
+++ b/usr/ofc/tools/fcconf/src/fcc_adapt.c
@@ -335,6 +335,7 @@ fcc_adapt_hba_get(void)
 snprintf(pp-fp_name, sizeof (pp-fp_name), %s,
   pp-fp_attr.OSDeviceName);
 pp-fp_fcoe = 1;
+pp-fp_fcoe_t11 = 1;
 } else {
 if (strstr(ap-fa_attr.Manufacturer, QLogic) != NULL) {
 pp-fp_fid_alt_format = 1;
diff --git a/usr/ofc/tools/fcconf/src/fcc_eth.c 
b/usr/ofc/tools/fcconf/src/fcc_eth.c
index f1d4bf9..863a4ba 100644
--- a/usr/ofc/tools/fcconf/src/fcc_eth.c
+++ b/usr/ofc/tools/fcconf/src/fcc_eth.c
@@ -231,6 +231,7 @@ fcc_eth_init_dev(struct dirent *dp, void *arg)
 }

 pp-fp_fcoe = 1;
+pp-fp_fcoe_t11 = 1;
 snprintf(ap-fa_attr.Model, sizeof (ap-fa_attr.Model),
   %s, FCC_FCOE_ADAPT_MODEL);
 ap-fa_attr.NodeWWN = pp-fp_attr.NodeWWN;
--
1.5.3.6
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/28] blk_end_request: changing block layer core (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts core parts of block layer to use blk_end_request().

'dequeue' argument was originally introduced for end_dequeued_request(),
where no attempt should be made to dequeue the request as it's already
dequeued.
However, it's not necessary as it can be checked with
list_empty(rq-queuelist).
(Dequeued request has empty list and queued request doesn't.)

As a result of this patch, end_queued_request() and
end_dequeued_request() become identical.  Later patch will merge
and rename them and change users of those functions.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 block/ll_rw_blk.c |   25 ++---
 1 files changed, 10 insertions(+), 15 deletions(-)

Index: 2.6.24-rc3-mm2/block/ll_rw_blk.c
===
--- 2.6.24-rc3-mm2.orig/block/ll_rw_blk.c
+++ 2.6.24-rc3-mm2/block/ll_rw_blk.c
@@ -368,8 +368,8 @@ void blk_ordered_complete_seq(struct req
q-ordseq = 0;
rq = q-orig_bar_rq;
 
-   end_that_request_first(rq, uptodate, rq-hard_nr_sectors);
-   end_that_request_last(rq, uptodate);
+   if (__blk_end_request(rq, uptodate, blk_rq_bytes(rq)))
+   BUG();
 }
 
 static void pre_flush_end_io(struct request *rq, int error)
@@ -486,9 +486,9 @@ int blk_do_ordered(struct request_queue 
 * ORDERED_NONE while this request is on it.
 */
blkdev_dequeue_request(rq);
-   end_that_request_first(rq, -EOPNOTSUPP,
-  rq-hard_nr_sectors);
-   end_that_request_last(rq, -EOPNOTSUPP);
+   if (__blk_end_request(rq, -EOPNOTSUPP,
+ blk_rq_bytes(rq)))
+   BUG();
*rqp = NULL;
return 0;
}
@@ -3691,14 +3691,9 @@ void end_that_request_last(struct reques
 EXPORT_SYMBOL(end_that_request_last);
 
 static inline void __end_request(struct request *rq, int uptodate,
-unsigned int nr_bytes, int dequeue)
+unsigned int nr_bytes)
 {
-   if (!end_that_request_chunk(rq, uptodate, nr_bytes)) {
-   if (dequeue)
-   blkdev_dequeue_request(rq);
-   add_disk_randomness(rq-rq_disk);
-   end_that_request_last(rq, uptodate);
-   }
+   __blk_end_request(rq, uptodate, nr_bytes);
 }
 
 /**
@@ -3741,7 +3736,7 @@ EXPORT_SYMBOL_GPL(blk_rq_cur_bytes);
  **/
 void end_queued_request(struct request *rq, int uptodate)
 {
-   __end_request(rq, uptodate, blk_rq_bytes(rq), 1);
+   __end_request(rq, uptodate, blk_rq_bytes(rq));
 }
 EXPORT_SYMBOL(end_queued_request);
 
@@ -3758,7 +3753,7 @@ EXPORT_SYMBOL(end_queued_request);
  **/
 void end_dequeued_request(struct request *rq, int uptodate)
 {
-   __end_request(rq, uptodate, blk_rq_bytes(rq), 0);
+   __end_request(rq, uptodate, blk_rq_bytes(rq));
 }
 EXPORT_SYMBOL(end_dequeued_request);
 
@@ -3784,7 +3779,7 @@ EXPORT_SYMBOL(end_dequeued_request);
  **/
 void end_request(struct request *req, int uptodate)
 {
-   __end_request(req, uptodate, req-hard_cur_sectors  9, 1);
+   __end_request(req, uptodate, req-hard_cur_sectors  9);
 }
 EXPORT_SYMBOL(end_request);
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 26/28] blk_end_request: changing ide-cd (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts ide-cd (cdrom_newpc_intr()) to use blk_end_request().

ide-cd (cdrom_newpc_intr()) has some tricky behaviors below which
need to use blk_end_request_callback().
Needs to:
  1. call post_transform_command() to modify request contents
  2. wait completing request until DRQ_STAT is cleared
after end_that_request_first() and before end_that_request_last().

As for the second one, ide-cd will wait for the interrupt from device.
So blk_end_request_callback() has to return without completing request
even if no leftover in the request.
ide-cd uses a dummy callback function, which just returns value '1',
to tell blk_end_request_callback() about that.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |   78 +++
 1 files changed, 61 insertions(+), 17 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/ide/ide-cd.c
===
--- 2.6.24-rc3-mm2.orig/drivers/ide/ide-cd.c
+++ 2.6.24-rc3-mm2/drivers/ide/ide-cd.c
@@ -1669,6 +1669,37 @@ static void post_transform_command(struc
}
 }
 
+/*
+ * Called from blk_end_request_callback() after the data of the request
+ * is completed and before the request is completed.
+ */
+static int cdrom_newpc_intr_dma_cb(struct request *rq)
+{
+   ide_drive_t *drive = rq-q-queuedata;
+   spinlock_t *ide_lock = rq-q-queue_lock;
+   unsigned long flags = 0UL;
+
+   rq-data_len = 0;
+   post_transform_command(rq);
+
+   spin_lock_irqsave(ide_lock, flags);
+   HWGROUP(drive)-rq = NULL;
+   spin_unlock_irqrestore(ide_lock, flags);
+
+   return 0;
+}
+
+/*
+ * Called from blk_end_request_callback() after the data of the request
+ * is completed and before the request is completed.
+ * By returning value '1', blk_end_request_callback() returns immediately
+ * without completing the request.
+ */
+static int cdrom_newpc_intr_dummy_cb(struct request *rq)
+{
+   return 1;
+}
+
 typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
 
 /*
@@ -1707,9 +1738,16 @@ static ide_startstop_t cdrom_newpc_intr(
return ide_error(drive, dma error, stat);
}
 
-   end_that_request_chunk(rq, 1, rq-data_len);
-   rq-data_len = 0;
-   goto end_request;
+   /*
+* post_transform_command() needs to be called after
+* the data of the request is completed, since it may
+* modify the data area of the request.
+* So use the callback special feature of blk_end_request().
+*/
+   if (blk_end_request_callback(rq, 1, rq-data_len,
+cdrom_newpc_intr_dma_cb))
+   BUG();
+   return ide_stopped;
}
 
/*
@@ -1727,8 +1765,18 @@ static ide_startstop_t cdrom_newpc_intr(
/*
 * If DRQ is clear, the command has completed.
 */
-   if ((stat  DRQ_STAT) == 0)
-   goto end_request;
+   if ((stat  DRQ_STAT) == 0) {
+   if (!rq-data_len)
+   post_transform_command(rq);
+
+   spin_lock_irqsave(ide_lock, flags);
+   if (__blk_end_request(rq, 1, 0))
+   BUG();
+   HWGROUP(drive)-rq = NULL;
+   spin_unlock_irqrestore(ide_lock, flags);
+
+   return ide_stopped;
+   }
 
/*
 * check which way to transfer data
@@ -1781,7 +1829,14 @@ static ide_startstop_t cdrom_newpc_intr(
rq-data_len -= blen;
 
if (rq-bio)
-   end_that_request_chunk(rq, 1, blen);
+   /*
+* The request can't be completed until DRQ is cleared.
+* So complete the data, but don't complete the request
+* using the dummy function for the callback feature
+* of blk_end_request().
+*/
+   blk_end_request_callback(rq, 1, blen,
+cdrom_newpc_intr_dummy_cb);
else
rq-data += blen;
}
@@ -1802,17 +1857,6 @@ static ide_startstop_t cdrom_newpc_intr(
 
ide_set_handler(drive, cdrom_newpc_intr, rq-timeout, NULL);
return ide_started;
-
-end_request:
-   if (!rq-data_len)
-   post_transform_command(rq);
-
-   spin_lock_irqsave(ide_lock, flags);
-   blkdev_dequeue_request(rq);
-   end_that_request_last(rq, 1);
-   HWGROUP(drive)-rq = NULL;
-   spin_unlock_irqrestore(ide_lock, flags);
-   return ide_stopped;
 }
 
 static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL 

[PATCH 22/28] blk_end_request: changing cciss (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts cciss to use blk_end_request().

cciss is a little bit different from normal drivers.
cciss directly calls bio_endio() and disk_stat_add()
when completing request.  But those can be replaced with
__end_that_request_first().
After the replacement, request completion procedures of
those drivers become like the following:
o end_that_request_first()
o add_disk_randomness()
o end_that_request_last()
This can be converted to blk_end_request() by following
the rule (a) mentioned in the patch subject
[PATCH 01/28] blk_end_request: add new request completion interface.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/cciss.c |   25 +++--
 1 files changed, 3 insertions(+), 22 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/cciss.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/cciss.c
+++ 2.6.24-rc3-mm2/drivers/block/cciss.c
@@ -1187,17 +1187,6 @@ static int cciss_ioctl(struct inode *ino
}
 }
 
-static inline void complete_buffers(struct bio *bio, int status)
-{
-   while (bio) {
-   struct bio *xbh = bio-bi_next;
-
-   bio-bi_next = NULL;
-   bio_endio(bio, status ? 0 : -EIO);
-   bio = xbh;
-   }
-}
-
 static void cciss_check_queues(ctlr_info_t *h)
 {
int start_queue = h-next_to_run;
@@ -1263,21 +1252,14 @@ static void cciss_softirq_done(struct re
pci_unmap_page(h-pdev, temp64.val, cmd-SG[i].Len, ddir);
}
 
-   complete_buffers(rq-bio, (rq-errors == 0));
-
-   if (blk_fs_request(rq)) {
-   const int rw = rq_data_dir(rq);
-
-   disk_stat_add(rq-rq_disk, sectors[rw], rq-nr_sectors);
-   }
-
 #ifdef CCISS_DEBUG
printk(Done with %p\n, rq);
 #endif /* CCISS_DEBUG */
 
-   add_disk_randomness(rq-rq_disk);
+   if (blk_end_request(rq, (rq-errors == 0), blk_rq_bytes(rq)))
+   BUG();
+
spin_lock_irqsave(h-lock, flags);
-   end_that_request_last(rq, (rq-errors == 0));
cmd_free(h, cmd, 1);
cciss_check_queues(h);
spin_unlock_irqrestore(h-lock, flags);
@@ -2544,7 +2526,6 @@ after_error_processing:
}
cmd-rq-data_len = 0;
cmd-rq-completion_data = cmd;
-   blk_add_trace_rq(cmd-rq-q, cmd-rq, BLK_TA_COMPLETE);
blk_complete_request(cmd-rq);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/28] blk_end_request: changing ide-scsi (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts ide-scsi to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/scsi/ide-scsi.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/scsi/ide-scsi.c
===
--- 2.6.24-rc3-mm2.orig/drivers/scsi/ide-scsi.c
+++ 2.6.24-rc3-mm2/drivers/scsi/ide-scsi.c
@@ -918,8 +918,8 @@ static int idescsi_eh_reset (struct scsi
}
 
/* kill current request */
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, 0);
+   if (__blk_end_request(req, 0, 0))
+   BUG();
if (blk_sense_request(req))
kfree(scsi-pc-buffer);
kfree(scsi-pc);
@@ -928,8 +928,8 @@ static int idescsi_eh_reset (struct scsi
 
/* now nuke the drive queue */
while ((req = elv_next_request(drive-queue))) {
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, 0);
+   if (__blk_end_request(req, 0, 0))
+   BUG();
}
 
HWGROUP(drive)-rq = NULL;
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/28] blk_end_request: changing scsi (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts scsi mid-layer to use blk_end_request().

The comment above scsi_next_command() is not related to this change.
It had originally been there before scsi_next_command() was included
in scsi_finalize_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/scsi/scsi_lib.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c
===
--- 2.6.24-rc3-mm2.orig/drivers/scsi/scsi_lib.c
+++ 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c
@@ -683,7 +683,7 @@ static struct scsi_cmnd *scsi_end_reques
 * If there are blocks left over at the end, set up the command
 * to queue the remainder of them.
 */
-   if (end_that_request_chunk(req, uptodate, bytes)) {
+   if (blk_end_request(req, uptodate, bytes)) {
int leftover = (req-hard_nr_sectors  9);
 
if (blk_pc_request(req))
@@ -691,7 +691,7 @@ static struct scsi_cmnd *scsi_end_reques
 
/* kill remainder if no retrys */
if (!uptodate  blk_noretry_request(req))
-   end_that_request_chunk(req, 0, leftover);
+   blk_end_request(req, 0, leftover);
else {
if (requeue) {
/*
@@ -706,7 +706,11 @@ static struct scsi_cmnd *scsi_end_reques
}
}
 
-   scsi_finalize_request(cmd, uptodate);
+   /*
+* This will goose the queue request function at the end, so we don't
+* need to worry about launching another command.
+*/
+   scsi_next_command(cmd);
return NULL;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/28] blk_end_request: changing ub (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts ub to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/ub.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/ub.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/ub.c
+++ 2.6.24-rc3-mm2/drivers/block/ub.c
@@ -816,8 +816,8 @@ static void ub_end_rq(struct request *rq
uptodate = 0;
rq-errors = scsi_status;
}
-   end_that_request_first(rq, uptodate, rq-hard_nr_sectors);
-   end_that_request_last(rq, uptodate);
+   if (__blk_end_request(rq, uptodate, blk_rq_bytes(rq)))
+   BUG();
 }
 
 static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/28] blk_end_request: changing nbd (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts nbd to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/nbd.c |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/nbd.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/nbd.c
+++ 2.6.24-rc3-mm2/drivers/block/nbd.c
@@ -108,9 +108,7 @@ static void nbd_end_request(struct reque
req, uptodate? done: failed);
 
spin_lock_irqsave(q-queue_lock, flags);
-   if (!end_that_request_first(req, uptodate, req-nr_sectors)) {
-   end_that_request_last(req, uptodate);
-   }
+   __blk_end_request(req, uptodate, req-nr_sectors  9);
spin_unlock_irqrestore(q-queue_lock, flags);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/28] blk_end_request: changing um (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts um to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 arch/um/drivers/ubd_kern.c |   10 +-
 1 files changed, 1 insertion(+), 9 deletions(-)

Index: 2.6.24-rc3-mm2/arch/um/drivers/ubd_kern.c
===
--- 2.6.24-rc3-mm2.orig/arch/um/drivers/ubd_kern.c
+++ 2.6.24-rc3-mm2/arch/um/drivers/ubd_kern.c
@@ -481,15 +481,7 @@ int thread_fd = -1;
 
 static void ubd_end_request(struct request *req, int bytes, int uptodate)
 {
-   if (!end_that_request_first(req, uptodate, bytes  9)) {
-   struct ubd *dev = req-rq_disk-private_data;
-   unsigned long flags;
-
-   add_disk_randomness(req-rq_disk);
-   spin_lock_irqsave(dev-lock, flags);
-   end_that_request_last(req, uptodate);
-   spin_unlock_irqrestore(dev-lock, flags);
-   }
+   blk_end_request(req, uptodate, bytes);
 }
 
 /* Callable only from interrupt context - otherwise you need to do
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/28] blk_end_request: changing cpqarray (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts cpqarray to use blk_end_request().

cpqarray is a little bit different from normal drivers.
cpqarray directly calls bio_endio() and disk_stat_add()
when completing request.  But those can be replaced with
__end_that_request_first().
After the replacement, request completion procedures of
those drivers become like the following:
o end_that_request_first()
o add_disk_randomness()
o end_that_request_last()
This can be converted to blk_end_request() by following
the rule (b) mentioned in the patch subject
[PATCH 01/28] blk_end_request: add new request completion interface.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/cpqarray.c |   27 ++-
 1 files changed, 2 insertions(+), 25 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/cpqarray.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/cpqarray.c
+++ 2.6.24-rc3-mm2/drivers/block/cpqarray.c
@@ -167,7 +167,6 @@ static void start_io(ctlr_info_t *h);
 
 static inline void addQ(cmdlist_t **Qptr, cmdlist_t *c);
 static inline cmdlist_t *removeQ(cmdlist_t **Qptr, cmdlist_t *c);
-static inline void complete_buffers(struct bio *bio, int ok);
 static inline void complete_command(cmdlist_t *cmd, int timeout);
 
 static irqreturn_t do_ida_intr(int irq, void *dev_id);
@@ -980,19 +979,6 @@ static void start_io(ctlr_info_t *h)
}
 }
 
-static inline void complete_buffers(struct bio *bio, int ok)
-{
-   struct bio *xbh;
-
-   while (bio) {
-   xbh = bio-bi_next;
-   bio-bi_next = NULL;
-   
-   bio_endio(bio, ok ? 0 : -EIO);
-
-   bio = xbh;
-   }
-}
 /*
  * Mark all buffers that cmd was responsible for
  */
@@ -1030,18 +1016,9 @@ static inline void complete_command(cmdl
 pci_unmap_page(hba[cmd-ctlr]-pci_dev, cmd-req.sg[i].addr,
cmd-req.sg[i].size, ddir);
 
-   complete_buffers(rq-bio, ok);
-
-   if (blk_fs_request(rq)) {
-   const int rw = rq_data_dir(rq);
-
-   disk_stat_add(rq-rq_disk, sectors[rw], rq-nr_sectors);
-   }
-
-   add_disk_randomness(rq-rq_disk);
-
DBGPX(printk(Done with %p\n, rq););
-   end_that_request_last(rq, ok ? 1 : -EIO);
+   if (__blk_end_request(rq, ok, blk_rq_bytes(rq)))
+   BUG();
 }
 
 /*
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/28] blk_end_request: changing i2o_block (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts i2o_block to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/message/i2o/i2o_block.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/message/i2o/i2o_block.c
===
--- 2.6.24-rc3-mm2.orig/drivers/message/i2o/i2o_block.c
+++ 2.6.24-rc3-mm2/drivers/message/i2o/i2o_block.c
@@ -426,22 +426,18 @@ static void i2o_block_end_request(struct
struct request_queue *q = req-q;
unsigned long flags;
 
-   if (end_that_request_chunk(req, uptodate, nr_bytes)) {
+   if (blk_end_request(req, uptodate, nr_bytes)) {
int leftover = (req-hard_nr_sectors  KERNEL_SECTOR_SHIFT);
 
if (blk_pc_request(req))
leftover = req-data_len;
 
if (end_io_error(uptodate))
-   end_that_request_chunk(req, 0, leftover);
+   blk_end_request(req, 0, leftover);
}
 
-   add_disk_randomness(req-rq_disk);
-
spin_lock_irqsave(q-queue_lock, flags);
 
-   end_that_request_last(req, uptodate);
-
if (likely(dev)) {
dev-open_queue_depth--;
list_del(ireq-queue);
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/28] blk_end_request: changing ps3disk (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts ps3disk to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/ps3disk.c |6 +-
 1 files changed, 1 insertion(+), 5 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/ps3disk.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/ps3disk.c
+++ 2.6.24-rc3-mm2/drivers/block/ps3disk.c
@@ -280,11 +280,7 @@ static irqreturn_t ps3disk_interrupt(int
}
 
spin_lock(priv-lock);
-   if (!end_that_request_first(req, uptodate, num_sectors)) {
-   add_disk_randomness(req-rq_disk);
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, uptodate);
-   }
+   __blk_end_request(req, uptodate, num_sectors  9);
priv-req = NULL;
ps3disk_do_request(dev, priv-queue);
spin_unlock(priv-lock);
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/28] blk_end_request: full I/O completion handler (take 3)

2007-11-30 Thread Kiyoshi Ueda
Hello Jens,

The following is the updated patch-set for blk_end_request().
Changes since the last version are only minor updates to catch up
with the base kernel changes.
Do you agree the implementation of blk_end_request()?
If there's no problem, could you merge it to your tree?
Or does it have to be merged to -mm tree first?


Boaz,
Could you review the newly added PATCH 27 which converts the bidi part,
and give me your comments?
It uses blk_end_request_callback() in PATCH 25, which was only for
the tricky ide-cd driver.
If bidi added a 'resid' member to struct request instead of reusing
'data_len' for the other purpose, it could use the standard
blk_end_request() instead.

-- Changes from the previous post -
Changes between take2 and take3:
  o Rebased on top of 2.6.24-rc3-mm2
  o Added a bidi patch, which changes bidi to use blk_end_request()
(PATCH 27)
  o Dropped blk_rq_size() which was to get size of entire request
because rq_byte_size() has been added to ll_rw_blk.c (PATCH 02)
  o Removed 'dequeue' argument, which was added in 2.6.23-rc7-mm1,
from __end_request() (PATCH 03)
  o Removed lguest patch because lguest has been changed not to use
end_that_request_{chunk/last} directly.

Changes between take1 and take2:
  o Rebased on top of 2.6.23-rc4-mm1
  o Don't pass the lock held information (PATCH 01)
  o Removed sect2byte() macro (PATCH 02)
  o fixed blk_rq_size() and blk_rq_cur_size() for blk_pc_requests (PATCH 02)
  o Separated the patch for changes of end_that_request_* user (PATCH 03-26)
  o Removed the patch which changes the role of rq-end_io()
from this patch-set because some more discussions are needed
about it.
---


Summary of each patch are below:
  01/28: add new request completion interface, blk_end_request()
  02/28: add some functions to get the size of request in bytes
  03/28: convert to use blk_end_request() (core parts of block layer)
  04/28: convert to use blk_end_request() (arm)
  05/28: convert to use blk_end_request() (um)
  06/28: convert to use blk_end_request() (DAC960)
  07/28: convert to use blk_end_request() (floppy)
  08/28: convert to use blk_end_request() (nbd)
  09/28: convert to use blk_end_request() (ps3disk)
  10/28: convert to use blk_end_request() (sunvdc)
  11/28: convert to use blk_end_request() (sx8)
  12/28: convert to use blk_end_request() (ub)
  13/28: convert to use blk_end_request() (viodasd)
  14/28: convert to use blk_end_request() (xen-blkfront)
  15/28: convert to use blk_end_request() (viocd)
  16/28: convert to use blk_end_request() (i2o_block)
  17/28: convert to use blk_end_request() (mmc)
  18/28: convert to use blk_end_request() (s390)
  19/28: convert to use blk_end_request() (scsi mid-layer)
  20/28: convert to use blk_end_request() (ide-scsi)
  21/28: convert to use blk_end_request() (xsysace)
  22/28: convert to use blk_end_request() (cciss)
  23/28: convert to use blk_end_request() (cpqarray)
  24/28: convert to use blk_end_request() (normal parts of ide)
  25/28: add a valiant of blk_end_request() having callback feature
  26/28: convert to use blk_end_request() (ide-cd, cdrom_newpc_intr())
  27/28: convert to use blk_end_request() (scsi bidi)
  28/28: remove/unexport no longer needed end_that_request_*

I have tested this patch-set on two machines,
IA64+QLA1280+QLA2200 box and x86_64+SATA+IDE-CDROM box.


Below is the explanation about needs and details of this patch-set.

SUMMARY
===
This set of patches changes request completion interface
between device drivers and block layer to 1 step procedure
from current 2 step procedures using end_that_request_{first/chunk}
and end_that_request_last().

This patch-set prepares for realizing another patch-set which changes
the role of rq-end_io().  It allows request-based multipath to hook
in before completing each chunk of request, check errors for it and
retry it using another path if error is detected.


BACKGROUND
==
The patch-set which changes the role of rq-end_io() is necessary
to allow device stacking at request level, that is request-based
device-mapper multipath.
Currently, device-mapper is implemented as a stacking block device
at BIO level.  OTOH, request-based dm will stack at request level
to allow better multipathing decision.
To allow device stacking at request level, the completion procedure
need to provide a hook for it.
For example, dm-multipath has to check errors and retry with other
paths if necessary before returning the I/O result to upper layer.
struct request has 'end_io' hook currently.  But it's called at
the very late stage of completion handling where the I/O result
is already returned to the upper layer.
So we need something here.

The first approach to hook in completion of each chunk of request
was adding a new rq-end_io_first() hook and calling it on the top
of __end_that_request_first().
  - 

Re: [BUG] 2.6.23-rc3 can't see sd partitions on Alpha

2007-11-30 Thread Andrew Morton
On Sat, 01 Dec 2007 11:30:01 +1300
Michael Cree [EMAIL PROTECTED] wrote:

 Bob Tracy wrote:
  Andrew Morton wrote:
  Could be something change in sysfs.  Please double-check the config
  options, make sure that something important didn't get disabled.
 
   Here's
  hoping someone else is seeing this or can replicate it in the meantime.
 
 Snap.
 
 2.6.24-rc2 works fine.   2.6.24-rc3 boots on Alpha but once /dev is 
 populated no partitions of the scsi sub-system are seen.  Looks like ide 
 sub-system similarly affected.

Rafael, I assume you have this regression in the list?

 Managed to get boot log.  Follows below (with output of various /proc info).
 
 Cheerz
 Michael.
 
 
 Linux version 2.6.24-rc3 ([EMAIL PROTECTED]) (gcc version 4.1.3 20071019 
 (prerelease) (Debian 4.1.2-17)) #1 Mon Nov 26 19:28:58 NZDT 2007
 Booting on Tsunami variation Monet using machine vector Monet from SRM
 Major Options: EV67 LEGACY_START VERBOSE_MCHECK
 Command line: ro root=/dev/sda3 console=ttyS0
 memcluster 0, usage 1, start0, end  215
 memcluster 1, usage 0, start  215, end   131062
 memcluster 2, usage 1, start   131062, end   131072
 freeing pages 215:384
 freeing pages 930:131062
 reserving pages 930:932
 4096K Bcache detected; load hit latency 21 cycles, load miss latency 127 
 cycles
 Console graphics on hose 0
 Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130167
 Kernel command line: ro root=/dev/sda3 console=ttyS0
 PID hash table entries: 4096 (order: 12, 32768 bytes)
 Using epoch = 2000
 Turning on RTC interrupts.
 Console: colour VGA+ 80x25
 console [ttyS0] enabled
 Dentry cache hash table entries: 131072 (order: 7, 1048576 bytes)
 Inode-cache hash table entries: 65536 (order: 6, 524288 bytes)
 Memory: 1030896k/1048496k available (2786k kernel code, 15216k reserved, 
 370k data, 168k init)
 Mount-cache hash table entries: 512
 net_namespace: 120 bytes
 NET: Registered protocol family 16
 PCI: Bridge: 0001:01:08.0
IO window: 8000-8fff
MEM window: 0900-090f
PREFETCH window: disabled.
 SMC37c669 Super I/O Controller found @ 0x3f0
 Linux Plug and Play Support v0.97 (c) Adam Belay
 SCSI subsystem initialized
 NET: Registered protocol family 2
 IP route cache hash table entries: 8192 (order: 3, 65536 bytes)
 TCP established hash table entries: 32768 (order: 6, 524288 bytes)
 TCP bind hash table entries: 32768 (order: 5, 262144 bytes)
 TCP: Hash tables configured (established 32768 bind 32768)
 TCP reno registered
 srm_env: version 0.0.6 loaded successfully
 io scheduler noop registered
 io scheduler cfq registered (default)
 tridentfb: Trident framebuffer 0.7.8-NEWAPI initializing
 isapnp: Scanning for PnP cards...
 isapnp: No Plug  Play device found
 rtc: SRM (post-2000) epoch (2000) detected
 Real Time Clock Driver v1.12ac
 Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
 serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
 serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
 Floppy drive(s): fd0 is 2.88M
 FDC 0 is a post-1991 82077
 Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
 CY82C693: IDE controller (0x1080:0xc693 rev 0x00) at  PCI slot :00:07.1
 CY82C693: not 100% native mode: will probe irqs later
 CY82C693U driver v0.34 99-13-12 Andreas S. Krebs ([EMAIL PROTECTED])
  ide0: BM-DMA at 0x8400-0x8407, BIOS settings: hda:pio, hdb:pio
 CY82C693: port 0x01f0 already claimed by ide0
 ALI15X3: IDE controller (0x10b9:0x5228 rev 0xc6) at  PCI slot 0001:02:09.1
 ALI15X3: 100% native mode on irq 28
  ide1: BM-DMA at 0x28410-0x28417, BIOS settings: hdc:DMA, 
 hdd:DMA
  ide2: BM-DMA at 0x28418-0x2841f, BIOS settings: hde:pio, 
 hdf:pio
 hdf: LITE-ON DVDRW SOHW-1653S, ATAPI CD/DVD-ROM drive
 hde: ST3200822A, ATA DISK drive
 ide2 at 0x28438-0x2843f,0x2844e on irq 28
 hde: max request size: 512KiB
 hde: 390721968 sectors (200049 MB) w/8192KiB Cache, CHS=24321/255/63, 
 UDMA(100)
 hde: cache flushes supported
   hde: hde1
 qla1280: QLA1040 found on PCI bus 1, dev 6
 scsi(0:0): Resetting SCSI BUS
 scsi0 : QLogic QLA1040 PCI to SCSI Host Adapter
 Firmware version:  7.65.06, Driver version 3.26
 serio: i8042 KBD port at 0x60,0x64 irq 1
 serio: i8042 AUX port at 0x60,0x64 irq 12
 mice: PS/2 mouse device common for all mice
 scsi 0:0:1:0: Direct-Access SEAGATE  ST336706LW   0109 PQ: 0 ANSI: 3
 scsi(0:0:1:0): Sync: period 10, offset 12, Wide
 input: AT Raw Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
 atkbd.c: keyboard reset failed on isa0060/serio1
 TCP cubic registered
 Initializing XFRM netlink socket
 NET: Registered protocol family 1
 NET: Registered protocol family 17
 NET: Registered protocol family 15
 scsi: waiting for bus probes to complete ...
 sd 0:0:1:0: [sda] 71687370 512-byte hardware sectors (36704 MB)
 sd 0:0:1:0: [sda] Write Protect is off
 sd 0:0:1:0: [sda] Write 

[OpenFCoE] [PATCH] (user-level) Don't deliver BLS frames to the fast path.

2007-11-30 Thread Joe Eykholt
Don't deliver BLS frames to the fast path.

---
 usr/common/libfc/src/fc/fc_local_port.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/usr/common/libfc/src/fc/fc_local_port.c 
b/usr/common/libfc/src/fc/fc_local_port.c
index ba909d0..a798765 100644
--- a/usr/common/libfc/src/fc/fc_local_port.c
+++ b/usr/common/libfc/src/fc/fc_local_port.c
@@ -1611,7 +1611,8 @@ void fc_local_port_recv(struct fc_local_port *lp, struct 
fc_frame *fp)
/* fall through */
case FC_EOF_N:
mp = lp-fl_vf-vf_exch_mgr;
-   if ((f_ctl  (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX) {
+   if ((f_ctl  (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX 
+   fh-fh_type != FC_TYPE_BLS) {
fc_exch_recv_seq_resp(mp, fp);
} else if (f_ctl  FC_FC_SEQ_CTX) {
fc_exch_recv_resp(mp, fp);
--
1.5.3.6
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OpenFCoE] [PATCH] Don't deliver BLS frames to the fast path.

2007-11-30 Thread Joe Eykholt
Don't deliver BLS frames to the fast path.

---
 drivers/scsi/ofc/libfc/fc_local_port.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/ofc/libfc/fc_local_port.c 
b/drivers/scsi/ofc/libfc/fc_local_port.c
index 55de5d3..66a1d47 100644
--- a/drivers/scsi/ofc/libfc/fc_local_port.c
+++ b/drivers/scsi/ofc/libfc/fc_local_port.c
@@ -1607,7 +1607,8 @@ void fc_local_port_recv(struct fc_local_port *lp, struct 
fc_frame *fp)
/* fall through */
case FC_EOF_N:
mp = lp-fl_vf-vf_exch_mgr;
-   if ((f_ctl  (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX) {
+   if ((f_ctl  (FC_FC_EX_CTX | FC_FC_SEQ_CTX)) == FC_FC_EX_CTX 
+   fh-fh_type != FC_TYPE_BLS) {
fc_exch_recv_seq_resp(mp, fp);
} else if (f_ctl  FC_FC_SEQ_CTX) {
fc_exch_recv_resp(mp, fp);
--
1.5.3.6

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 28/28] blk_end_request: remove/unexport end_that_request_* (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch removes the following functions:
  o end_that_request_first()
  o end_that_request_chunk()
and stops exporting the functions below:
  o end_that_request_last()

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 block/ll_rw_blk.c  |   61 -
 include/linux/blkdev.h |   15 
 2 files changed, 21 insertions(+), 55 deletions(-)

Index: 2.6.24-rc3-mm2/block/ll_rw_blk.c
===
--- 2.6.24-rc3-mm2.orig/block/ll_rw_blk.c
+++ 2.6.24-rc3-mm2/block/ll_rw_blk.c
@@ -3415,6 +3415,20 @@ static void blk_recalc_rq_sectors(struct
}
 }
 
+/**
+ * __end_that_request_first - end I/O on a request
+ * @req:  the request being processed
+ * @uptodate: 1 for success, 0 for I/O error,  0 for specific error
+ * @nr_bytes: number of bytes to complete
+ *
+ * Description:
+ * Ends I/O on a number of bytes attached to @req, and sets it up
+ * for the next range of segments (if any) in the cluster.
+ *
+ * Return:
+ * 0 - we are done with this request, call end_that_request_last()
+ * 1 - still buffers pending for this request
+ **/
 static int __end_that_request_first(struct request *req, int uptodate,
int nr_bytes)
 {
@@ -3531,49 +3545,6 @@ static int __end_that_request_first(stru
return 1;
 }
 
-/**
- * end_that_request_first - end I/O on a request
- * @req:  the request being processed
- * @uptodate: 1 for success, 0 for I/O error,  0 for specific error
- * @nr_sectors: number of sectors to end I/O on
- *
- * Description:
- * Ends I/O on a number of sectors attached to @req, and sets it up
- * for the next range of segments (if any) in the cluster.
- *
- * Return:
- * 0 - we are done with this request, call end_that_request_last()
- * 1 - still buffers pending for this request
- **/
-int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
-{
-   return __end_that_request_first(req, uptodate, nr_sectors  9);
-}
-
-EXPORT_SYMBOL(end_that_request_first);
-
-/**
- * end_that_request_chunk - end I/O on a request
- * @req:  the request being processed
- * @uptodate: 1 for success, 0 for I/O error,  0 for specific error
- * @nr_bytes: number of bytes to complete
- *
- * Description:
- * Ends I/O on a number of bytes attached to @req, and sets it up
- * for the next range of segments (if any). Like end_that_request_first(),
- * but deals with bytes instead of sectors.
- *
- * Return:
- * 0 - we are done with this request, call end_that_request_last()
- * 1 - still buffers pending for this request
- **/
-int end_that_request_chunk(struct request *req, int uptodate, int nr_bytes)
-{
-   return __end_that_request_first(req, uptodate, nr_bytes);
-}
-
-EXPORT_SYMBOL(end_that_request_chunk);
-
 /*
  * splice the completion data to a local structure and hand off to
  * process_completion_queue() to complete the requests
@@ -3653,7 +3624,7 @@ EXPORT_SYMBOL(blk_complete_request);
 /*
  * queue lock must be held
  */
-void end_that_request_last(struct request *req, int uptodate)
+static void end_that_request_last(struct request *req, int uptodate)
 {
struct gendisk *disk = req-rq_disk;
int error;
@@ -3688,8 +3659,6 @@ void end_that_request_last(struct reques
__blk_put_request(req-q, req);
 }
 
-EXPORT_SYMBOL(end_that_request_last);
-
 static inline void __end_request(struct request *rq, int uptodate,
 unsigned int nr_bytes)
 {
Index: 2.6.24-rc3-mm2/include/linux/blkdev.h
===
--- 2.6.24-rc3-mm2.orig/include/linux/blkdev.h
+++ 2.6.24-rc3-mm2/include/linux/blkdev.h
@@ -717,19 +717,16 @@ static inline void blk_run_address_space
 }
 
 /*
- * end_request() and friends. Must be called with the request queue spinlock
- * acquired. All functions called within end_request() _must_be_ atomic.
+ * blk_end_request() and friends.
+ * __blk_end_request() and end_request() must be called with
+ * the request queue spinlock acquired.
  *
  * Several drivers define their own end_request and call
- * end_that_request_first() and end_that_request_last()
- * for parts of the original function. This prevents
- * code duplication in drivers.
+ * blk_end_request() for parts of the original function.
+ * This prevents code duplication in drivers.
  */
 extern int blk_end_request(struct request *rq, int uptodate, int nr_bytes);
 extern int __blk_end_request(struct request *rq, int uptodate, int nr_bytes);
-extern int end_that_request_first(struct request *, int, int);
-extern int end_that_request_chunk(struct request *, int, int);
-extern void end_that_request_last(struct request *, int);
 extern void end_request(struct request *, int);
 extern void end_queued_request(struct request *, int);
 extern void 

[PATCH 21/28] blk_end_request: changing xsysace (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts xsysace to use blk_end_request().

xsysace is a little bit different from normal drivers.
xsysace driver has a state machine in it.
It calls end_that_request_first() and end_that_request_last()
from different states. (ACE_FSM_STATE_REQ_TRANSFER and
ACE_FSM_STATE_REQ_COMPLETE, respectively.)

However, those states are consecutive and without any interruption
inbetween.
So we can just follow the standard conversion rule (b) mentioned in
the patch subject [PATCH 01/27] blk_end_request: add new request
completion interface.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/xsysace.c |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/xsysace.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/xsysace.c
+++ 2.6.24-rc3-mm2/drivers/block/xsysace.c
@@ -703,7 +703,7 @@ static void ace_fsm_dostate(struct ace_d
 
/* bio finished; is there another one? */
i = ace-req-current_nr_sectors;
-   if (end_that_request_first(ace-req, 1, i)) {
+   if (__blk_end_request(ace-req, 1, i)) {
/* dev_dbg(ace-dev, next block; h=%li c=%i\n,
 *  ace-req-hard_nr_sectors,
 *  ace-req-current_nr_sectors);
@@ -718,9 +718,6 @@ static void ace_fsm_dostate(struct ace_d
break;
 
case ACE_FSM_STATE_REQ_COMPLETE:
-   /* Complete the block request */
-   blkdev_dequeue_request(ace-req);
-   end_that_request_last(ace-req, 1);
ace-req = NULL;
 
/* Finished request; go to idle state */
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/28] blk_end_request: changing viocd (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts viocd to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/cdrom/viocd.c |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/cdrom/viocd.c
===
--- 2.6.24-rc3-mm2.orig/drivers/cdrom/viocd.c
+++ 2.6.24-rc3-mm2/drivers/cdrom/viocd.c
@@ -302,11 +302,8 @@ static void viocd_end_request(struct req
if (!nsectors)
nsectors = 1;
 
-   if (end_that_request_first(req, uptodate, nsectors))
+   if (__blk_end_request(req, uptodate, nsectors  9))
BUG();
-   add_disk_randomness(req-rq_disk);
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, uptodate);
 }
 
 static int rwreq;
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/28] blk_end_request: changing sx8 (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts sx8 to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/sx8.c |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/sx8.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/sx8.c
+++ 2.6.24-rc3-mm2/drivers/block/sx8.c
@@ -749,11 +749,9 @@ static inline void carm_end_request_queu
struct request *req = crq-rq;
int rc;
 
-   rc = end_that_request_first(req, uptodate, req-hard_nr_sectors);
+   rc = __blk_end_request(req, uptodate, blk_rq_bytes(req));
assert(rc == 0);
 
-   end_that_request_last(req, uptodate);
-
rc = carm_put_request(host, crq);
assert(rc == 0);
 }
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.23-rc3 can't see sd partitions on Alpha

2007-11-30 Thread Rafael J. Wysocki
On Friday, 30 of November 2007, Andrew Morton wrote:
 On Sat, 01 Dec 2007 11:30:01 +1300
 Michael Cree [EMAIL PROTECTED] wrote:
 
  Bob Tracy wrote:
   Andrew Morton wrote:
   Could be something change in sysfs.  Please double-check the config
   options, make sure that something important didn't get disabled.
  
Here's
   hoping someone else is seeing this or can replicate it in the meantime.
  
  Snap.
  
  2.6.24-rc2 works fine.   2.6.24-rc3 boots on Alpha but once /dev is 
  populated no partitions of the scsi sub-system are seen.  Looks like ide 
  sub-system similarly affected.
 
 Rafael, I assume you have this regression in the list?

Yes, http://bugzilla.kernel.org/show_bug.cgi?id=9457
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OpenFCoE] [PATCH] (user-libfc) Change the default FCoE protocol version to the T11 (Aug. 2007) version.

2007-11-30 Thread Joe Eykholt
Change the default FCoE protocol version to the T11 (Aug. 2007) version.

Use environment to override:  export FCOE_OLD_ALL=1 to use the old protocol
on all interfaces, or FCOE_OLD_eth0=1 to use it on eth0.
---
 usr/common/libfc/src/encaps/fcoe.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/usr/common/libfc/src/encaps/fcoe.c 
b/usr/common/libfc/src/encaps/fcoe.c
index 017e41e..4a0d9f0 100644
--- a/usr/common/libfc/src/encaps/fcoe.c
+++ b/usr/common/libfc/src/encaps/fcoe.c
@@ -60,8 +60,8 @@

 #define FCOE_ET_VAR FCOE_ETHERTYPE/* env. var. for ethertype */
 #define FCOE_OUI_VARFCOE_OUI  /* env. var. for OUI */
-#define FCOE_NEW_VARFCOE_NEW_%s   /* env. var. for new version */
-#define FCOE_NEW_ALL_VAR FCOE_NEW_ALL /* env. var. for new version */
+#define FCOE_OLD_VARFCOE_OLD_%s   /* env. var. for old version */
+#define FCOE_OLD_ALL_VAR FCOE_OLD_ALL /* env. var. for old version */

 #define FC_FCOE_BUFLEN  2200/* buffer size for reads */
 #define FC_FCOE_SOCKBUF_LEN (512 * 1024) /* requested receive socket buf size 
*/
@@ -158,11 +158,11 @@ fc_fcoe_create(const char *ifname, u_int vlan,
 charbuf[40];

 /*
- * Test for presense of env. variables FCOE_NEW_ifname or FCOE_NEW.
- * If these are not there, the older version is used.
+ * Test for presense of env. variables FCOE_OLD_ifname or FCOE_OLD_ALL.
+ * If any of these are there, the older protocol version is used.
  */
-snprintf(buf, sizeof (buf), FCOE_NEW_VAR, ifname);
-if ((getenv(buf) == NULL  getenv(FCOE_NEW_ALL_VAR) == NULL) ||
+snprintf(buf, sizeof (buf), FCOE_OLD_VAR, ifname);
+if (getenv(buf) != NULL || getenv(FCOE_OLD_ALL_VAR) != NULL ||
   (options  FC_OPT_FCOE_OLD) != 0) {
 return (fc_fcoe_create_old(ifname, vlan, src_mac, dest_mac, options));
 }
--
1.5.3.6

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OpenFCoE] [PATCH] Performance improvement, combine received data copy with CRC.

2007-11-30 Thread Joe Eykholt
Performance improvement, combine received data copy with CRC.

---
 drivers/scsi/ofc/openfc/openfc_scsi.c |  130 +++--
 1 files changed, 90 insertions(+), 40 deletions(-)

diff --git a/drivers/scsi/ofc/openfc/openfc_scsi.c 
b/drivers/scsi/ofc/openfc/openfc_scsi.c
index 5fa0ad6..51ca6ee 100644
--- a/drivers/scsi/ofc/openfc/openfc_scsi.c
+++ b/drivers/scsi/ofc/openfc/openfc_scsi.c
@@ -62,7 +62,6 @@ static void openfc_tm_done(struct fc_seq *, struct fc_frame 
*, void *);
 static void openfc_scsi_error(enum fc_event, void *);
 static int openfc_abort_internal(struct fcdev *, struct fc_scsi_pkt *,
 struct fc_frame *);
-int openfc_cp_to_user(struct fc_scsi_pkt *, uint, void *, int);
 void openfc_scsi_cleanup(struct fc_scsi_pkt *);
 static void openfc_timeout_error(struct fc_scsi_pkt *);
 void openfc_scsi_rec_rcv(struct fc_seq *, struct fc_frame *, void *);
@@ -102,9 +101,13 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt *fsp, 
struct fc_frame *fp)
struct fcoe_dev_stats *sp;
struct fc_frame_header *fh;
size_t offset;
+   u32 crc;
+   u32 copy_len = 0;
size_t len;
void *buf;

+   if (!sc-request_buffer)
+   return; /* XXX possible? */
fh = fc_frame_header_get(fp);
offset = net32_get(fh-fh_parm_offset);
len = fp-fr_len - sizeof(*fh);
@@ -115,13 +118,8 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt *fsp, 
struct fc_frame *fp)
 * this should never happen
 */
if ((fp-fr_flags  FCPHF_CRC_UNCHECKED) 
-   fc_frame_crc_check(fp)) {
-   sp = openfcp-fd.dev_stats[smp_processor_id()];
-   sp-ErrorFrames++;
-   if (sp-InvalidCRCCount++  5)
-   SA_LOG(CRC error on data frame);
-   return; /* just ignore the frame */
-   }
+   fc_frame_crc_check(fp))
+   goto crc_err;
if (openfc_debug) {
SA_LOG(data received past end.  
   len %zx offset %zx 
@@ -130,42 +128,95 @@ static void openfc_scsi_recv_data(struct fc_scsi_pkt 
*fsp, struct fc_frame *fp)
openfc_scsi_retry(fsp);
return;
}
-
-   /*
-* Eventually, do scatter/gather buffer system to avoid
-* this copy.  A NULL buffer means we discard the data.
-*/
+   crc = 0;
if (sc-use_sg) {
-   len = openfc_cp_to_user(fsp, offset, buf, len);
-   ASSERT_NOTIMPL(len  0);
-   } else if (sc-request_buffer != NULL) {
-   __memcpy((void *)sc-request_buffer + offset, buf, len);
-   }
+   struct scatterlist *sg;
+   struct scatterlist *sg_limit;
+   size_t remaining, sg_bytes;
+   size_t off;
+   void *page_addr;

-   /*
-* If the lower layer didn't do the CRC check, do it here.
-* This is the only type of frame the transport might not check.
-* Eventually we could do the CRC calculation during the copy above.
-*/
-   if ((fp-fr_flags  FCPHF_CRC_UNCHECKED)  fc_frame_crc_check(fp)) {
-   sp = openfcp-fd.dev_stats[smp_processor_id()];
-   sp-ErrorFrames++;
-   if (sp-InvalidCRCCount++  5)
-   SA_LOG(CRC error on data frame);
+   if (fp-fr_flags  FCPHF_CRC_UNCHECKED)
+   crc = crc32_sb8_64_bit(~0, (u8 *) fh, sizeof(*fh));

-   /*
-* Assume the frame is total garbage.
-* We may have copied it over the good part of the buffer.
-* If so, we need to retry the entire operation.
-* Otherwise, ignore it.
-*/
-   if (offset  fsp-xfer_len)
-   openfc_scsi_retry(fsp);
-   return;
-   }
+   sg = (struct scatterlist *)sc-request_buffer;
+   sg_limit = sg + sc-use_sg;
+   remaining = len;

-   fsp-xfer_len += len;
+   while (remaining  0  sg  sg_limit) {
+   if (offset = sg-length) {
+   offset -= sg-length;
+   sg++;
+   continue;
+   }
+   sg_bytes = min(remaining, sg-length - offset);

+   /*
+* The scatterlist item may be bigger than PAGE_SIZE,
+* but we are limited to mapping PAGE_SIZE at a time.
+*/
+   off = offset + sg-offset;
+   sg_bytes = min(sg_bytes,
+  (PAGE_SIZE - (off  ~PAGE_MASK)));
+   page_addr = 

LIO-VM Demo Images available for download!

2007-11-30 Thread Nicholas A. Bellinger
Grettings all,

It is my great honor to announce that the LIO-VM Target images are now
online and available for download:

http://linux-iscsi.org/builds/LIO-VM/vmware/

and the wiki entry (which is basically the README now) is also online:

http://linux-iscsi.org/index.php/LIO-VM

Please check the wiki for the complete release information.  Here are
the bullets from the README.

Have Fun!!! :-)

--nab

---

Introduction:

The LIO-VM Storage Engine demo is a set of  VMware compatible virtual
machine images that contains a self-configuring iSCSI storage engine
that runs on with a very large and diverse amount of PC storage
software and hardware.  When the LIO-VM image boots, the host local
storage hardware that is made available to the guest is exported as
iSCSI target ports, and made available to both local and remote
iSCSI Initiator clients.

Note that the iSCSI target is configured to allow _ALL_ iSCSI Initiators
to access _ALL_ iSCSI Target Ports across all available iSCSI Network
Portals.  By default, the storage devices with filesystems will be
exported as READ-ONLY to prevent multiple accesses by non-cluster
filesystems.  Support for production R/W configurations of this demo are
in the works, please stay tuned to the site and lists for more
information as this unfolds.  Also, if you really know what you are
doing when it comes to non cluster filesystem + RW access, please see
section IX) below.

I) The .vmx LIO-VM images:

There are two VMware Workstation 6.x/Fusion compatible image 
available:

Debian Etch 4 i386: (2.6.18-5-686)
JeOS / Ubuntu 7.10 i386: (2.6.22-14-virtual)

II) What are the host OS requirements to run the LIO-VM Demo?

Any i386 or x86_64 Linux v2.6 host that can run VMware
Workstation 6.
Any Apple Mac-tel hardware that can run VMware Fusion.
Any XP or NT compatible host that can run VMware Workstation 6.

III) What has been tested?

The LIO-VM has been successfully run on Linux v2.6, MacOSX 
Leopard, and WinXP/NT.

USB connected flash and SATA/PATA devices.
Internal SATA DVD and External SATA HD drives
External USB DVD/HD devices are also supported.

IV) What should work?

All USB Direct-Access (flash, USB external PATA/SATA disk 
drives)
All USB optical drives (CD, DVD, HD/DVD and BD)
All PATA/SATA disk drives
All PATA/SATA optical drives (CD, DVD, HD/DVD and BD)
All PSCSI / FC / SAS hardware with correct host OS drivers.

Basically, if it works locally, and you can bring it into the 
guest,  you can export it.

V) Why are there two images?

The Debian image has a work around to allow optical devices to 
work properly.  Other than this difference, the two images 
should function as identical for other devices, host OS storage 
driver requirements not withstanding.  See VI) for more 
information.


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory) (fwd)

2007-11-30 Thread Anders Henke
Am 29.11.2007 schrieb Matthew Wilcox:
 On Thu, Nov 29, 2007 at 05:45:57PM +0100, Anders Henke wrote:
  On Nov 29 2007, FUJITA Tomonori wrote:
   @@ -3295,7 +3295,7 @@ static struct scsi_host_template adpt_template = {
 .this_id= 7,
 .cmd_per_lun= 1,
 .use_clustering = ENABLE_CLUSTERING,
   - .use_sg_chaining= ENABLE_SG_CHAINING,
   + .use_sg_chaining= DISABLE_SG_CHAINING,
};

static s32 adpt_scsi_register(adpt_hba* pHba)
  
  The structure to patch does look different and doesn't include an
  tag use_sg_chaining:
  
  .this_id= 7,
  .cmd_per_lun= 1,
  .use_clustering = ENABLE_CLUSTERING,
 
 Just add the line
   .use_sg_chaining= DISABLE_SG_CHAINING,
 
  };


Just out of curiosity, I've tried 2.6.24-rc3 and patched the kernel
accordingly (DISABLE_SG_CHAINING): doesn't boot successfully,
same error as usual:

EXT2-fs error (device sda1): ext2_check_page: bad entry in directory #2:
rec_len is smaller than minimal - offset=0, inode=0, rec_len=0,
name_len=0
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to
kernel.

As sent in a parallel mail, I've found out that 2.6.23-rc2 works and
2.6.23-rc3 shows the same problems - so the problem has to be searched
in the dpt_i2o-changes made for 2.6.23-rc3.


Anders
-- 
11 Internet AG  System Design
Brauerstrasse 48 v://49.721.91374.50
D-76135 Karlsruhef://49.721.91374.225

Amtsgericht Montabaur HRB 6484
Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Andreas Gauger,
Thomas Gottschlich, Matthias Greve, Robert Hoffmann, Norbert Lang, Achim Weiss
Aufsichtsratsvorsitzender: Michael Scheeren
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


aic94xx or libsas crash on X7DB3 supermicro with enclosure and sata drives

2007-11-30 Thread Krzysztof Błaszkowski
Hello all,

I noticed this according to syslog. furthermore if aic94xx is connected to 
single sata drive only then there is no crash but device is not recognized 
too. (mysterious: ERROR: Unidentified device type 5).

A crash recorded in syslog:

aic94xx: Adaptec aic94xx SAS/SATA driver version 1.0.3 loaded
ACPI: PCI Interrupt :04:02.0[A] - GSI 16 (level, low) - IRQ 16
aic94xx: found Adaptec AIC-9410W SAS/SATA Host Adapter, device :04:02.0
scsi6 : aic94xx
PM: Adding info for No Bus:host6
PM: Adding info for No Bus::04:02.0
PM: Removing info for No Bus::04:02.0
aic94xx: Found sequencer Firmware version 1.1 (V30)
aic94xx: device :04:02.0: SAS addr 50030484ce20, PCBA SN ORG, 8 phys, 
8 enabled phys, flash present, BIOS build 1822
PM: Adding info for No Bus:phy-6:0

snip

BUG: unable to handle kernel NULL pointer dereference at virtual address 
0074
 printing eip:
f8e2daf9
*pde = 
Oops:  [#1]
SMP 
Modules linked in: aic94xx firmware_class libsas scsi_transport_sas nfsd 
exportfs nvram speedstep_lib freq_table thermal processor fan button battery 
edd ac ipv6 evdev joydev sr_mod ide_cd cdrom e1000 ehci_hcd i2c_i801 uhci_hcd 
rng_core dm_mod usbcore
CPU:    0
EIP:    0060:[f8e2daf9]    Not tainted VLI
EFLAGS: 00010286   (2.6.22.8 #6)
EIP is at sas_rphy_add+0x9/0x100 [scsi_transport_sas]
eax:    ebx:    ecx: 0004   edx: 0282
esi: f2d8c080   edi:    ebp: f2d8c080   esp: f33bbe84
ds: 007b   es: 007b   fs: 00d8  gs:   ss: 0068
Process scsi_wq_6 (pid: 8265, ti=f33ba000 task=f5712a90 task.ti=f33ba000)
Stack: f2d8c080   f2d8c080 f2d8c0d7 f2d8c080 f8e8bdc2 f46b49e0 
       f2d8c114 f8e8d040 f7c4446c f704e724 f704e6c0  0001  
       f46b49fc f8e8d741 f7c44438  f33bbedc 402e9267 f7c44380 ffed 
Call Trace:
 [f8e8bdc2] sas_discover_sata+0x42/0x80 [libsas]
 [f8e8d040] sas_ex_discover_end_dev+0x120/0x2d0 [libsas]
 [f8e8d741] sas_ex_discover_dev+0x2d1/0x470 [libsas]
 [402e9267] attribute_container_device_trigger+0xa7/0xb0
 [f8e8daa3] sas_ex_discover_devices+0x83/0xb0 [libsas]
 [f8e8e6d3] sas_ex_level_discovery+0x43/0x70 [libsas]
 [f8e8e71b] sas_ex_bfs_disc+0x1b/0x30 [libsas]
 [f8e8e76e] sas_discover_root_expander+0x3e/0x80 [libsas]
 [f8e8bf40] sas_discover_domain+0x0/0xc0 [libsas]
 [f8e8bfea] sas_discover_domain+0xaa/0xc0 [libsas]
 [40131541] run_workqueue+0x71/0x100
 [4013167c] worker_thread+0xac/0x110
 [401352a0] autoremove_wake_function+0x0/0x50
 [401352a0] autoremove_wake_function+0x0/0x50
 [401315d0] worker_thread+0x0/0x110
 [40134d24] kthread+0x64/0xa0
 [40134cc0] kthread+0x0/0xa0
 [401048b7] kernel_thread_helper+0x7/0x10
 ===
Code: f0 83 c4 1c 5b 5e 5f 5d c3 0f 0b 8d b4 26 00 00 00 00 eb fe 8d b4 26 00 
00 00 00 8d bc 27 00 00 00 00 55 57 89 c7 56 53 83 ec 08 8b 70 74 8b 5e 74 
eb 0b 8b 43 74 31 d2 85 c0 74 13 89 c3 89 d8 
EIP: [f8e2daf9] sas_rphy_add+0x9/0x100 [scsi_transport_sas] SS:ESP 
0068:f33bbe84


let me know if you need any more information. i used latest firmware available 
from Adaptec's site.

Best regards,
Krzysztof Blaszkowski

Systemy mikroprocesorowe
Storrady 1
PL71602 Szczecin, Poland
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/28] blk_end_request: changing s390 (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts s390 to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/s390/block/dasd.c  |4 +---
 drivers/s390/char/tape_block.c |3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/s390/block/dasd.c
===
--- 2.6.24-rc3-mm2.orig/drivers/s390/block/dasd.c
+++ 2.6.24-rc3-mm2/drivers/s390/block/dasd.c
@@ -1080,10 +1080,8 @@ dasd_int_handler(struct ccw_device *cdev
 static inline void
 dasd_end_request(struct request *req, int uptodate)
 {
-   if (end_that_request_first(req, uptodate, req-hard_nr_sectors))
+   if (__blk_end_request(req, uptodate, blk_rq_bytes(req)))
BUG();
-   add_disk_randomness(req-rq_disk);
-   end_that_request_last(req, uptodate);
 }
 
 /*
Index: 2.6.24-rc3-mm2/drivers/s390/char/tape_block.c
===
--- 2.6.24-rc3-mm2.orig/drivers/s390/char/tape_block.c
+++ 2.6.24-rc3-mm2/drivers/s390/char/tape_block.c
@@ -76,9 +76,8 @@ tapeblock_trigger_requeue(struct tape_de
 static void
 tapeblock_end_request(struct request *req, int uptodate)
 {
-   if (end_that_request_first(req, uptodate, req-hard_nr_sectors))
+   if (__blk_end_request(req, uptodate, blk_rq_bytes(req)))
BUG();
-   end_that_request_last(req, uptodate);
 }
 
 static void
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/28] blk_end_request: changing mmc (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts mmc to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/mmc/card/block.c |   24 +---
 drivers/mmc/card/queue.c |4 ++--
 2 files changed, 7 insertions(+), 21 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/mmc/card/block.c
===
--- 2.6.24-rc3-mm2.orig/drivers/mmc/card/block.c
+++ 2.6.24-rc3-mm2/drivers/mmc/card/block.c
@@ -348,15 +348,7 @@ static int mmc_blk_issue_rq(struct mmc_q
 * A block was successfully transferred.
 */
spin_lock_irq(md-lock);
-   ret = end_that_request_chunk(req, 1, brq.data.bytes_xfered);
-   if (!ret) {
-   /*
-* The whole request completed successfully.
-*/
-   add_disk_randomness(req-rq_disk);
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, 1);
-   }
+   ret = __blk_end_request(req, 1, brq.data.bytes_xfered);
spin_unlock_irq(md-lock);
} while (ret);
 
@@ -386,27 +378,21 @@ static int mmc_blk_issue_rq(struct mmc_q
else
bytes = blocks  9;
spin_lock_irq(md-lock);
-   ret = end_that_request_chunk(req, 1, bytes);
+   ret = __blk_end_request(req, 1, bytes);
spin_unlock_irq(md-lock);
}
} else if (rq_data_dir(req) != READ 
   (card-host-caps  MMC_CAP_MULTIWRITE)) {
spin_lock_irq(md-lock);
-   ret = end_that_request_chunk(req, 1, brq.data.bytes_xfered);
+   ret = __blk_end_request(req, 1, brq.data.bytes_xfered);
spin_unlock_irq(md-lock);
}
 
mmc_release_host(card-host);
 
spin_lock_irq(md-lock);
-   while (ret) {
-   ret = end_that_request_chunk(req, 0,
-   req-current_nr_sectors  9);
-   }
-
-   add_disk_randomness(req-rq_disk);
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, 0);
+   while (ret)
+   ret = __blk_end_request(req, 0, blk_rq_cur_bytes(req));
spin_unlock_irq(md-lock);
 
return 0;
Index: 2.6.24-rc3-mm2/drivers/mmc/card/queue.c
===
--- 2.6.24-rc3-mm2.orig/drivers/mmc/card/queue.c
+++ 2.6.24-rc3-mm2/drivers/mmc/card/queue.c
@@ -94,8 +94,8 @@ static void mmc_request(struct request_q
printk(KERN_ERR MMC: killing requests for dead queue\n);
while ((req = elv_next_request(q)) != NULL) {
do {
-   ret = end_that_request_chunk(req, 0,
-   req-current_nr_sectors  9);
+   ret = __blk_end_request(req, 0,
+   blk_rq_cur_bytes(req));
} while (ret);
}
return;
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: broken dpt_i2o in 2.6.23 (was: ext2_check_page: bad entry in directory) (fwd)

2007-11-30 Thread Anders Henke
Am 30.11.2007 schrieb FUJITA Tomonori:
According to the 2.6.23-rc1 short-form changelog, there is
one major edit on the dpt_i2o driver:

FUJITA Tomonori 

  [SCSI] dpt_i2o: convert to use the data buffer accessors

Stephen Rothwell 
  dpt_i2o depends on virt_to_bus

Fujita, would you please take a look at this?
   
   Sorry about the bug. Can you try this?
   
   
   diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
   index 8258506..1255b26 100644
   --- a/drivers/scsi/dpt_i2o.c
   +++ b/drivers/scsi/dpt_i2o.c
   @@ -3295,7 +3295,7 @@ static struct scsi_host_template adpt_template = {
 .this_id= 7,
 .cmd_per_lun= 1,
 .use_clustering = ENABLE_CLUSTERING,
   - .use_sg_chaining= ENABLE_SG_CHAINING,
   + .use_sg_chaining= DISABLE_SG_CHAINING,
};

static s32 adpt_scsi_register(adpt_hba* pHba)
  
  The structure to patch does look different and doesn't include an
  tag use_sg_chaining:
 
 Sorry, I misread your bug report. If you use 2.6.23, the sg chaining
 is unrelated.
 
 What architecture do you use?

Mainstream 32-bit-x86, the affected boxes are running Intel Xeons (P4)
at 2.66 or 2.8 GHz. 

In between, I've ruled out that the static assignment isn't
source of the problem.  And due to some manually made make clean which 
didn't clean enough, I've also pointed out the wrong patch - sorry,
Fujita, definitely the right one which breaks my boxes is the dpt_i2o patch 
from 2.6.23-rc2 to 2.6.23-rc3 (7 kb in Size) from Matthew Wilcox.

commit 55d9fcf57ba5ec427544fca7abc335cf3da78160
Author: Matthew Wilcox [EMAIL PROTECTED]
Date:   Mon Jul 30 15:19:18 2007 -0600

[SCSI] dpt_i2o: convert to SCSI hotplug model

 - Delete refereces to HOSTS_C
 - Switch to module_init/module_exit instead of detect/release
 - Don't pass around the host template and rename it to
   adpt_template
 - Switch from scsi_register/scsi_unregister to scsi_host_alloc,
   scsi_add_host, scsi_scan_host and scsi_host_put.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
Acked-by: Salyzyn, Mark [EMAIL PROTECTED]
Signed-off-by: James Bottomley [EMAIL PROTECTED]

Definitely as in
-applied the diff-patch onto 2.6.23.1 with a dpt_i2o from 2.6.23-rc1
 to verify that booting failes.
-Recompiled a clean unpacked 2.6.23-rc2 to verify that the driver
 from -rc2 still works.
-Recompiled a clean unpacked 2.6.23-rc3 to verify that the driver
 from -rc3 breaks booting on my boxes.

So sorry for mispointing the bug to you, it's an issue for Matthew.


Anders
-- 
11 Internet AG  System Design
Brauerstrasse 48 v://49.721.91374.50
D-76135 Karlsruhef://49.721.91374.225

Amtsgericht Montabaur HRB 6484
Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Andreas Gauger,
Thomas Gottschlich, Matthias Greve, Robert Hoffmann, Norbert Lang, Achim Weiss
Aufsichtsratsvorsitzender: Michael Scheeren
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OpenFCoE] [PATCH] fcoe_create() fails without destroying the kmem slab.

2007-11-30 Thread Joe Eykholt
fcoe_create() fails without destroying the kmem slab.

This causes the next create to panic.
The destroy should be done in openfc_put_dev.
---
 drivers/scsi/ofc/openfc/openfc_if.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ofc/openfc/openfc_if.c 
b/drivers/scsi/ofc/openfc/openfc_if.c
index 0d9c370..6f9a276 100644
--- a/drivers/scsi/ofc/openfc/openfc_if.c
+++ b/drivers/scsi/ofc/openfc/openfc_if.c
@@ -1115,7 +1115,6 @@ void openfc_unregister(struct fcdev *dev)
fc_remove_host(openfcp-host);
scsi_remove_host(openfcp-host);
fcs_destroy(openfcp-fcs_state);
-   openfc_destroy_scsi_slab(openfcp);
 }
 EXPORT_SYMBOL(openfc_unregister);

@@ -1127,9 +1126,7 @@ void openfc_put_dev(struct fcdev *dev)
 {
struct openfc_softc *openfcp = openfc_get_softc(dev);

-   /*
-* put back the scsi host structure
-*/
+   openfc_destroy_scsi_slab(openfcp);
scsi_host_put(openfcp-host);
 }
 EXPORT_SYMBOL(openfc_put_dev);
--
1.5.3.6
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/28] blk_end_request: add/export functions to get request size (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch adds/exports functions to get the size of request in bytes.
They are useful because blk_end_request() takes bytes
as a completed I/O size instead of sectors.

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 block/ll_rw_blk.c  |   25 ++---
 include/linux/blkdev.h |8 
 2 files changed, 30 insertions(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/include/linux/blkdev.h
===
--- 2.6.24-rc3-mm2.orig/include/linux/blkdev.h
+++ 2.6.24-rc3-mm2/include/linux/blkdev.h
@@ -736,6 +736,14 @@ extern void end_dequeued_request(struct 
 extern void blk_complete_request(struct request *);
 
 /*
+ * blk_end_request() takes bytes instead of sectors as a complete size.
+ * blk_rq_bytes() returns bytes left to complete in the entire request.
+ * blk_rq_cur_bytes() returns bytes left to complete in the current segment.
+ */
+extern unsigned int blk_rq_bytes(struct request *rq);
+extern unsigned int blk_rq_cur_bytes(struct request *rq);
+
+/*
  * end_that_request_first/chunk() takes an uptodate argument. we account
  * any value = as an io error. 0 means -EIO for compatability reasons,
  * any other  0 value is the direct error type. An uptodate value of
Index: 2.6.24-rc3-mm2/block/ll_rw_blk.c
===
--- 2.6.24-rc3-mm2.orig/block/ll_rw_blk.c
+++ 2.6.24-rc3-mm2/block/ll_rw_blk.c
@@ -3701,13 +3701,32 @@ static inline void __end_request(struct 
}
 }
 
-static unsigned int rq_byte_size(struct request *rq)
+/**
+ * blk_rq_bytes - Returns bytes left to complete in the entire request
+ **/
+unsigned int blk_rq_bytes(struct request *rq)
 {
if (blk_fs_request(rq))
return rq-hard_nr_sectors  9;
 
return rq-data_len;
 }
+EXPORT_SYMBOL_GPL(blk_rq_bytes);
+
+/**
+ * blk_rq_cur_bytes - Returns bytes left to complete in the current segment
+ **/
+unsigned int blk_rq_cur_bytes(struct request *rq)
+{
+   if (blk_fs_request(rq))
+   return rq-current_nr_sectors  9;
+
+   if (rq-bio)
+   return rq-bio-bi_size;
+
+   return rq-data_len;
+}
+EXPORT_SYMBOL_GPL(blk_rq_cur_bytes);
 
 /**
  * end_queued_request - end all I/O on a queued request
@@ -3722,7 +3741,7 @@ static unsigned int rq_byte_size(struct 
  **/
 void end_queued_request(struct request *rq, int uptodate)
 {
-   __end_request(rq, uptodate, rq_byte_size(rq), 1);
+   __end_request(rq, uptodate, blk_rq_bytes(rq), 1);
 }
 EXPORT_SYMBOL(end_queued_request);
 
@@ -3739,7 +3758,7 @@ EXPORT_SYMBOL(end_queued_request);
  **/
 void end_dequeued_request(struct request *rq, int uptodate)
 {
-   __end_request(rq, uptodate, rq_byte_size(rq), 0);
+   __end_request(rq, uptodate, blk_rq_bytes(rq), 0);
 }
 EXPORT_SYMBOL(end_dequeued_request);
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/28] blk_end_request: changing arm (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts arm to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---

 arch/arm/plat-omap/mailbox.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/arch/arm/plat-omap/mailbox.c
===
--- 2.6.24-rc3-mm2.orig/arch/arm/plat-omap/mailbox.c
+++ 2.6.24-rc3-mm2/arch/arm/plat-omap/mailbox.c
@@ -117,7 +117,8 @@ static void mbox_tx_work(struct work_str
 
spin_lock(q-queue_lock);
blkdev_dequeue_request(rq);
-   end_that_request_last(rq, 0);
+   if (__blk_end_request(rq, 0, 0))
+   BUG();
spin_unlock(q-queue_lock);
}
 }
@@ -151,7 +152,8 @@ static void mbox_rx_work(struct work_str
 
spin_lock_irqsave(q-queue_lock, flags);
blkdev_dequeue_request(rq);
-   end_that_request_last(rq, 0);
+   if (__blk_end_request(rq, 0, 0))
+   BUG();
spin_unlock_irqrestore(q-queue_lock, flags);
 
mbox-rxq-callback((void *)msg);
@@ -265,7 +267,8 @@ omap_mbox_read(struct device *dev, struc
 
spin_lock_irqsave(q-queue_lock, flags);
blkdev_dequeue_request(rq);
-   end_that_request_last(rq, 0);
+   if (__blk_end_request(rq, 0, 0))
+   BUG();
spin_unlock_irqrestore(q-queue_lock, flags);
 
if (unlikely(mbox_seq_test(mbox, *p))) {
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/28] blk_end_request: changing floppy (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts floppy to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/floppy.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/floppy.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/floppy.c
+++ 2.6.24-rc3-mm2/drivers/block/floppy.c
@@ -2290,18 +2290,16 @@ static int do_format(int drive, struct f
 static void floppy_end_request(struct request *req, int uptodate)
 {
unsigned int nr_sectors = current_count_sectors;
+   unsigned int drive = (unsigned int)req-rq_disk-private_data;
 
/* current_count_sectors can be zero if transfer failed */
if (!uptodate)
nr_sectors = req-current_nr_sectors;
-   if (end_that_request_first(req, uptodate, nr_sectors))
+   if (__blk_end_request(req, uptodate, nr_sectors  9))
return;
-   add_disk_randomness(req-rq_disk);
-   floppy_off((long)req-rq_disk-private_data);
-   blkdev_dequeue_request(req);
-   end_that_request_last(req, uptodate);
 
/* We're done with the request */
+   floppy_off(drive);
current_req = NULL;
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/28] blk_end_request: changing xen-blkfront (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts xen-blkfront to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/block/xen-blkfront.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/block/xen-blkfront.c
===
--- 2.6.24-rc3-mm2.orig/drivers/block/xen-blkfront.c
+++ 2.6.24-rc3-mm2/drivers/block/xen-blkfront.c
@@ -494,10 +494,9 @@ static irqreturn_t blkif_interrupt(int i
dev_dbg(info-xbdev-dev, Bad return from 
blkdev data 
request: %x\n, bret-status);
 
-   ret = end_that_request_first(req, uptodate,
-   req-hard_nr_sectors);
+   ret = __blk_end_request(req, uptodate,
+   blk_rq_bytes(req));
BUG_ON(ret);
-   end_that_request_last(req, uptodate);
break;
default:
BUG();
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/28] blk_end_request: changing ide normal caller (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts normal parts of ide to use blk_end_request().

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 drivers/ide/ide-cd.c |6 +++---
 drivers/ide/ide-io.c |   17 ++---
 2 files changed, 9 insertions(+), 14 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/ide/ide-cd.c
===
--- 2.6.24-rc3-mm2.orig/drivers/ide/ide-cd.c
+++ 2.6.24-rc3-mm2/drivers/ide/ide-cd.c
@@ -655,9 +655,9 @@ static void cdrom_end_request (ide_drive
BUG();
} else {
spin_lock_irqsave(ide_lock, flags);
-   end_that_request_chunk(failed, 0,
-   failed-data_len);
-   end_that_request_last(failed, 0);
+   if (__blk_end_request(failed, 0,
+ failed-data_len))
+   BUG();
spin_unlock_irqrestore(ide_lock, flags);
}
} else
Index: 2.6.24-rc3-mm2/drivers/ide/ide-io.c
===
--- 2.6.24-rc3-mm2.orig/drivers/ide/ide-io.c
+++ 2.6.24-rc3-mm2/drivers/ide/ide-io.c
@@ -78,14 +78,9 @@ static int __ide_end_request(ide_drive_t
ide_dma_on(drive);
}
 
-   if (!end_that_request_chunk(rq, uptodate, nr_bytes)) {
-   add_disk_randomness(rq-rq_disk);
-   if (dequeue) {
-   if (!list_empty(rq-queuelist))
-   blkdev_dequeue_request(rq);
+   if (!__blk_end_request(rq, uptodate, nr_bytes)) {
+   if (dequeue)
HWGROUP(drive)-rq = NULL;
-   }
-   end_that_request_last(rq, uptodate);
ret = 0;
}
 
@@ -290,9 +285,9 @@ static void ide_complete_pm_request (ide
drive-blocked = 0;
blk_start_queue(drive-queue);
}
-   blkdev_dequeue_request(rq);
HWGROUP(drive)-rq = NULL;
-   end_that_request_last(rq, 1);
+   if (__blk_end_request(rq, 1, 0))
+   BUG();
spin_unlock_irqrestore(ide_lock, flags);
 }
 
@@ -402,10 +397,10 @@ void ide_end_drive_cmd (ide_drive_t *dri
}
 
spin_lock_irqsave(ide_lock, flags);
-   blkdev_dequeue_request(rq);
HWGROUP(drive)-rq = NULL;
rq-errors = err;
-   end_that_request_last(rq, !rq-errors);
+   if (__blk_end_request(rq, !rq-errors, 0))
+   BUG();
spin_unlock_irqrestore(ide_lock, flags);
 }
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 27/28] blk_end_request: changing scsi mid-layer for bidi (take 3)

2007-11-30 Thread Kiyoshi Ueda
This patch converts bidi of scsi mid-layer to use blk_end_request().

rq-next_rq represents a pair of bidi requests.
(There are no other use of 'next_rq' of struct request.)
For both requests in the pair, end_that_request_chunk() should be
called before end_that_request_last() is called for one of them.
Since the calls to end_that_request_first()/chunk() and
end_that_request_last() are packaged into blk_end_request(),
the handling of next_rq completion has to be moved into
blk_end_request(), too.

Bidi sets its specific value to rq-data_len before the request is
completed so that upper-layer can read it.
This setting must be between end_that_request_chunk() and
end_that_request_last(), because rq-data_len may be used
in end_that_request_chunk() by blk_trace and so on.
To satisfy the requirement, use blk_end_request_callback() which
is added in PATCH 25 only for the tricky drivers.

If bidi didn't reuse rq-data_len and added new members to request
for the specific value, it could set before end_that_request_chunk()
and use the standard blk_end_request() like below.

void scsi_end_bidi_request(struct scsi_cmnd *cmd)
{
struct request *req = cmd-request;

rq-resid = scsi_out(cmd)-resid;
rq-next_rq-resid = scsi_in(cmd)-resid;

if (blk_end_request(req, 1, req-data_len))
BUG();

scsi_release_buffers(cmd);
scsi_next_command(cmd);
}

Signed-off-by: Kiyoshi Ueda [EMAIL PROTECTED]
Signed-off-by: Jun'ichi Nomura [EMAIL PROTECTED]
---
 block/ll_rw_blk.c   |   18 +
 drivers/scsi/scsi_lib.c |   66 
 2 files changed, 52 insertions(+), 32 deletions(-)

Index: 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c
===
--- 2.6.24-rc3-mm2.orig/drivers/scsi/scsi_lib.c
+++ 2.6.24-rc3-mm2/drivers/scsi/scsi_lib.c
@@ -629,28 +629,6 @@ void scsi_run_host_queues(struct Scsi_Ho
scsi_run_queue(sdev-request_queue);
 }
 
-static void scsi_finalize_request(struct scsi_cmnd *cmd, int uptodate)
-{
-   struct request_queue *q = cmd-device-request_queue;
-   struct request *req = cmd-request;
-   unsigned long flags;
-
-   add_disk_randomness(req-rq_disk);
-
-   spin_lock_irqsave(q-queue_lock, flags);
-   if (blk_rq_tagged(req))
-   blk_queue_end_tag(q, req);
-
-   end_that_request_last(req, uptodate);
-   spin_unlock_irqrestore(q-queue_lock, flags);
-
-   /*
-* This will goose the queue request function at the end, so we don't
-* need to worry about launching another command.
-*/
-   scsi_next_command(cmd);
-}
-
 /*
  * Function:scsi_end_request()
  *
@@ -921,6 +899,20 @@ void scsi_release_buffers(struct scsi_cm
 EXPORT_SYMBOL(scsi_release_buffers);
 
 /*
+ * Called from blk_end_request_callback() after all DATA in rq and its next_rq
+ * are completed before rq is completed/freed.
+ */
+static int scsi_end_bidi_request_cb(struct request *rq)
+{
+   struct scsi_cmnd *cmd = rq-special;
+
+   rq-data_len = scsi_out(cmd)-resid;
+   rq-next_rq-data_len = scsi_in(cmd)-resid;
+
+   return 0;
+}
+
+/*
  * Bidi commands Must be complete as a whole, both sides at once.
  * If part of the bytes were written and lld returned
  * scsi_in()-resid and/or scsi_out()-resid this information will be left
@@ -931,22 +923,32 @@ void scsi_end_bidi_request(struct scsi_c
 {
struct request *req = cmd-request;
 
-   end_that_request_chunk(req, 1, req-data_len);
-   req-data_len = scsi_out(cmd)-resid;
-
-   end_that_request_chunk(req-next_rq, 1, req-next_rq-data_len);
-   req-next_rq-data_len = scsi_in(cmd)-resid;
-
-   scsi_release_buffers(cmd);
-
/*
 *FIXME: If ll_rw_blk.c is changed to also put_request(req-next_rq)
-*   in end_that_request_last() then this WARN_ON must be removed.
+*   in blk_end_request() then this WARN_ON must be removed.
 *   for now, upper-driver must have registered an end_io.
 */
WARN_ON(!req-end_io);
 
-   scsi_finalize_request(cmd, 1);
+   /*
+* blk_end_request() family take care of data completion of next_rq.
+*
+* req-data_len and req-next_rq-data_len must be set after
+* all data are completed, since they may be referenced during
+* the data completion process.
+* So use the callback feature of blk_end_request() here.
+*
+* NOTE: If bidi doesn't reuse the data_len field for upper-layer's
+*   reference (e.g. adds new members for it to struct request),
+*   we can use the standard blk_end_request() interface here.
+*/
+   if (blk_end_request_callback(req, 1, req-data_len,
+scsi_end_bidi_request_cb))
+   /* req has not been completed */
+   BUG();
+
+   scsi_release_buffers(cmd);
+