Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 1995 16:58:08 +0000 ()
From:      Remy.Card@masi.ibp.fr
To:        hackers@FreeBSD.org
Subject:   Filesystem clean flag
Message-ID:  <199503191658.QAA00122@bbj.ibp.fr>

next in thread | raw e-mail | index | archive | help

	I am currently studying the filesystem kernel code and I think that
the current clean flag implementation could be improved.  Currently, the
clean flag is set to 0 when a filesystem is mounted in read-write mode and
set to 1 when the filesystem is unmounted.  This way of doing things can be
a problem in some cases: suppose that a system crashes (so the filesystems
are marked as not clean), the system is rebooted in single user mode (so
fsck is not run at boot), and then goes to multiuser mode.  When the system
is subsequently rebooted in a proper way, the clean flag is set to 1, and,
voila, the filesystems are marked as clean for the next boot but they can
contain errors.

	Correcting this problem is trivial: when a filesystem is mounted in
read-write mode, store the value of the clean flag and restore this value in
the superblock when the filesystem is unmounted.

	Also, I have compared the clean flag implementation with my own
implementation in the Linux Ext2 filesystem and I found that FreeBSD does
not allow the administrator to request periodical checks of the filesystems.
In the Linux Ext2 fs, two fields are reserved in the superblock for this:
- a mount counter is incremented each time the filesystem is mounted in
read-write mode.  When this counter is greater than a maximal mount count
(also contained in the superblock and changeable with tunefs), fsck checks
the filesystem regardless of the clean flag value.
- a last check time and a check interval are also stored in the superblock.
When fsck checks a filesystem, it stores the current time in the last check
time.  When the current time is greater than (last_check_time + check_interval),
fsck checks the filesystem regardless of the clean value.  The check interval
can also be changed by using tunefs.

	Of course, both the mount counter and the check interval can be
disabled to obtain the same behavior as the FreeBSD's current one.

	I think that it would be worth implementing these features in FreeBSD.
I even think that I can come with a patch if people are interested but I'd like
to have your opinion before starting working on it.

	Please, no ``BSD vs Linux'' or ``UFS vs Ext2fs'' war! :-)

	Thanks

		Remy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503191658.QAA00122>