Comment 147 for bug 317781

Revision history for this message
Theodore Ts'o (tytso) wrote :

@Carey,

>Theo, does that then imply that setting the writeback time to the
>journal commit time (5 seconds) would also largely eliminate the
>unpopular behavior?

You'd need to set it to be substantially smaller than the journal commit time, (half the commit time or smaller), since the two timers are not correlated. Furthermore, the VM subsystem doesn't write dirty pages as soon as the the expiration time goes off. It stages the writes over several writeback windows, to avoid overloading the hard drive with background writes (which are intended to be asynchronous). So the answer is yes, you could probably do it by adjusting timers, but you'd probably need to up the journal commit time as well as decreasing the dirty_writeback and dirty_expire timers.

>How much of the benefit of delayed allocation do we lose by waiting a
>couple seconds rather than minutes or tens of seconds? Any large
>write could easily be happening over a longer period than any
>reasonable writeback time, and so those cases should already be
>allocating their eventual size immediately (think torrents or a long
>running file copy).

Well, yes, but that means modifying more application code (which most people on this thread seems to think is a hopeless cause :-P). Also, it's only been in the latest glibc in CVS that there is access the fallocate() system call. Current glibc has posix_fallocate(), but the problem with posix_fallocate() is that it tries to simulate fallocate on filesystems (such as ext3) which doesn't support it via writing zero's into the file. So posix_fallocate() is a bit of a performance disaster on filesystems that don't support fallocate(). If you use the fallocate() system call directly, it will return a error (ENOTSUPP, if I recall correctly) if the file system doesn't support it, which is what you want in this case.

The reality is that almost none of the appliations which are writing big files are using fallocate() today. They should, especially bittorent clients, but most of them do not --- just as many applications aren't calling fsync() even though POSIX demands it if there is a requirement that the file be written onto stable storage.