Re: [Fwd: [linux-audio-dev] info point on linux hdr]

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [Fwd: [linux-audio-dev] info point on linux hdr]
From: Stephen C. Tweedie (sct_AT_redhat.com)
Date: Mon Apr 17 2000 - 16:58:03 EEST


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: <200004141210.IAA11954_AT_op.net>
> From: Paul Barton-Davis <pbd_AT_Op.Net>
> To: linux-audio-dev_AT_ginette.musique.umontreal.ca
> Subject: [linux-audio-dev] info point on linux hdr
> Sender: owner-linux-audio-dev_AT_ginette.musique.umontreal.ca
> 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


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon Apr 17 2000 - 17:39:38 EEST