Re: [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: [linux-audio-dev] info point on linux hdr
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Sat Apr 22 2000 - 01:06:49 EEST


Hehe,
It's amazing that information get outdated within minutes
:-)

As Andreas pointed out, there is no portable/filesystem independent way to
discover the blocksize used by your FS.
The thing you are doing in ardour doens't allocate ALL blocks since
you are using 4096 increments (which is the preferred IO size = intel page
size), and is 4 times as big as the 1024 bytes used by ext2 by default.
Jussi used way to small testsizes therefore the results were not reliable.
(changing his example to 1024 increments gave the same performance as
pure write() calls).

copy_to_user action is just meaningless, since over a time of 80secs
where the 300MB file gets written, even if you optimize away ALL copies
you save the time it takes to copy 300MB from RAM to RAM, which is
0.5 - 1secs , that means at most % of performance increase.

summary: all those who tried to optimize with the lseek() thing, were wrong.

Benno.

On Fri, 21 Apr 2000, Paul Barton-Davis wrote:
> >> also, in the code you show, the ftruncate is redundant, because it
> >> doesn't allocate any blocks, and the point of preallocation (if there
> >> is one) is to get the blocks allocated in a certain way.
> >
> >It depends on where in the block we write the data. If we write data to
> >start of the block and without ftruncate() we get file size
> >
> >filesize = requested_file_size - blocksize + write_data_size
>
> Do you think I'm that sloppy ?
>
> I don't mean to sound sour about this, but for over a month, ardour
> has had working code to do this kind of file preallocation. I do it by
> writing the first byte of the file (*), jump by the fs blocksize, until i
> reach the end, then i write the last byte if the filesize wasn't an
> exact multiple of the fs blocksize.
>
> >I got little better preallocation performance with
> >ftruncate()/lseek()/write() compared to write() of full blocks.
>
> Sure, because there is less copy_to_user action going on.
>
> --p
>
> (*) more precisely, since the function in ardour can be used to extend
> existing files, the first byte beyond the current file size.

-- 


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

This archive was generated by hypermail 2b28 : Sat Apr 22 2000 - 00:46:40 EEST