linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN
@ 2015-07-12 17:15 Alex Lyakas
  2015-07-13  9:27 ` Filipe David Manana
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Lyakas @ 2015-07-12 17:15 UTC (permalink / raw)
  To: linux-btrfs, jbacik

Greetings,
Looking at the code of should_cow_block(), I see:

if (btrfs_header_generation(buf) == trans->transid &&
    !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN) &&
...
So if the extent buffer has been written to disk, and now is changed again 
in the same transaction, we insist on COW'ing it. Can anybody explain why 
COW is needed in this case? The transaction has not committed yet, so what 
is the danger of rewriting to the same location on disk? My understanding 
was that a tree block needs to be COW'ed at most once in the same 
transaction. But I see that this is not the case.

I am asking because I am doing some profiling of btrfs metadata work under 
heavy loads, and I see that sometimes btrfs COW's almost twice more tree 
blocks than the total metadata size.

Thanks,
Alex.


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

end of thread, other threads:[~2015-07-21 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-12 17:15 question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN Alex Lyakas
2015-07-13  9:27 ` Filipe David Manana
2015-07-13 16:55   ` Alex Lyakas
2015-07-13 17:02     ` Chris Mason
2015-07-21 14:11       ` Alex Lyakas

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