linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Btrfsck memory usage reduce idea
@ 2016-03-07  5:42 Qu Wenruo
  2016-03-08  8:28 ` Satoru Takeuchi
  0 siblings, 1 reply; 9+ messages in thread
From: Qu Wenruo @ 2016-03-07  5:42 UTC (permalink / raw)
  To: btrfs

Hi,

As many have already known, "btrfs check" is a memory eater.

The problem is, btrfsck checks extent tree in a very comprehensive method.
1) Create extent_ref for each extent item with backref
2) Iterate all other trees to add extent ref
3) If one extent_ref with all ref/backref matches, it's deleted.

The method is good, can found any extent mismatch problem when checking 
extent tree. (Although it has already iterated the whole fs)
For a large enough filesystem, it may have tegas of extents, and memory 
is easy eaten up.


We hope to fix it in the following method:
1) Only check extent backref when iterating extent tree
    Unlike current implement, we check one extent item and its backref
    only.

    If one backref can't be reached, then it's an error and output (or
    try to fix).
    After iterating all backref of an extent item, all related memory is
    freed and we won't bother recording anything for later use.

    That's to say, we only care backref mismatch case when checking
    extent tree.
    Case like missing EXTENT_ITEM for some extent is not checked here.

2) Check extent ref while iterating other trees
    We only check forward-ref while iterating one tree.

    In this step, we only check forward-ref, so we can find the remaining
    problem like missing EXTENT_ITEM for given extent.

Any further advice/suggestion? Or is there anyone already doing such work?

Thanks,
Qu




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

end of thread, other threads:[~2016-03-23  1:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07  5:42 Btrfsck memory usage reduce idea Qu Wenruo
2016-03-08  8:28 ` Satoru Takeuchi
2016-03-08  8:46   ` Qu Wenruo
2016-03-09  0:13     ` Satoru Takeuchi
2016-03-18 18:18     ` David Sterba
2016-03-21  2:15       ` Qu Wenruo
2016-03-21  9:43         ` Duncan
2016-03-22 14:49         ` David Sterba
2016-03-23  1:12           ` Qu Wenruo

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