Steve Bergman wrote:
David Mansfield wrote:
I don't think this is necessarily safe to do. O_DIRECT adds additional requirements to the memory buffer's alignment and file position alignments. Unless you have audited the 'tar' source code, I think this is a bad idea.
Actually, I was just getting ready to follow up. Although the tar archive structure looks fine, and most of the files are OK, I HAVE FOUND CORRUPTION IN SOME FILES. So don't use that patch.
I wonder if the corruption has something to do with needing to ftruncate a file if the file does not precisely end at a block boundary(as the reference in my previous email mentions). I would have expected almost all files to not end on a block boundary so most of them should have been corrupt but most of them were OK you say?
OK. If that strategy does not work, how about the earlier suggestion of fadvise? Would that be safer? And can anyone provide an example of how fadvise64_64() is actually used? I'm not a C programmer.
-Steve
Nice. Looks like the right solution.