Re: question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN

2015-07-21 Thread Alex Lyakas
Hi Filipe, Chris, I did more profiling work, and I want to writeup some of the things I noticed. Hopefully it has some value for the community. # btrfs_transaction.dirty_pages: This "extent_io_tree" includes every eb created by btrfs_init_new_buffer (this is the only function that adds dirty exte

Re: question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN

2015-07-13 Thread Chris Mason
On Mon, Jul 13, 2015 at 06:55:29PM +0200, Alex Lyakas wrote: > Filipe, > Thanks for the explanation. Those reasons were not so obvious for me. > > Would it make sense not to COW the block in case-1, if we are mounted > with "notreelog"? Or, perhaps, to check that the block does not belong > to a l

Re: question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN

2015-07-13 Thread Alex Lyakas
Filipe, Thanks for the explanation. Those reasons were not so obvious for me. Would it make sense not to COW the block in case-1, if we are mounted with "notreelog"? Or, perhaps, to check that the block does not belong to a log tree? The second case is more difficult. One problem is that BTRFS_HE

Re: question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN

2015-07-13 Thread Filipe David Manana
On Sun, Jul 12, 2015 at 6:15 PM, Alex Lyakas wrote: > 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 no

question about should_cow_block() and BTRFS_HEADER_FLAG_WRITTEN

2015-07-12 Thread Alex Lyakas
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