Reduced waiting time between retries of WRITE commands
This commit is contained in:
parent
30e7d83168
commit
daf3a18425
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2011.12.28.152153"
|
#define Cdrskin_timestamP "2011.12.30.142742"
|
||||||
|
@ -873,6 +873,30 @@ void mmc_write_12(struct burn_drive *d, int start, struct buffer *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Libburn_write_time_debuG
|
||||||
|
|
||||||
|
static int print_time(int flag)
|
||||||
|
{
|
||||||
|
static struct timeval prev = {0, 0};
|
||||||
|
struct timeval now;
|
||||||
|
struct timezone tz;
|
||||||
|
int ret, diff;
|
||||||
|
|
||||||
|
ret = gettimeofday(&now, &tz);
|
||||||
|
if (ret == -1)
|
||||||
|
return 0;
|
||||||
|
if (now.tv_sec - prev.tv_sec < Libburn_scsi_write_timeouT) {
|
||||||
|
diff = (now.tv_sec - prev.tv_sec) * 1000000 +
|
||||||
|
((int) (now.tv_usec) - (int) prev.tv_usec);
|
||||||
|
fprintf(stderr, "\nlibburn_DEBUG: %d.%-6d : %d\n", (int) now.tv_sec, (int) now.tv_usec, diff);
|
||||||
|
}
|
||||||
|
memcpy(&prev, &now, sizeof(struct timeval));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* Libburn_write_time_debuG */
|
||||||
|
|
||||||
|
|
||||||
int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
|
int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
|
||||||
{
|
{
|
||||||
int cancelled;
|
int cancelled;
|
||||||
@ -880,6 +904,10 @@ int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
|
|||||||
int len, key, asc, ascq;
|
int len, key, asc, ascq;
|
||||||
char *msg = NULL;
|
char *msg = NULL;
|
||||||
|
|
||||||
|
#ifdef Libburn_write_time_debuG
|
||||||
|
extern int burn_sg_log_scsi;
|
||||||
|
#endif
|
||||||
|
|
||||||
c = &(d->casual_command);
|
c = &(d->casual_command);
|
||||||
|
|
||||||
#ifdef Libburn_log_in_and_out_streaM
|
#ifdef Libburn_log_in_and_out_streaM
|
||||||
@ -925,6 +953,11 @@ int mmc_write(struct burn_drive *d, int start, struct buffer *buf)
|
|||||||
if(d->wait_for_buffer_free)
|
if(d->wait_for_buffer_free)
|
||||||
mmc_wait_for_buffer_free(d, buf);
|
mmc_wait_for_buffer_free(d, buf);
|
||||||
|
|
||||||
|
#ifdef Libburn_write_time_debuG
|
||||||
|
if (burn_sg_log_scsi & 3)
|
||||||
|
print_time(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ts A80412 */
|
/* ts A80412 */
|
||||||
if(d->do_stream_recording > 0 && start >= d->stream_recording_start) {
|
if(d->do_stream_recording > 0 && start >= d->stream_recording_start) {
|
||||||
|
|
||||||
|
@ -1671,8 +1671,18 @@ int scsi_eval_cmd_outcome(struct burn_drive *d, struct command *c, void *fp,
|
|||||||
if (outcome == RETRY && c->retry && !(flag & 1)) {
|
if (outcome == RETRY && c->retry && !(flag & 1)) {
|
||||||
/* Calming down retries and breaking up endless cycle
|
/* Calming down retries and breaking up endless cycle
|
||||||
*/
|
*/
|
||||||
usleep_time = Libburn_scsi_retry_usleeP +
|
if (c->opcode[0] == 0x2A || c->opcode[0] == 0xAA) {
|
||||||
loop_count * Libburn_scsi_retry_incR;
|
/* WRITE(10) , WRITE(12) */
|
||||||
|
usleep_time = Libburn_scsi_write_retry_usleeP +
|
||||||
|
loop_count * Libburn_scsi_write_retry_incR;
|
||||||
|
if (usleep_time > Libburn_scsi_write_retry_umaX)
|
||||||
|
usleep_time = Libburn_scsi_write_retry_umaX;
|
||||||
|
} else {
|
||||||
|
usleep_time = Libburn_scsi_retry_usleeP +
|
||||||
|
loop_count * Libburn_scsi_retry_incR;
|
||||||
|
if (usleep_time > Libburn_scsi_retry_umaX)
|
||||||
|
usleep_time = Libburn_scsi_retry_umaX;
|
||||||
|
}
|
||||||
if (time(NULL) + usleep_time / 1000000 - start_time >
|
if (time(NULL) + usleep_time / 1000000 - start_time >
|
||||||
timeout_ms / 1000 + 1) {
|
timeout_ms / 1000 + 1) {
|
||||||
BURN_ALLOC_MEM(msg, char, 320);
|
BURN_ALLOC_MEM(msg, char, 320);
|
||||||
@ -1688,7 +1698,8 @@ int scsi_eval_cmd_outcome(struct burn_drive *d, struct command *c, void *fp,
|
|||||||
}
|
}
|
||||||
if (d->cancel)
|
if (d->cancel)
|
||||||
{done = 1; goto ex;}
|
{done = 1; goto ex;}
|
||||||
usleep(usleep_time);
|
if (usleep_time > 0)
|
||||||
|
usleep(usleep_time);
|
||||||
if (d->cancel)
|
if (d->cancel)
|
||||||
{done = 1; goto ex;}
|
{done = 1; goto ex;}
|
||||||
if (burn_sg_log_scsi & 3)
|
if (burn_sg_log_scsi & 3)
|
||||||
|
@ -111,12 +111,20 @@ int scsi_eval_cmd_outcome(struct burn_drive *d, struct command *c, void *fp_in,
|
|||||||
int duration, time_t start_time, int timeout_ms,
|
int duration, time_t start_time, int timeout_ms,
|
||||||
int loop_count, int flag);
|
int loop_count, int flag);
|
||||||
|
|
||||||
|
|
||||||
/* The waiting time before eventually retrying a failed SCSI command.
|
/* The waiting time before eventually retrying a failed SCSI command.
|
||||||
Before each retry wait Libburn_scsi_retry_incR longer than with
|
Before each retry wait Libburn_scsi_retry_incR longer than with
|
||||||
the previous one.
|
the previous one. At most wait for Libburn_scsi_retry_umaX microseconds.
|
||||||
*/
|
*/
|
||||||
#define Libburn_scsi_retry_usleeP 100000
|
#define Libburn_scsi_retry_usleeP 100000
|
||||||
#define Libburn_scsi_retry_incR 100000
|
#define Libburn_scsi_retry_incR 100000
|
||||||
|
#define Libburn_scsi_retry_umaX 500000
|
||||||
|
|
||||||
|
/* The retry waiting time for commands WRITE(10) and WRITE(12).
|
||||||
|
*/
|
||||||
|
#define Libburn_scsi_write_retry_usleeP 0
|
||||||
|
#define Libburn_scsi_write_retry_incR 2000
|
||||||
|
#define Libburn_scsi_write_retry_umaX 25000
|
||||||
|
|
||||||
|
|
||||||
/* ts B11124 */
|
/* ts B11124 */
|
||||||
|
Loading…
Reference in New Issue
Block a user