Skip to contentSkip to conversation

scsi/osst: replace schedule_timeout() with msleep()

PATCH In review [email protected] 3 participants 3 messages Mar 6, 2005 – Mar 7, 2005 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi/osst: replace schedule_timeout() with msleep()

Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. Although TASK_INTERRUPTIBLE is used in the current code, there is no code dealing with an early return / signals_pending().

---

 kj-domen/drivers/scsi/osst.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/osst.c renamed from drivers/scsi/osst.c~msleep-drivers_scsi_osst +2 -3
diff -puN drivers/scsi/osst.c~msleep-drivers_scsi_osst drivers/scsi/osst.c
@@ -1558,8 +1558,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
@@ -1621,7 +1620,7 @@ static int osst_reposition_and_retry(str
 		}
 #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

_

#1 lore raw
Quoted 5 lines · On 03/06/2005 05:27:41 PM, [email protected] wrote:

Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. Although TASK_INTERRUPTIBLE is used in the current code, there is no code dealing with an early return / signals_pending().

This change is a total don't-care as far as I'm concerned. But if we are going to make it, can we please be consistent? Does the "set_current_state(TASK_INTERRUPTIBLE)" stay or go? The two changes below don't agree in that respect.

---

drivers/scsi/osst.c static int osst_reposition_and_retry(str · line 1562

Quoted 5 lines
drivers/scsi/osst.c renamed from drivers/scsi/osst.c~msleep-drivers_scsi_osst +1 -2
 			attempts--;
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(HZ / 10);
+			msleep(100);
 		}

---

drivers/scsi/osst.c static int osst_reposition_and_retry(str · line 1624

Quoted 5 lines

#endif

drivers/scsi/osst.c renamed from drivers/scsi/osst.c~msleep-drivers_scsi_osst +1 -1
 		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ / 10);
+		msleep(100);
 	}

---

Regards, Willem Riede,
osst maintainer.

#2 lore raw

PATCH 1/1 scsi/osst: replace schedule_timeout() with msleep()

Quoted 10 lines · Willem Riede
Quoted 5 lines · On 03/06/2005 05:27:41 PM, [email protected] wrote:

Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. Although TASK_INTERRUPTIBLE is used in the current code, there is no code dealing with an early return / signals_pending().

This change is a total don't-care as far as I'm concerned. But if we are going to make it, can we please be consistent? Does the "set_current_state(TASK_INTERRUPTIBLE)" stay or go? The two changes below don't agree in that respect.

You are completely correct. Please excuse the sloppy patch, fixed below.

Description: Use msleep() instead of schedule_timeout() to guarantee the task delays as expected. Although TASK_INTERRUPTIBLE is used in the current code, there is no code dealing with an early return / signals_pending().

drivers/scsi/osst.c +3 -6
@@ -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