set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ / 10); 
schedule_timeout_interruptible(msecs_to_jiffies(100)); 
static int osst_reposition_and_retry(struct osst_tape * STp, struct scsi_request ** aSRpnt,					unsigned int frame, unsigned int skip, int pending){	unsigned char		cmd[MAX_COMMAND_SIZE];	struct scsi_request   * SRpnt;	char		      * name      = tape_name(STp);	int			expected  = 0;	int			attempts  = 1000 / skip;	int			flag      = 1;	unsigned long		startwait = jiffies;#if DEBUG	int			dbg       = debugging;#endif	while (attempts && time_before(jiffies, startwait + 60*HZ)) {		if (flag) {#if DEBUG			debugging = dbg;#endif			if (frame < 2990 && frame+skip+STp->cur_frames+pending >= 2990)				frame = 3000-skip;			expected = frame+skip+STp->cur_frames+pending;#if DEBUG			printk(OSST_DEB_MSG "%s:D: Position to fppos %d, re-write from fseq %d\n",					  name, frame+skip, STp->frame_seq_number-STp->cur_frames-pending);#endif			osst_set_frame_position(STp, aSRpnt, frame + skip, 1);			flag = 0;			attempts--;			set_current_state(TASK_INTERRUPTIBLE);			schedule_timeout(HZ / 10);		}		if (osst_get_frame_position(STp, aSRpnt) < 0) {		/* additional write error */#if DEBUG			printk(OSST_DEB_MSG "%s:D: Addl error, host %d, tape %d, buffer %d\n",					  name, STp->first_frame_position,					  STp->last_frame_position, STp->cur_frames);#endif			frame = STp->last_frame_position;			flag = 1;			continue;		}		if (pending && STp->cur_frames < 50) {			memset(cmd, 0, MAX_COMMAND_SIZE);			cmd[0] = WRITE_6;			cmd[1] = 1;			cmd[4] = 1;#if DEBUG			printk(OSST_DEB_MSG "%s:D: About to write pending fseq %d at fppos %d\n",					  name, STp->frame_seq_number-1, STp->first_frame_position);#endif			SRpnt = osst_do_scsi(*aSRpnt, STp, cmd, OS_FRAME_SIZE, DMA_TO_DEVICE,						      STp->timeout, MAX_RETRIES, 1);			*aSRpnt = SRpnt;			if (STp->buffer->syscall_result) {		/* additional write error */				if ((SRpnt->sr_sense_buffer[ 2] & 0x0f) == 13 &&				     SRpnt->sr_sense_buffer[12]         ==  0 &&				     SRpnt->sr_sense_buffer[13]         ==  2) {					printk(KERN_ERR					       "%s:E: Volume overflow in write error recovery\n",					       name);					break;				/* hit end of tape = fail */				}				flag = 1;			}			else				pending = 0;			continue;		}		if (STp->cur_frames == 0) {#if DEBUG			debugging = dbg;			printk(OSST_DEB_MSG "%s:D: Wait re-write finished\n", name);#endif			if (STp->first_frame_position != expected) {				printk(KERN_ERR "%s:A: Actual position %d - expected %d\n", 						name, STp->first_frame_position, expected);				return (-EIO);			}			return 0;		}#if DEBUG		if (debugging) {			printk(OSST_DEB_MSG "%s:D: Sleeping in re-write wait ready\n", name);			printk(OSST_DEB_MSG "%s:D: Turning off debugging for a while\n", name);			debugging = 0;		}#endif		set_current_state(TASK_INTERRUPTIBLE);		schedule_timeout(HZ / 10);	}	printk(KERN_ERR "%s:E: Failed to find valid tape media\n", name);#if DEBUG	debugging = dbg;#endif	return (-EIO);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/a9a3047dd8ae43ff24caae5ec733a93df129568e/osst.c/clean/drivers/scsi/osst.c