Re: HAMMER update 23-Mar-08

Previous thread: Re: HAMMER update 23-Mar-08 by Matthew Dillon on Monday, March 24, 2008 - 5:00 pm. (1 message)

Next thread: Re: HAMMER update 23-Mar-08 by Matthew Dillon on Tuesday, March 25, 2008 - 1:26 am. (1 message)
To: <kernel@...>
Date: Monday, March 24, 2008 - 11:02 pm

Making the 'hammer now' command do a sync() is a good idea. I will
make that change right now so it doesn't get lost.

Here's a general overview of the issues involved with having historical
access to the filesystem:

----------------

Recording the timestamps in the in-memory cache, for a finer-grained
snapshot capability, is doable but has its own issues. Here's an
illustration:

open() create file
write() append 4K (file size now 4K)
write() append 4K (file size now 8K)
write() append 4K (file size now 12K)
write() append 4K (file size now 16K)

Now NONE of this has gone to disk yet, it's entirely in the in-memory
cache. The inode is in the in-memory cache. The data is stored in
the buffer cache. Even the directory entry for the file that we
just created is still in the in-memory cache (HAMMER caches the raw
records it intends to commit later on).

If I wanted to be able to acquire a timestamp between each write and
'see' a snapshot of the file as of any point in the above sequence,
then every write would also have to allocate a copy of the inode
(because it changes size on each write).

The data has the same problem though with a slightly different example.
Lets say each write() was a seek-write, overwriting the previous data.
Now with every write() I would have to allocate a copy of the data
being overwritten. This is complicated by the fact that the buffer
cache has no clue about 'historical' accesses, so I would not be able
to use the buffer cache to cache the data.

There's also another problem and that is with the efficiency of the
topology on-disk. Even if I maintained all the copies of the inode
and all the copies of the data in-memory, I would still have to sync
all those copies to disk in order for things to remain historically
coherent (whether it be in-cache or on-disk). This would result in
hundreds or even thous...

To: <kernel@...>
Date: Tuesday, March 25, 2008 - 12:16 am

So is it needed to run hammer now in order to "create" a snapshot? What would
I do in situation like this: got a hammer filesystem and couple of the files
change on day to day basis. Then a week later I needed to access one of the
files, in exactly the state they were 7 days ago.

Cheers,
Petr

Previous thread: Re: HAMMER update 23-Mar-08 by Matthew Dillon on Monday, March 24, 2008 - 5:00 pm. (1 message)

Next thread: Re: HAMMER update 23-Mar-08 by Matthew Dillon on Tuesday, March 25, 2008 - 1:26 am. (1 message)