From e1c12bbf57b1fb79f053c3ee49da0a2f979553bb Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 30 Aug 2015 18:57:44 +0000 Subject: [PATCH] New paramaters for option modesty_on_drive= timeout_sec, min_usec, max_usec --- cdrskin/cdrskin.1 | 36 ++++++++++++++++++++----- cdrskin/cdrskin.c | 52 ++++++++++++++++++++++++++++++++----- cdrskin/cdrskin_timestamp.h | 2 +- 3 files changed, 75 insertions(+), 15 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index 50a316d..fa784c5 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH CDRSKIN 1 "Version 1.4.1, Aug 01, 2015" +.TH CDRSKIN 1 "Version 1.4.1, Aug 30, 2015" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -1419,10 +1419,13 @@ With DVD-RW 32 kiB alignment is mandatory. .br Other media are not suitable for this option yet. .TP -.BI modesty_on_drive= [:min_percent=][:max_percent=] +.BI modesty_on_drive= [:parameter=[:parameter=...]] Mode 1 keeps the program from trying to write to the burner drive while its -buffer is in danger to be filled by more than max_percent. If this filling is -exceeded then the program will wait until the filling is at most min_percent. +buffer is in danger to be filled by more than parameter "max_percent". +If this filling is exceeded then the program will wait until the filling +is at most the value of parameter "min_percent". +.br +Percentages are permissible in the range of 25 to 100. .br This can ease the load on operating system and drive controller and thus help with achieving better input bandwidth if disk and burner are not on independent @@ -1430,18 +1433,37 @@ controllers (like hda and hdb). Unsufficient input bandwidth is indicated by output "(fifo xy%)" of option -v if xy is lower than 90 for some time. modesty_on_drive= might hamper output bandwidth and cause buffer underruns. .br +A new use case is to work around the poor simultaneous performance of multiple +burn runs on Linux kernel 3.16 and alike. Here it is not about giving the +hard disk enough time to fill the fifo, but about keeping ioctl(SG_IO) from +blocking for a longer time and thus blocking all other burn runs. +.br To have max_percent larger than the burner's best actual buffer fill has the same effect as min_percent==max_percent. Some burners do not use their full buffer with all media types. Watch output "[buf xy%]" of option -v to get an impression of the actual buffer usage. Some burners are not suitable because they report buffer fill with granularity too large -in size or time. +in size or time, or because they go to full speed only when their buffer is +full. +.br +If a write attempt is delayed, the program will wait for a number of +microseconds which is given by parameter "min_usec" before inquiring the buffer +again. iIf more retries occur, this waiting time between inquiries increases +up to the value of parameter "max_usec". +.br +If the delay lasts longer than the number of seconds given by parameter +"timeout_sec", then mode 1 is set 0 and normal burning goes on. .br Mode 0 disables this feature. Mode -1 keeps it unchanged. Default is: .br -modesty_on_drive=0:min_percent=65:max_percent=95 + 0:min_percent=65:max_percent=95:timeout_sec=120: + min_usec=10000:max_usec=100000 .br -Percentages are permissible in the range of 25 to 100. +The defaults of cdrskin are good for IDE problems. With concurrent Linux SG_IO +problems on modern hardware, higher min_percent and lower usec might yield +better buffer fills while still avoiding the problem: +.br + min_percent=90:max_percent=95:min_usec=5000:max_usec=25000 .PP Alphabetical list of options which are only intended for very special situations and not for normal use: diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 804ec50..6d98b0d 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -3466,6 +3466,9 @@ struct CdrskiN { bit31 : ignore bits 0 to 30 */ int modesty_on_drive; + int min_buffer_usec; /* The other parameters for this function */ + int max_buffer_usec; + int buffer_timeout_sec; int min_buffer_percent; int max_buffer_percent; @@ -3677,6 +3680,9 @@ int Cdrskin_new(struct CdrskiN **skin, struct CdrpreskiN *preskin, int flag) o->multi= 0; o->cdxa_conversion= 0; o->modesty_on_drive= 0; + o->buffer_timeout_sec= 120; + o->min_buffer_usec= 10000; + o->max_buffer_usec= 100000; o->min_buffer_percent= 65; o->max_buffer_percent= 95; o->write_start_address= -1.0; @@ -3973,7 +3979,8 @@ int Cdrskin_adjust_speed(struct CdrskiN *skin, int flag) burn_drive_set_speed(skin->drives[skin->driveno].drive,k_speed,k_speed); modesty= skin->modesty_on_drive; burn_drive_set_buffer_waiting(skin->drives[skin->driveno].drive, - modesty, -1, -1, -1, + modesty, skin->min_buffer_usec, + skin->max_buffer_usec, skin->buffer_timeout_sec, skin->min_buffer_percent, skin->max_buffer_percent); return(1); @@ -8793,12 +8800,12 @@ minbuf_equals:; } else if(strncmp(argv[i],"modesty_on_drive=",17)==0) { value_pt= argv[i]+17; - if(*value_pt=='0') { + if(*value_pt == '0' || strncmp(value_pt, "off", 3) == 0) { skin->modesty_on_drive= 0; if(skin->verbosity>=Cdrskin_verbose_cmD) ClN(printf( "cdrskin: modesty_on_drive=0 : buffer waiting by os driver\n")); - } else if(*value_pt=='1') { + } else if(*value_pt=='1' || strncmp(value_pt, "on", 2) == 0) { skin->modesty_on_drive= 1; if(skin->verbosity>=Cdrskin_verbose_cmD) ClN(printf( @@ -8826,8 +8833,10 @@ minbuf_equals:; return(0); } skin->min_buffer_percent= value; - ClN(printf("cdrskin: modesty_on_drive : %d percent min buffer fill\n", - skin->min_buffer_percent)); + if(skin->verbosity >= Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive : %d percent min buffer fill\n", + skin->min_buffer_percent)); } else if(strncmp(value_pt,"max_percent=",12)==0) { sscanf(value_pt+12,"%lf",&value); if (value<25 || value>100) { @@ -8836,8 +8845,37 @@ minbuf_equals:; return(0); } skin->max_buffer_percent= value; - ClN(printf("cdrskin: modesty_on_drive : %d percent max buffer fill\n", - skin->max_buffer_percent)); + if(skin->verbosity >= Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive : %d percent max buffer fill\n", + skin->max_buffer_percent)); + } else if(strncmp(value_pt, "min_usec=", 9) == 0) { + sscanf(value_pt + 9, "%lf", &value); + if(value < 0) + value= 0; + skin->min_buffer_usec= value; + if(skin->verbosity >= Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive : %d microseconds minimum sleep time\n", + skin->min_buffer_usec)); + } else if(strncmp(value_pt,"max_usec=", 9)==0) { + sscanf(value_pt + 9, "%lf", &value); + if(value < 0) + value= 0; + skin->max_buffer_usec= value; + if(skin->verbosity >= Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive : %d microseconds maximum sleep time\n", + skin->max_buffer_usec)); + } else if(strncmp(value_pt,"timeout_sec=", 12)==0) { + sscanf(value_pt + 9, "%lf", &value); + if(value < 0) + value= 0; + skin->buffer_timeout_sec= value; + if(skin->verbosity >= Cdrskin_verbose_cmD) + ClN(printf( + "cdrskin: modesty_on_drive : %d seconds fallback timeout\n", + skin->max_buffer_usec)); } else { fprintf(stderr, "cdrskin: SORRY : modest_on_drive= unknown option code : %s\n", diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 77b788a..430f126 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2015.08.30.185208" +#define Cdrskin_timestamP "2015.08.30.185714"