<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 1, 2013 at 6:48 AM, Fons Adriaensen <span dir="ltr"><<a href="mailto:fons@linuxaudio.org" target="_blank">fons@linuxaudio.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
No, it's just about the code to read/write the files - what<br>
it should do or not do in order to make it perform well with<br>
'smart' disk access threads which will have there own ways to<br>
organise buffering. If two (or more) such schemes are used on<br>
top of each other the result could be worse than with just<br>
one of them.<br></blockquote><div><br></div><div>linus has always insisted (rightly or wrongly) that user-space code should assume omnipotence and beneficence on the part of the kernel with respect to I/O. there are plenty of people who don't agree with him, hence things like the madvise() call. but i think that it is a pretty good bet for most cases. in ardour, the purpose of the disk i/o thread (the "butler") is primarily to organize buffering within user space based on observed (but very occasional) delays in I/O. it is not attempting to do better than the kernel in handling read-ahead and in fact for quite a lot of situations, ardour really does rely on the kernel's own buffering to do a good job. we only buffer "more" because of the delays that have been seen over the years, which suggest that is expedient to not rely on data being available from read() within any reliable time frame less than a few seconds.<br>
</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
* use mmap, read/write or stdio ?<br></blockquote><div><br></div><div>several years ago, linus told me in no uncertain terms not to use mmap for disk i/o. his perspective is that even though it works, the kernel is not developed or optimized with this in mind, and that normal streaming i/o interfaces like read/write will always be the right path.<br>
<br></div><div>if you use stdio, you add an additional, hidden layer of buffering that really provides very few benefits given that you will likely be reading/writing fairly large chunks already.<br><br></div><div>read and write are certainly my preference, although to handle the possibility of multithreaded access to the same file descriptor, pread and pwrite are attractive.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* any point in implementing things like gather/scatter, or<br>
  async access ?<br></blockquote><div><br></div><div>the kernel provides internal implementations of this, as does the firmware on almost any storage device. probably not worth reimplementing (especially given that you don't have any special knowledge about the device)<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
* for multichannel: offer de-interleaved access, sparse<br>
  channel sets, etc. ?<br></blockquote><div><br></div><div>seems application-centric. some cases would need this some would not.<br><br></div><div>i would still try to add support for this format to libsndfile, so as to gain all the benefits it offers from an application perspective.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
I have various use cases for such a library, one of them being<br>
to replace the private .ald format used by Aliki and some other<br>
apps. But the code should also work efficiently with e.g. a DAW<br>
having maybe a hundred files open at any time, and multiple<br>
streams from the same file.<br>
<div class="im HOEnZb"><br>
Ciao,<br>
<br>
--<br>
FA<br>
<br>
A world of exhaustive, reliable metadata would be an utopia.<br>
It's also a pipe-dream, founded on self-delusion, nerd hubris<br>
and hysterically inflated market opportunities. (Cory Doctorow)<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Linux-audio-dev mailing list<br>
<a href="mailto:Linux-audio-dev@lists.linuxaudio.org">Linux-audio-dev@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-dev" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a><br>
</div></div></blockquote></div><br></div></div>