Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Sep 1999 04:48:01 -0400
From:      bill@twwells.com (T. William Wells)
To:        freebsd-questions@freebsd.org
Subject:   Re: softupdates: do I understand this correctly?
Message-ID:  <7scpec$2eok$1@twwells.com>
References:  <58A002A02C5ED311812E0050044517F00D23BA@erlangen01.axis.de>

next in thread | previous in thread | raw e-mail | index | archive | help
There are four modes:

mode            speed   safety          caching
async           fast    dangerous       almost everything
sync            slow    absurdly safe   nothing
normal          ok      safe            file data only
softupdates     fast    safe            almost everything

Async and sync modes are the simplest. In async mode, essentially
all disk write requests are done by writing the data into the
buffer cache and letting the buffer cache code write the data to
the disk whenever it gets around to it. In sync mode, when a disk
block is to be modified, it is immediately written to the disk.

Async mode is fast and risky, if your machine has any chance of
crashing. Sync mode is slow and only makes sense when you don't
want even the occasional glitches that come with the normal fsck
recovery. (The most common of those is data that was just being
appended to a file at the time of the crash -- it may come out as
nuls instead.)

In the normal mode *and* with softupdates, file data blocks are
sent to the buffer cache and written whenever the system gets
around to it. "Metadata", that's the inodes, directory entries,
and whatnot, is written in a controlled manner, instead of
whenever the system feels like it. The reason for this is to
ensure that if the system should just stop, fsck will find the
system in a state from which it can infer a consistent (and
usually correct) state for the file system.

Softupdates and the normal mode differ in *how* they control the
writes of the metadata. In the normal mode, the code that updates
the metadata requests operations in a particular order and waits
for each operation to complete before going on to the next
operation. With softupdates, the blocks are written to the buffer
cache and the buffer cache code writes the metadata when it feels
like it -- *EXCEPT* that if there is a required ordering of data
to ensure that fsck will be happy, the buffer cache code won't
write things that violate that order.

None of these modes affect *reads* from the disk. None of these,
except sync mode, affect writes of *data* to the disk. Async mode
and softupdates mode have a significant effect only on file
creation, deletion, and renaming. If you're doing a lot of those,
either of these modes can speed up your system dramatically.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7scpec$2eok$1>