[openbeos] Re: Aw: Re: sync daemon?

  • From: "François Revol" <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Fri, 19 Jan 2007 22:47:40 +0100 CET

> 
> > Marcus Overhagen <marcusoverhagen@xxxxxxxx> wrote:
> > > The FS shouldn't have to care about this. But the haiku vfs 
> > > should be made
> > > smart enough to cache access time changes, and not flush them to 
> > > disk unless
> > > there is another type of write access.
> > 
> > I'm not sure I understand you: do you mean it should write out 
> > older 
> > changes first, and wait a bit until recent changes are written?
> I meant it shouldn't flush, as long as there are only access-time 
> changes
> that need to be written. however, implementing that would be crude I 
> think.

What about something like :

struct fs_data {
...
uint32 dirty_stats;
};

notify_listener(fs, ..., uint32 what)
{
        ...

        if (fs->flags & FS_IS_REMOVABLE) {
                LOCK();
                // maybe atomic_or() instead of locking ?
                thefs->dirty_stats |= what;
                if (thefs->dirty_stats & ~CHANGED_ATIME) {
                        sync(fs);
                        thefs->dirty_stats = 0;
                }
                UNLOCK();
        }
}



François.

Other related posts: