Newsgroups: comp.os.minix
Subject: Re: minix filesystem
References: <39e757bb_1@news.iglou.com> <Pine.GSO.4.10.10010141024270.3534-100000@iwaki>
Organization: Rochester Institute of Technology, Rochester, NY
From: aje9383@osfmail.isc.rit.edu (Andrew Erickson)
NNTP-Posting-Host: grace.isc.rit.edu
X-Original-NNTP-Posting-Host: grace.isc.rit.edu
Message-ID: <39e888b0@news.isc.rit.edu>
Date: 14 Oct 2000 12:24:16 -0500
X-Trace: 14 Oct 2000 12:24:16 -0500, grace.isc.rit.edu
Lines: 41
XPident: aje9383
X-Original-NNTP-Posting-Host: 129.21.4.100
XPident: Unknown
Path: news.adfa.edu.au!clarion.carno.net.au!news0.optus.net.au!news1.optus.net.au!optus!skywalker.ou.edu!feed1.news.rcn.net!rcn!howland.erols.net!bloom-beacon.mit.edu!news.kodak.com!news-nysernet-16.sprintlink.net!news.sprintlink.net!news.isc.rit.edu!aje9383
Xref: news.adfa.edu.au comp.os.minix:35915

In article <Pine.GSO.4.10.10010141024270.3534-100000@iwaki>,
Ben  <s3109345@iwaki.anu.edu.au> wrote:
<Things rearranged to put all the quotes in order at the top>
>On 13 Oct 2000 bmarcum@iglou.com wrote:
>> On 2000-10-13 xlfhf6hrs5o.fsf@neuromancer.informatik.uni-tuebingen.de said:
>>    >The problem I am having is that I need a way of checking
>>    >to see if the buffer cache is clean(ie has been flushed).
>>    >Then if the buffer cache is clean then I need to mark the
>>    >filesystem as clean. I do not want to use fsck.
>>
>> "sync" should flush the buffers.  Why don't you want to use fsck?
>
>   I don't want to use fsck, because it takes too long. ANd
>I don't want to run fsck or sync on a filesystem that is already 
>clean. If linux crashes or there is power failure, then the filesystem
>might be marked as unclean even if it is clean. I just need to check if
>its clean, then mark it clean if it is clean, if its dirty then I will 
>run fsck or sync.

I believe the usual way of dealing with this is to just run fsck when a
filesystem is marked as dirty on startup.  Sometimes, this is unneeded;
however, it's already an exceptional condition (or, at least, it should
be) when the system is started up without being shut down properly, and
thus the filesystems are marked as dirty.  The extra time is not really
a big concern when it doesn't happen at all frequently.

Realistically, you'd have to do pretty much what fsck is doing already;
the only way to determine if a (traditional UNIX) file system is incon-
sistant is to run (most of) the checks performed by fsck.  [This is not
true of some other file system designs; in particular, journaling takes
away the need of lengthy consistancy checks, as does the BSD-style syn-
chronous operation mode.]

sync isn't really applicable to this situation.  It exists to flush the
buffer cache, of course; but when you are starting up after a crash, it
is impossible to know what the buffer cache used to be so it can be put
in place on disk.  Flushing the cache is probably one of the last parts
of shutting down, just before marking the filesystem as clean.

Hope this helps,
--Andrew
