linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout()
       [not found] <20050709000324.GD2596@us.ibm.com>
@ 2005-07-09  0:14 ` Nishanth Aravamudan
  2005-07-10 16:20   ` Domen Puncer
  2005-07-09  0:15 ` [KJ] [PATCH 12/14] scsi/osst: " Nishanth Aravamudan
  2005-07-09  0:16 ` [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() " Nishanth Aravamudan
  2 siblings, 1 reply; 5+ messages in thread
From: Nishanth Aravamudan @ 2005-07-09  0:14 UTC (permalink / raw)
  To: James.Bottomley; +Cc: Kernel-Janitors, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 2200 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>

Description: Replace schedule_timeout() with msleep() to guarantee the
task delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 lpfc_scsi.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c
--- 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 07:57:19.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 19:20:41.000000000 -0700
@@ -24,6 +24,7 @@
 
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
@@ -885,8 +886,7 @@ __lpfc_abort_handler(struct scsi_cmnd *c
 		while (cmnd->host_scribble)
 		{
 			spin_unlock_irq(phba->host->host_lock);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(LPFC_ABORT_WAIT*HZ);
+			msleep(LPFC_ABORT_WAIT * 1000);
 			spin_lock_irq(phba->host->host_lock);
 			if (++loop_count
 			    > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
@@ -952,8 +952,7 @@ __lpfc_reset_lun_handler(struct scsi_cmn
 
 		if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
 			spin_unlock_irq(phba->host->host_lock);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout( HZ/2);
+			msleep(500);
 			spin_lock_irq(phba->host->host_lock);
 		}
 		if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE))
@@ -1011,8 +1010,7 @@ __lpfc_reset_lun_handler(struct scsi_cmn
 				       cmnd->device->id, cmnd->device->lun,
 				       LPFC_CTX_LUN))) {
 		spin_unlock_irq(phba->host->host_lock);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(LPFC_RESET_WAIT*HZ);
+		msleep(LPFC_RESET_WAIT * 1000);
 		spin_lock_irq(phba->host->host_lock);
 
 		if (++loopcnt
@@ -1110,8 +1108,7 @@ __lpfc_reset_bus_handler(struct scsi_cmn
 				&phba->sli.ring[phba->sli.fcp_ring],
 				0, 0, LPFC_CTX_HOST))) {
 		spin_unlock_irq(phba->host->host_lock);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(LPFC_RESET_WAIT*HZ);
+		msleep(LPFC_RESET_WAIT * HZ);
 		spin_lock_irq(phba->host->host_lock);
 
 		if (++loopcnt

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH 12/14] scsi/osst: use msleep() instead of schedule_timeout()
       [not found] <20050709000324.GD2596@us.ibm.com>
  2005-07-09  0:14 ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
@ 2005-07-09  0:15 ` Nishanth Aravamudan
  2005-07-09  0:16 ` [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() " Nishanth Aravamudan
  2 siblings, 0 replies; 5+ messages in thread
From: Nishanth Aravamudan @ 2005-07-09  0:15 UTC (permalink / raw)
  To: osst; +Cc: Kernel-Janitors, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>

Description: Replace schedule_timeout() with msleep() to guarantee the
task delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 osst.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/osst.c 2.6.13-rc2-kj-dev/drivers/scsi/osst.c
--- 2.6.13-rc2-kj/drivers/scsi/osst.c	2005-07-06 07:57:19.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/osst.c	2005-07-06 19:21:03.000000000 -0700
@@ -862,8 +862,7 @@ static int osst_recover_wait_frame(struc
 				retval = osst_write_error_recovery(STp, aSRpnt, 0);
 				break;
 			}
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout (HZ / OSST_POLL_PER_SEC);
+			msleep(1000 / OSST_POLL_PER_SEC);
 
 			STp->buffer->b_data = mybuf; STp->buffer->buffer_size = 24;
 			memset(cmd, 0, MAX_COMMAND_SIZE);
@@ -1558,8 +1557,7 @@ static int osst_reposition_and_retry(str
 			osst_set_frame_position(STp, aSRpnt, frame + skip, 1);
 			flag = 0;
 			attempts--;
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(HZ / 10);
+			msleep(100);
 		}
 		if (osst_get_frame_position(STp, aSRpnt) < 0) {		/* additional write error */
 #if DEBUG
@@ -1620,8 +1618,7 @@ static int osst_reposition_and_retry(str
 			debugging = 0;
 		}
 #endif
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ / 10);
+		msleep(100);
 	}
 	printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name);
 #if DEBUG

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() instead of schedule_timeout()
       [not found] <20050709000324.GD2596@us.ibm.com>
  2005-07-09  0:14 ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
  2005-07-09  0:15 ` [KJ] [PATCH 12/14] scsi/osst: " Nishanth Aravamudan
@ 2005-07-09  0:16 ` Nishanth Aravamudan
  2 siblings, 0 replies; 5+ messages in thread
From: Nishanth Aravamudan @ 2005-07-09  0:16 UTC (permalink / raw)
  To: andrew.vasquez; +Cc: Kernel-Janitors, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]

From: Nishanth Aravamudan <nacc@us.ibm.com>

Description: Replace schedule_timeout() with
msleep()/msleep_interruptible() as appropriate, to guarantee the task
delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 qla_os.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c
--- 2.6.13-rc2-kj/drivers/scsi/qla2xxx/qla_os.c	2005-07-08 13:01:12.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/qla2xxx/qla_os.c	2005-07-06 19:27:01.000000000 -0700
@@ -347,14 +347,13 @@ qc_fail_command:
 static int
 qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
 {
-#define ABORT_POLLING_PERIOD	HZ
-#define ABORT_WAIT_ITER		((10 * HZ) / (ABORT_POLLING_PERIOD))
+#define ABORT_POLLING_PERIOD	1000
+#define ABORT_WAIT_ITER		((10 * 1000) / (ABORT_POLLING_PERIOD))
 	unsigned long wait_iter = ABORT_WAIT_ITER;
 	int ret = QLA_SUCCESS;
 
 	while (CMD_SP(cmd)) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(ABORT_POLLING_PERIOD);
+		msleep(ABORT_POLLING_PERIOD);
 
 		if (--wait_iter)
 			break;
@@ -1693,7 +1692,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 {
 	struct list_head	*fcpl, *fcptemp;
 	fc_port_t	*fcport;
-	unsigned long	wtime;/* max wait time if mbx cmd is busy. */
+	unsigned int	wtime;/* max wait time if mbx cmd is busy. */
 
 	if (ha == NULL) {
 		/* error */
@@ -1702,11 +1701,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 	}
 
 	/* Make sure all other threads are stopped. */
-	wtime = 60 * HZ;
-	while (ha->dpc_wait && wtime) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		wtime = schedule_timeout(wtime);
-	}
+	wtime = 60 * 1000;
+	while (ha->dpc_wait && wtime)
+		wtime = msleep_interruptible(wtime);
 
 	/* free ioctl memory */
 	qla2x00_free_ioctl_mem(ha);
@@ -2250,15 +2247,15 @@ qla2x00_timer(scsi_qla_host_t *ha)
 int
 qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
 {
-	const unsigned int step = HZ/10;
+	const unsigned int step = 100; /* msecs */
+	unsigned int iterations = jiffies_to_msecs(timeout)/100;
 
 	do {
 		if (!down_trylock(sema))
 			return 0;
-		set_current_state(TASK_INTERRUPTIBLE);
-		if (schedule_timeout(step))
+		if (msleep_interruptible(step))
 			break;
-	} while ((timeout -= step) > 0);
+	} while (--iterations >= 0);
 
 	return -ETIMEDOUT;
 }

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout()
  2005-07-09  0:14 ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
@ 2005-07-10 16:20   ` Domen Puncer
  2005-07-11  5:38     ` Nishanth Aravamudan
  0 siblings, 1 reply; 5+ messages in thread
From: Domen Puncer @ 2005-07-10 16:20 UTC (permalink / raw)
  To: Nishanth Aravamudan; +Cc: James.Bottomley, Kernel-Janitors, linux-scsi

On 08/07/05 17:14 -0700, Nishanth Aravamudan wrote:
> From: Nishanth Aravamudan <nacc@us.ibm.com>
> 
> Description: Replace schedule_timeout() with msleep() to guarantee the
> task delays as expected.
> 
> Patch is compile-tested.
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> 
> ---
> 
>  lpfc_scsi.c |   13 +++++--------
>  1 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff -urp 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c
> --- 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 07:57:19.000000000 -0700
> +++ 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 19:20:41.000000000 -0700
...
> @@ -1110,8 +1108,7 @@ __lpfc_reset_bus_handler(struct scsi_cmn
>  				&phba->sli.ring[phba->sli.fcp_ring],
>  				0, 0, LPFC_CTX_HOST))) {
>  		spin_unlock_irq(phba->host->host_lock);
> -		set_current_state(TASK_UNINTERRUPTIBLE);
> -		schedule_timeout(LPFC_RESET_WAIT*HZ);
> +		msleep(LPFC_RESET_WAIT * HZ);

					^^ ??
I assume you meant 1000.

>  		spin_lock_irq(phba->host->host_lock);
>  
>  		if (++loopcnt

> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors


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

* Re: [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout()
  2005-07-10 16:20   ` Domen Puncer
@ 2005-07-11  5:38     ` Nishanth Aravamudan
  0 siblings, 0 replies; 5+ messages in thread
From: Nishanth Aravamudan @ 2005-07-11  5:38 UTC (permalink / raw)
  To: Domen Puncer; +Cc: James.Bottomley, Kernel-Janitors, linux-scsi

On 10.07.2005 [18:20:10 +0200], Domen Puncer wrote:
> On 08/07/05 17:14 -0700, Nishanth Aravamudan wrote:
> > From: Nishanth Aravamudan <nacc@us.ibm.com>
> > 
> > Description: Replace schedule_timeout() with msleep() to guarantee the
> > task delays as expected.
> > 
> > Patch is compile-tested.
> > 
> > Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> > 
> > ---
> > 
> >  lpfc_scsi.c |   13 +++++--------
> >  1 files changed, 5 insertions(+), 8 deletions(-)
> > 
> > diff -urp 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c
> > --- 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 07:57:19.000000000 -0700
> > +++ 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 19:20:41.000000000 -0700
> ...
> > @@ -1110,8 +1108,7 @@ __lpfc_reset_bus_handler(struct scsi_cmn
> >  				&phba->sli.ring[phba->sli.fcp_ring],
> >  				0, 0, LPFC_CTX_HOST))) {
> >  		spin_unlock_irq(phba->host->host_lock);
> > -		set_current_state(TASK_UNINTERRUPTIBLE);
> > -		schedule_timeout(LPFC_RESET_WAIT*HZ);
> > +		msleep(LPFC_RESET_WAIT * HZ);
> 
> 					^^ ??
> I assume you meant 1000.

Gah! You are right. Fixed below. Thanks, Domen!

-Nish

Description: Replace schedule_timeout() with msleep() to guarantee the
task delays as expected.

Patch is compile-tested.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>

---

 lpfc_scsi.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff -urp 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c
--- 2.6.13-rc2-kj/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 07:57:19.000000000 -0700
+++ 2.6.13-rc2-kj-dev/drivers/scsi/lpfc/lpfc_scsi.c	2005-07-06 19:20:41.000000000 -0700
@@ -24,6 +24,7 @@
 
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
@@ -885,8 +886,7 @@ __lpfc_abort_handler(struct scsi_cmnd *c
 		while (cmnd->host_scribble)
 		{
 			spin_unlock_irq(phba->host->host_lock);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(LPFC_ABORT_WAIT*HZ);
+			msleep(LPFC_ABORT_WAIT * 1000);
 			spin_lock_irq(phba->host->host_lock);
 			if (++loop_count
 			    > (2 * phba->cfg_nodev_tmo)/LPFC_ABORT_WAIT)
@@ -952,8 +952,7 @@ __lpfc_reset_lun_handler(struct scsi_cmn
 
 		if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
 			spin_unlock_irq(phba->host->host_lock);
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout( HZ/2);
+			msleep(500);
 			spin_lock_irq(phba->host->host_lock);
 		}
 		if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE))
@@ -1011,8 +1010,7 @@ __lpfc_reset_lun_handler(struct scsi_cmn
 				       cmnd->device->id, cmnd->device->lun,
 				       LPFC_CTX_LUN))) {
 		spin_unlock_irq(phba->host->host_lock);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(LPFC_RESET_WAIT*HZ);
+		msleep(LPFC_RESET_WAIT * 1000);
 		spin_lock_irq(phba->host->host_lock);
 
 		if (++loopcnt
@@ -1110,8 +1108,7 @@ __lpfc_reset_bus_handler(struct scsi_cmn
 				&phba->sli.ring[phba->sli.fcp_ring],
 				0, 0, LPFC_CTX_HOST))) {
 		spin_unlock_irq(phba->host->host_lock);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(LPFC_RESET_WAIT*HZ);
+		msleep(LPFC_RESET_WAIT * 1000);
 		spin_lock_irq(phba->host->host_lock);
 
 		if (++loopcnt

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

end of thread, other threads:[~2005-07-11  5:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20050709000324.GD2596@us.ibm.com>
2005-07-09  0:14 ` [KJ] [PATCH 11/14] scsi/lpfc_scsi: use msleep() instead of schedule_timeout() Nishanth Aravamudan
2005-07-10 16:20   ` Domen Puncer
2005-07-11  5:38     ` Nishanth Aravamudan
2005-07-09  0:15 ` [KJ] [PATCH 12/14] scsi/osst: " Nishanth Aravamudan
2005-07-09  0:16 ` [KJ] [PATCH 13/14] scsi/qla2xxx: use msleep{, interruptible}() " Nishanth Aravamudan

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).