All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: About Chunk Tree recover
Date: Tue, 29 Jan 2013 19:13:47 +0800	[thread overview]
Message-ID: <5107AEEB.2030106@cn.fujitsu.com> (raw)

Hi, everyone.

About 1 years ago, we implemented the chunk tree recover function,
but it has not been applied till now because that implementation
need change the disk format.
(http://marc.info/?l=linux-btrfs&m=129914269932543&w=2
 http://marc.info/?l=linux-btrfs&m=130976668006281&w=2
 http://marc.info/?l=linux-btrfs&m=129914269932543&w=2)

Recently, I reconsidered the implementation of this function, and
found a new approach that needn't change the disk format. That is
the external chunk tree backup, just like external journal device
of ext4. The basic idea is:

- specify a external file or device which is used to backup the
  chunk tree when mount.
- When mount, compare the super block in the external file/device
  with the super block of the btrfs, if the checksum of the super
  block in the externel file/device is right, and the FS UUID and
  generation are the same as the fs, it means the chunk tree in
  the external file/device is valid, needn't rebuild it. Otherwise,
  we will rebuild the chunk tree in the external file/device
  according to the chunk tree of the fs.
- When we allocate a new chunk, we will log the new chunk
  information into the external file/device
- sync the external file/device when committing the transaction
- If the chunk tree of the fs is corrupted, we use the information
  in the external file/device to recover it.
  
By this way, we needn't change disk format and also needn't do a
block device scan which need lots of time, and is very hard to
find the start address and length of a chunk.

Any comment for this idea?

Thanks
Miao

             reply	other threads:[~2013-01-29 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 11:13 Miao Xie [this message]
2013-01-29 15:33 ` About Chunk Tree recover Chris Mason

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=5107AEEB.2030106@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.