9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Francisco J Ballesteros <nemo@lsub.org>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] The creepy WORM. (was: Re: Thinkpad T61 Installation Experience)
Date: Sun, 20 May 2012 12:07:16 +0200	[thread overview]
Message-ID: <E440EC45-FAA3-4817-89ED-5259358A8835@lsub.org> (raw)
In-Reply-To: <20120520031308.C9D3EB827@mail.bitblocks.com>




On May 20, 2012, at 5:13 AM, Bakul Shah <bakul@bitblocks.com> wrote:

> 
> How often would you flush to disk? You still need to worry about the order
> of writing metadata.
> 

that's the nice thing. it's so simple I don't have to worry about order. you write new
blocks and, once all of them reached the disk without errors, you write a new super with
the address of a new root. if you fail before the super is written, you have the old tree,
otherwise, you get the new one. the super has two copies of its data, in case you fail
in the middle of writing it, if they don't match, you use the oldest one.

The tmr proc writes new versions of the tree on a periodic basis and also if the
number of dirty (of memory addressed, actually) blocks exceeds some value.


> You do have to keep track of free disk blocks. On disk. So a linked list
> would require you visit every freed block.
> 


There's no linked list either :)
There's a mark per block, an epoch number, so you have one block with marks
for each block group. all blocks given addresses on disk use the current value for the
mark or epoch. when you want to collect more free blocks, you traverse the tree and update
the mark for blocks. After that, you increment the value for the mark that is used to recognize
free blocks.

Of course you could fail at any time, and, again, if you do that before writing the new
super the only thing that happens is that you'll have to mark again the blocks (you
prune the mark process when you find that the block visited already has the correct mark
value).

This was actually the code I had in place to double check that the previous implementation
for free block management was correct, but I noticed that it was both doing the job, and 
not disturbing normal operation in the file system, so I removed the management code and
declared this debug check the actual algorithm.


> I think an incore FS the easy case but you will have to face
> the issues of corner/boundary cases, various error conditions
> and efficiency when dealing with real disks. These things are
> what introduce complexity and bugs. "Soft updates" in FFS took
> quite a while shake out bugs.  zfs took a long time.  Hammer
> fs of DragonFly took a while. Pretty much every FS design has
> taken a while to be rock solid.  Far longer than the original
> estimates of the designers I think.
> 


Yes, that's why I improved it mostly by removing features and simplifying algorithms
instead of using clever ones. It was not easy to do that, it had like three or four rewrites.
Funny it was a lot easier to write the first, much more complex, version of it.

There are no soft
updates now, because the log makes that unneeded. And the complex part of
log management, which is reclaiming unused blocks, is also gone because of the
naive, yet effective, algorithm used now.

But you are right. I spent most of the time fixing problems with disks that were full or
had faults injected at the worst times. The operation in non boundary cases was always
fine, even with the fancier implementation I used before.

Regarding memory and processors, the code is aggressive and tries to use everything
because the machine will be devoted just to serve files.


  parent reply	other threads:[~2012-05-20 10:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 12:24 [9fans] Thinkpad T61 Installation Experience Burton Samograd
2012-05-16 12:32 ` Bruce Ellis
2012-05-16 12:49   ` Burton Samograd
2012-05-16 13:00     ` Peter A. Cejchan
2012-05-16 14:43   ` Martin Harriss
2012-05-16 15:00     ` Skip Tavakkolian
     [not found]     ` <CAJSxfmLZE3aNGmMusb=ZJAwn1AZEHuDxCeXJrRLADn+WV0KUEw@mail.gmail.c>
2012-05-16 15:02       ` erik quanstrom
2012-05-16 16:06         ` Charles Forsyth
2012-05-16 13:14 ` David du Colombier
2012-05-16 13:23   ` sl
2012-05-16 16:19     ` Burton Samograd
2012-05-16 16:34       ` cinap_lenrek
2012-05-17 12:39         ` Burton Samograd
2012-05-17 13:12           ` Jack Norton
2012-05-17 13:29             ` Burton Samograd
2012-05-17 14:01             ` erik quanstrom
2012-05-17 15:37           ` cinap_lenrek
2012-05-17 15:45             ` Burton Samograd
2012-05-17 16:00               ` cinap_lenrek
2012-05-18 21:13                 ` [9fans] The creepy WORM. (was: Re: Thinkpad T61 Installation Experience) Nemo
2012-05-18 22:22                   ` Bakul Shah
2012-05-18 22:45                     ` Francisco J Ballesteros
2012-05-20  3:13                       ` Bakul Shah
2012-05-20  8:37                         ` Charles Forsyth
2012-05-20  8:38                         ` Charles Forsyth
2012-05-20 10:07                         ` Francisco J Ballesteros [this message]
2012-05-17 15:48             ` [9fans] Thinkpad T61 Installation Experience erik quanstrom
     [not found]             ` <D2A5C7470D67A54FACE86B838946D49D14E466F852@NJ4MSGSCR02.markit.pa>
2012-05-17 15:57               ` erik quanstrom
2012-05-17 16:09             ` David Romano
2012-05-17 16:26               ` erik quanstrom
2012-05-17 19:43                 ` [9fans] +t and bind (Was Re: Thinkpad T61 Installation Experience) David Romano
2012-05-18 14:48                   ` Ethan Grammatikidis
     [not found]         ` <CAM8pOuM+TDRPjkiWPENr_5qA0Mi5R=-ytmQSA1_ruUmQ54YbGw@mail.gmail.c>
2012-05-17 13:11           ` [9fans] Thinkpad T61 Installation Experience erik quanstrom
2012-05-17 13:28             ` Burton Samograd
2012-05-17 14:08           ` erik quanstrom
2012-05-17 14:49             ` Burton Samograd
2012-05-16 13:51   ` Nicolas Bercher
2012-05-16 14:05     ` erik quanstrom
2012-05-16 14:25       ` Charles Forsyth
2012-05-16 14:31       ` David du Colombier
     [not found]       ` <CAOw7k5jBKN2bxUov=Dagn1aL6nA_OORN+G8iPnkOzvf8mbScyw@mail.gmail.c>
2012-05-16 14:34         ` erik quanstrom
2012-05-16 14:18     ` David du Colombier
2012-05-16 14:21     ` cinap_lenrek
2012-05-16 14:36       ` erik quanstrom
2012-05-16 13:44 ` Nicolas Bercher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E440EC45-FAA3-4817-89ED-5259358A8835@lsub.org \
    --to=nemo@lsub.org \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).