On Fri, Aug 31, 2018 at 7:03 AM, Josef Bacik <jo...@toxicpanda.com> wrote: > On Fri, Aug 31, 2018 at 10:31:49AM +0300, Nikolay Borisov wrote: >> >> >> On 30.08.2018 20:42, Josef Bacik wrote: >> > We can actually allocate new chunks while we're creating our bg's, so >> > instead of doing list_for_each_safe, just do while (!list_empty()) so we >> > make sure to catch any new bg's that get added to the list. >> >> HOw can this occur, please elaborate and put an example callstack in the >> commit log. >> > > Eh? We're modifying the extent tree and chunk tree, which can cause bg's to > be > allocated, it's just common sense. >
This explains a bit. => btrfs_make_block_group => __btrfs_alloc_chunk => do_chunk_alloc => find_free_extent => btrfs_reserve_extent => btrfs_alloc_tree_block => __btrfs_cow_block => btrfs_cow_block => btrfs_search_slot => btrfs_update_device => btrfs_finish_chunk_alloc => btrfs_create_pending_block_groups ... Reviewed-by: Liu Bo <bo....@linux.alibaba.com> thanks, liubo