Hi,

On Fri, Apr 14, 2000 at 06:15:09PM +1000, Andrew Clausen wrote:
> 
> Any comments?

Yes!

> Date: Fri, 14 Apr 2000 08:10:10 -0400
> Message-Id: <[EMAIL PROTECTED]>
> From: Paul Barton-Davis <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [linux-audio-dev] info point on linux hdr
> Sender: [EMAIL PROTECTED]
> Precedence: bulk
> X-Mozilla-Status2: 00000000
> 
> i mentioned in some remarks to benno how important i thought it was to
> preallocate the files used for hard disk recording under linux.

Preallocation will make little difference.  The real issue is that the
buffer cache is doing write-behind, ie. it is batching up the writes into
big chunks which get blasted to disk once every five seconds or so,
causing large IO request queues to accumulate when that happens.

That's great for normal use because it means that trickles of write
activity don't tie up the spindles the whole time, but it's not ideal
for audio recording.

Try opening the file with open(O_SYNC), and write the data in 128k chunks
or so.  Alternatively call fsync() every so often to force the data to 
disk (though fsync is not particularly efficient on large files with
2.2).  

The down-side of O_SYNC is that the application blocks until all the
data is on disk, but the benefit is that the IO queue size is much more
controlled.  If you have a dedicated thread doing the disk IO, then the
latency of blocking while the IO happens is irrelevant.

--Stephen

Reply via email to