linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* understanding the tree-log
@ 2011-11-04  3:21 Phillip Susi
  2011-11-04  5:09 ` Liu Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Phillip Susi @ 2011-11-04  3:21 UTC (permalink / raw)
  To: linux-btrfs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Given how a transaction is committed, why is there a tree-log?  When
modifying the tree, either the super block is still pointing to the
old tree root, or the new generation has been fully committed, so how
can there ever be an intermediate state that needs a log to recover?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6zWiwACgkQJ4UciIs+XuK+FQCfTnTIu8iYgW38Qk3YoZ4KjA/9
uhwAnjOH36EkQ1EhoUdWg7OJr+0L0lbA
=7DUz
-----END PGP SIGNATURE-----

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

* Re: understanding the tree-log
  2011-11-04  3:21 understanding the tree-log Phillip Susi
@ 2011-11-04  5:09 ` Liu Bo
  2011-11-04 13:35   ` Phillip Susi
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2011-11-04  5:09 UTC (permalink / raw)
  To: Phillip Susi; +Cc: linux-btrfs

On 11/04/2011 11:21 AM, Phillip Susi wrote:
> Given how a transaction is committed, why is there a tree-log?  When
> modifying the tree, either the super block is still pointing to the
> old tree root, or the new generation has been fully committed, so how
> can there ever be an intermediate state that needs a log to recover?

tree-log is for improving the preformance  of fsync and and O_SYNCs.

Btrfs has an expensive "commit transaction", if we commit a transaction every time we fsync,
the performance is not that good.  Instead of this, we introduce a write-ahead log to make
our fsync faster.

So if you do fsync for your data, it means your data is safely in the log tree,
then if a crash takes place, the data can be recovered from log.

More details are in tree-log.c.

thanks,
liubo

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

* Re: understanding the tree-log
  2011-11-04  5:09 ` Liu Bo
@ 2011-11-04 13:35   ` Phillip Susi
  0 siblings, 0 replies; 3+ messages in thread
From: Phillip Susi @ 2011-11-04 13:35 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On 11/4/2011 1:09 AM, Liu Bo wrote:
> Btrfs has an expensive "commit transaction", if we commit a transaction every time we fsync,
> the performance is not that good.  Instead of this, we introduce a write-ahead log to make
> our fsync faster.
>
> So if you do fsync for your data, it means your data is safely in the log tree,
> then if a crash takes place, the data can be recovered from log.

How can you write to the log tree without a full commit?  The tree of 
tree roots has to point to the root node of the log tree, so when you 
write out the log tree, that needs updated too, which requires a full 
commit doesn't it?


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

end of thread, other threads:[~2011-11-04 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04  3:21 understanding the tree-log Phillip Susi
2011-11-04  5:09 ` Liu Bo
2011-11-04 13:35   ` Phillip Susi

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