On 11/6/20 4:11 AM, Johannes Thumshirn wrote:
On 03/11/2020 15:43, Josef Bacik wrote:
This is a lot of work when you could just add
if (btrfs_is_zoned(fs_info))
return;
to btrfs_clean_tree_block(). The dirty secret is we don't actually unset the
bits in the transaction io tree because it would require memory allocation
sometimes, so you don't even need to mess with ->dirty_pages in the first place.
The only thing you need is to keep from clearing the EB dirty. In fact you
could just do
if (btrfs_is_zoned(fs_info)) {
memzero_extent_buffer(eb, 0, eb->len);
set_bit(EXTENT_BUFFER_NO_CHECK, &eb->bflags);
}
to btrfs_clean_tree_block() and then in btrfs_free_tree_block() make sure we
always pin the extent if we're zoned. Thanks,
As much as I'd love the simple solution you described it unfortunately didn't work
in our testing [1]. So unless I did something completely stupid [2] (which always
is an option) I don't think we can go with the easy solution here, unfortunately.
Actually it's because we're calling btrfs_clean_tree_block() in
btrfs_init_new_buffer(), so any new block is now getting marked as
BUFFER_NO_CHECk, hence everything blowing up.
I think first you push btrfs_clean_tree_block() into btrfs_free_tree_block() and
kill all other callers, because we're just marking it no longer dirty. In fact
I'd rename it as btrfs_mark_extent_buffer_clean() or something like that. Then
your patch should work just fine. Thanks,
Josef