bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] Slowness during recovery


From: colo
Subject: Re: [Bug-ddrescue] Slowness during recovery
Date: Tue, 23 Dec 2008 16:37:03 -0500

Digging up this old message from Rob Terrell.

Is there someone that can assist in helping out with patching it to 1.9? 

I made a modification to main.cc so to support ddrescue's direct mode ("-d") when running on Mac OS X or Darwin systems. It seems to work-- in my test case, without -d a volume copy (with around 300 errors) took more than twice as long.
I don't know enough about configure to make this compile in automatically; just use this to configure with O_DIRECT for Darwin/OSX:
./configure CPPFLAGS="-DO_DIRECT -DDARWIN"

Patch against 1.6 pre 2:

@@ -265,8 +265,19 @@
if( check_identical ( iname, oname ) )
{ show_error( "infile and outfile are identical" ); return 1; }
+#ifdef DARWIN
+ // darwin doesn't support o_direct as an option to open() but
+ // you can turn the cache off for a file descriptor with fnctl and F_NOCACHE
+ const int ides = open( iname, O_RDONLY );
+ if( ides < 0 ) { show_error( "cannot open input file", errno ); return 1; }
+ if( o_direct ) {
+ const int fcntlerr = fcntl( ides, F_NOCACHE, 1 );
+ if( fcntlerr < 0 ) { show_error("cannot disable file caching", errno); return 1;}
+ }
+#else
const int ides = open( iname, O_RDONLY | o_direct );
if( ides < 0 ) { show_error( "cannot open input file", errno ); return 1; }
+#endif
const long long isize = lseek( ides, 0, SEEK_END );
if( isize < 0 ) { show_error( "input file is not seekable" ); return 1; }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]