linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* About Chunk Tree recover
@ 2013-01-29 11:13 Miao Xie
  2013-01-29 15:33 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2013-01-29 11:13 UTC (permalink / raw)
  To: Linux Btrfs

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-29 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 11:13 About Chunk Tree recover Miao Xie
2013-01-29 15:33 ` Chris Mason

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).