[mythtv-users] Software RAID and ionice

Richard Freeman r-mythtv at thefreemanclan.net
Thu May 24 10:32:17 UTC 2007


David Rees wrote:
> On 5/23/07, Brian Walter <blwalter at gmail.com> wrote:
>> David Rees wrote:
>>> On 5/22/07, Richard Freeman <r-mythtv at thefreemanclan.net> wrote:
>>> This is one reason I wish mythtv didn't sync all writes to disk and
>>> instead let the OS handle it on it's own since then the OS could queue
>>> up the write and and write out the data when it can.
>> This is true?  mythtv syncs the disk after every write?  That *does*
>> explain a lot of behavior....
> 
> Sorry, I didn't mean sync (the whole disk) but flush (the file it's
> writing). I haven't actually confirmed this in the source, just going
> from what someone said a long time ago.
> 

Well, without fully tracing the code this would tend to suggest that you
are right:

mythtv-0.20 # grep -r -C 5 fsync *
libs/libmythtv/ThreadedFileWriter.cpp-    if (fd >= 0)
libs/libmythtv/ThreadedFileWriter.cpp-    {
libs/libmythtv/ThreadedFileWriter.cpp-#ifdef HAVE_FDATASYNC
libs/libmythtv/ThreadedFileWriter.cpp-        fdatasync(fd);
libs/libmythtv/ThreadedFileWriter.cpp-#else
libs/libmythtv/ThreadedFileWriter.cpp:        fsync(fd);
libs/libmythtv/ThreadedFileWriter.cpp-#endif
libs/libmythtv/ThreadedFileWriter.cpp-    }
libs/libmythtv/ThreadedFileWriter.cpp-}
libs/libmythtv/ThreadedFileWriter.cpp-
libs/libmythtv/ThreadedFileWriter.cpp-/** \fn
ThreadedFileWriter::SetWriteBufferSize(uint)

So, what happens if I just comment that out?  I don't have any kind of
unusual partition sharing arrangements going on - in theory if
mythbackend reads that file before it is written to disk the kernel
should pull the read out of memory and still find the correct data.  The
fsync should really only protect you from sudden power loss, and I'd
rather run that risk than have frames dropping all the time...


More information about the mythtv-users mailing list