Gave up cdrskin specific O_DIRECT compile option
This commit is contained in:
parent
81b74cc951
commit
5a70b9b6de
@ -397,14 +397,16 @@ drive. See man page section FILES for a way to lift that ban.
|
|||||||
|
|
||||||
Special compilation variations
|
Special compilation variations
|
||||||
|
|
||||||
All following options of cdrskin/compile_cdrskin.sh are combinable.
|
All following options of ./configure and cdrskin/compile_cdrskin.sh are
|
||||||
|
combinable.
|
||||||
|
|
||||||
In some situations Linux delivers a better write performance to drives if
|
In some situations Linux may deliver a better write performance to drives if
|
||||||
the track input is read with O_DIRECT (see man 2 open). The input reader of
|
the track input is read with O_DIRECT (see man 2 open). The API call
|
||||||
the cdrskin fifo can be told to use this peculiar read mode by :
|
burn_os_open_track_src() and the input readers of cdrskin and libburn fifo
|
||||||
cdrskin/compile_cdrskin.sh -o_direct
|
can be told to use this peculiar read mode by:
|
||||||
|
--enable-track-src-odirect
|
||||||
|
|
||||||
But typically cdrskin option dvd_obs=64k will yield even better performance in
|
But often cdrskin option dvd_obs=64k will yield even better performance in
|
||||||
such a situation. 64k can be made default at compile time by
|
such a situation. 64k can be made default at compile time by
|
||||||
cdrskin/compile_cdrskin.sh -dvd_obs_64k
|
cdrskin/compile_cdrskin.sh -dvd_obs_64k
|
||||||
It can also be enabled at configure time by
|
It can also be enabled at configure time by
|
||||||
|
@ -25,9 +25,10 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#ifdef Cdrskin_read_o_direcT
|
#ifndef Cdrfifo_standalonE
|
||||||
#include <sys/mman.h>
|
/* <<< until release of 0.7.4 : for Libburn_has_open_trac_srC */
|
||||||
#endif /* Cdrskin_read_o_direcT */
|
#include "../libburn/libburn.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cdrfifo.h"
|
#include "cdrfifo.h"
|
||||||
|
|
||||||
@ -179,19 +180,14 @@ int Cdrfifo_new(struct CdrfifO **ff, int source_fd, int dest_fd,
|
|||||||
o->next= o->prev= NULL;
|
o->next= o->prev= NULL;
|
||||||
o->chain_idx= 0;
|
o->chain_idx= 0;
|
||||||
|
|
||||||
#ifdef Cdrskin_read_o_direcT
|
#ifdef Libburn_has_open_trac_srC
|
||||||
if(flag & 1)
|
o->buffer= burn_os_alloc_buffer((size_t) buffer_size, 0);
|
||||||
fprintf(stderr,"cdrfifo: DEBUG : allocating fifo buffer via mmap()\n");
|
|
||||||
o->buffer= mmap(NULL, (size_t) buffer_size, PROT_READ | PROT_WRITE,
|
|
||||||
MAP_SHARED | MAP_ANONYMOUS, -1, (off_t) 0);
|
|
||||||
if(o->buffer == MAP_FAILED)
|
|
||||||
goto failed;
|
|
||||||
#else
|
#else
|
||||||
o->buffer= TSOB_FELD(char,buffer_size);
|
o->buffer= TSOB_FELD(char,buffer_size);
|
||||||
|
#endif /* ! Libburn_has_open_trac_srC */
|
||||||
|
|
||||||
if(o->buffer==NULL)
|
if(o->buffer==NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
#endif /* ! Cdrskin_read_o_direcT */
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
failed:;
|
failed:;
|
||||||
Cdrfifo_destroy(ff,0);
|
Cdrfifo_destroy(ff,0);
|
||||||
@ -243,11 +239,11 @@ int Cdrfifo_destroy(struct CdrfifO **ff, int flag)
|
|||||||
free((char *) o->iso_fs_descr);
|
free((char *) o->iso_fs_descr);
|
||||||
|
|
||||||
if(o->buffer!=NULL)
|
if(o->buffer!=NULL)
|
||||||
#ifdef Cdrskin_read_o_direcT
|
#ifdef Libburn_has_open_trac_srC
|
||||||
munmap(o->buffer, o->buffer_size);
|
burn_os_free_buffer(o->buffer, o->buffer_size, 0);
|
||||||
#else
|
#else
|
||||||
free((char *) o->buffer);
|
free((char *) o->buffer);
|
||||||
#endif /* Cdrskin_read_o_direcT */
|
#endif /* Libburn_has_open_trac_srC */
|
||||||
|
|
||||||
free((char *) o);
|
free((char *) o);
|
||||||
(*ff)= NULL;
|
(*ff)= NULL;
|
||||||
@ -681,15 +677,12 @@ after_write:;
|
|||||||
if(o->source_fd>=0) if(FD_ISSET((o->source_fd),rds)) {
|
if(o->source_fd>=0) if(FD_ISSET((o->source_fd),rds)) {
|
||||||
can_read= o->buffer_size - o->write_idx;
|
can_read= o->buffer_size - o->write_idx;
|
||||||
|
|
||||||
#ifdef Cdrskin_read_o_direcT
|
#ifdef Libburn_has_open_trac_srC
|
||||||
|
|
||||||
/* ts A91115
|
/* ts A91115
|
||||||
This chunksize must be aligned to filesystem blocksize.
|
This chunksize must be aligned to filesystem blocksize.
|
||||||
One might try to inquire the block size behind o->source_fd, but since
|
|
||||||
O_DIRECT is a dirty hack anyway, i just guess that 64 KiB is divisible
|
|
||||||
by any existing block size on Linux.
|
|
||||||
*/
|
*/
|
||||||
#define Cdrfifo_o_direct_chunK 65536
|
#define Cdrfifo_o_direct_chunK 32768
|
||||||
|
|
||||||
if(o->write_idx < o->read_idx && o->write_idx + can_read > o->read_idx)
|
if(o->write_idx < o->read_idx && o->write_idx + can_read > o->read_idx)
|
||||||
can_read= o->read_idx - o->write_idx;
|
can_read= o->read_idx - o->write_idx;
|
||||||
@ -721,7 +714,7 @@ after_write:;
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#else /* Cdrskin_read_o_direcT */
|
#else /* Libburn_has_open_trac_srC */
|
||||||
|
|
||||||
if(can_read>o->chunk_size)
|
if(can_read>o->chunk_size)
|
||||||
can_read= o->chunk_size;
|
can_read= o->chunk_size;
|
||||||
@ -734,7 +727,7 @@ after_write:;
|
|||||||
if(can_read>0)
|
if(can_read>0)
|
||||||
ret= read(o->source_fd,o->buffer+o->write_idx,can_read);
|
ret= read(o->source_fd,o->buffer+o->write_idx,can_read);
|
||||||
|
|
||||||
#endif /* ! Cdrskin_read_o_direcT */
|
#endif /* ! Libburn_has_open_trac_srC */
|
||||||
|
|
||||||
if(ret==-1) {
|
if(ret==-1) {
|
||||||
|
|
||||||
|
@ -152,6 +152,9 @@ or
|
|||||||
*/
|
*/
|
||||||
#define Cdrskin_libburn_has_fsync_obS 1
|
#define Cdrskin_libburn_has_fsync_obS 1
|
||||||
|
|
||||||
|
/* >>> do not forget to remove Libburn_has_open_trac_srC at release of 0.7.4 */
|
||||||
|
|
||||||
|
|
||||||
#endif /* Cdrskin_libburn_0_7_3 */
|
#endif /* Cdrskin_libburn_0_7_3 */
|
||||||
|
|
||||||
#ifndef Cdrskin_libburn_versioN
|
#ifndef Cdrskin_libburn_versioN
|
||||||
@ -343,23 +346,6 @@ or
|
|||||||
/** Verbosity level for fifo debugging */
|
/** Verbosity level for fifo debugging */
|
||||||
#define Cdrskin_verbose_debug_fifO 4
|
#define Cdrskin_verbose_debug_fifO 4
|
||||||
|
|
||||||
#ifdef Cdrskin_read_o_direcT
|
|
||||||
/* Linux 2.6.18:
|
|
||||||
This can avoid low write speed via USB with 32 KB SCSI write chunks.
|
|
||||||
64 KB write chunking is 20% more effective, though, and this size is
|
|
||||||
not in need for O_DIRECT.
|
|
||||||
Strange: Vanilla read() brings USB 32 KB WRITE down from 11x to 7.5x.
|
|
||||||
Throughput from /dev/zero to /dev/null is 230x. The disk delivers 56x.
|
|
||||||
Clearly Linux USB has a problem with 32 KB chunks. read() without O_DIRECT
|
|
||||||
makes it worse.
|
|
||||||
cdrecord and growisofs bring 11x. At least growisofs uses O_DIRECT for its
|
|
||||||
fifo input.
|
|
||||||
*/
|
|
||||||
# ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE
|
|
||||||
# endif
|
|
||||||
#endif /* Cdrskin_read_o_direcT */
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -1319,7 +1305,7 @@ int Cdrtrack_seek_isosize(struct CdrtracK *track, int fd, int flag)
|
|||||||
bit0=debugging verbosity
|
bit0=debugging verbosity
|
||||||
bit1=open as source for direct write:
|
bit1=open as source for direct write:
|
||||||
no audio extract, no minimum track size
|
no audio extract, no minimum track size
|
||||||
bit2=permission to use O_DIRECT (if enabled at compile time)
|
bit2=permission to use burn_os_open_track_src() (evtl O_DIRECT)
|
||||||
@return <=0 error, 1 success
|
@return <=0 error, 1 success
|
||||||
*/
|
*/
|
||||||
int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
||||||
@ -1410,17 +1396,13 @@ int Cdrtrack_open_source_path(struct CdrtracK *track, int *fd, int flag)
|
|||||||
if(is_wav==-3)
|
if(is_wav==-3)
|
||||||
return(0);
|
return(0);
|
||||||
if(is_wav==0) {
|
if(is_wav==0) {
|
||||||
#ifdef Cdrskin_read_o_direcT
|
#ifdef Libburn_has_open_trac_srC
|
||||||
if(flag & 4) {
|
if(flag & 4)
|
||||||
*fd= open64(track->source_path, O_RDONLY | O_DIRECT);
|
*fd= burn_os_open_track_src(track->source_path, O_RDONLY, 0);
|
||||||
if(flag & 1)
|
else
|
||||||
fprintf(stderr,"cdrskin: DEBUG : opened track inlet O_DIRECT\n");
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
*fd= open(track->source_path, O_RDONLY);
|
*fd= open(track->source_path, O_RDONLY);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(*fd==-1) {
|
if(*fd==-1) {
|
||||||
fprintf(stderr,"cdrskin: failed to open source address '%s'\n",
|
fprintf(stderr,"cdrskin: failed to open source address '%s'\n",
|
||||||
track->source_path);
|
track->source_path);
|
||||||
@ -1603,7 +1585,7 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno,
|
|||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
struct burn_track *tr;
|
struct burn_track *tr;
|
||||||
struct burn_source *src= NULL;
|
struct burn_source *src= NULL, *fd_src= NULL;
|
||||||
double padding,lib_padding;
|
double padding,lib_padding;
|
||||||
int ret,sector_pad_up;
|
int ret,sector_pad_up;
|
||||||
double fixed_size;
|
double fixed_size;
|
||||||
@ -1660,6 +1642,33 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno,
|
|||||||
}
|
}
|
||||||
src= burn_fd_source_new(track->source_fd,-1,(off_t) fixed_size);
|
src= burn_fd_source_new(track->source_fd,-1,(off_t) fixed_size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define Cdrskin_try_libburn_fifO 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef Cdrskin_try_libburn_fifO
|
||||||
|
|
||||||
|
if(src != NULL) {
|
||||||
|
int fifo_enabled, fifo_size, fifo_start_at;
|
||||||
|
int Cdrskin_get_fifo_par(struct CdrskiN *skin, int *fifo_enabled,
|
||||||
|
int *fifo_size, int *fifo_start_at, int flag);
|
||||||
|
|
||||||
|
Cdrskin_get_fifo_par(track->boss, &fifo_enabled, &fifo_size, &fifo_start_at,
|
||||||
|
0);
|
||||||
|
if(fifo_size <= 0) { /* currently: hardcoded 32m if fs=0 */
|
||||||
|
fd_src= src;
|
||||||
|
|
||||||
|
/* >>> ??? will chunksize 2048 work with audio ? */
|
||||||
|
|
||||||
|
src= burn_fifo_source_new(fd_src, 2048, 16384, 1);
|
||||||
|
|
||||||
|
fprintf(stderr, "cdrskin_DEBUG: %s 32m libburn fifo\n",
|
||||||
|
src != NULL ? "installed" : "failed to install");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if(src==NULL) {
|
if(src==NULL) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"cdrskin: FATAL : Could not create libburn data source object\n");
|
"cdrskin: FATAL : Could not create libburn data source object\n");
|
||||||
@ -1672,6 +1681,8 @@ int Cdrtrack_add_to_session(struct CdrtracK *track, int trackno,
|
|||||||
burn_session_add_track(session,tr,BURN_POS_END);
|
burn_session_add_track(session,tr,BURN_POS_END);
|
||||||
ret= 1;
|
ret= 1;
|
||||||
ex:
|
ex:
|
||||||
|
if(fd_src!=NULL)
|
||||||
|
burn_source_free(fd_src);
|
||||||
if(src!=NULL)
|
if(src!=NULL)
|
||||||
burn_source_free(src);
|
burn_source_free(src);
|
||||||
return(ret);
|
return(ret);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2009.11.23.185725"
|
#define Cdrskin_timestamP "2009.11.23.193252"
|
||||||
|
@ -60,9 +60,6 @@ do
|
|||||||
elif test "$i" = "-no_largefile"
|
elif test "$i" = "-no_largefile"
|
||||||
then
|
then
|
||||||
largefile_opts=
|
largefile_opts=
|
||||||
elif test "$i" = "-o_direct"
|
|
||||||
then
|
|
||||||
def_opts="$def_opts -DCdrskin_read_o_direcT"
|
|
||||||
elif test "$i" = "-dvd_obs_64k"
|
elif test "$i" = "-dvd_obs_64k"
|
||||||
then
|
then
|
||||||
def_opts="$def_opts -DCdrskin_dvd_obs_default_64K"
|
def_opts="$def_opts -DCdrskin_dvd_obs_default_64K"
|
||||||
@ -88,7 +85,6 @@ do
|
|||||||
echo " -compile_dewav compile program test/dewav without libburn."
|
echo " -compile_dewav compile program test/dewav without libburn."
|
||||||
echo " -libburn_0_7_2 set macro to match libburn-0.7.2"
|
echo " -libburn_0_7_2 set macro to match libburn-0.7.2"
|
||||||
echo " -libburn_svn set macro to match current libburn-SVN."
|
echo " -libburn_svn set macro to match current libburn-SVN."
|
||||||
echo " -o_direct use open(O_DIRECT) on fifo input (Linux only)."
|
|
||||||
echo " -dvd_obs_64k 64 KB default size for DVD/BD writing."
|
echo " -dvd_obs_64k 64 KB default size for DVD/BD writing."
|
||||||
echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin."
|
echo " -do_not_compile_cdrskin omit compilation of cdrskin/cdrskin."
|
||||||
echo " -experimental use newly introduced libburn features."
|
echo " -experimental use newly introduced libburn features."
|
||||||
|
Loading…
Reference in New Issue
Block a user