bdflush
is used to start the kernel daemon to flush dirty buffers back to disk. The
actual dirty work is in a kernel function, and bdflush actually forks a new
process which then calls the kernel function that will never return.
bdflush
actually forks a second daemon as well, and this one acts like a more
traditional update process, except that buffers are not considered ready to be
written until they have aged a bit. The clock starts when the buffer is
brelsed with the dirty bit set, and the buffer will not be written back until
an interval passes. The interval is different for data buffers and for
metadata buffers (like directories, bitmaps, indirect blocks, etc), and the
current settings are displayed by bdflush when you run it with arguments on
the command line. The defaults are 30 seconds for data buffers and 5 seconds
for metadata buffers.
The two daemons are normally started in /etc/rc with one command:
/sbin/update
Note that you need to have both daemons running because each one serves a
different purpose. Note also that this command should be run
before any major I/O is performed. In particular, update should be
called before any filesystems are fsck'ed or mounted read-write.
When bdflush is called by a user without superuser priveledges, it
calls flush() and sync() and then exits. Mustn't have 20 update
daemons running at a time...