On 12/10/20 1:38 AM, Qu Wenruo wrote:
For subpage case, grab_extent_buffer_from_page() can't really get an
extent buffer just from btrfs_subpage.

Although we have btrfs_subpage::tree_block_bitmap, which can be used to
grab the bytenr of an existing extent buffer, and can then go radix tree
search to grab that existing eb.

However we are still doing radix tree insert check in
alloc_extent_buffer(), thus we don't really need to do the extra hassle,
just let alloc_extent_buffer() to handle existing eb in radix tree.

So for grab_extent_buffer_from_page(), just always return NULL for
subpage case.

This is fundamentally flawed. The extent buffer radix tree look up is done _after_ the pages are init'ed. This is why there's that complicated dance of checking for existing extent buffers attached to to a page, because we can race at the initialization stage and attach an EB to a page before it's in the radix tree. What you'll end up doing here is overwriting your existing subpage stuff anytime there's a race, and it'll end very badly. Thanks,

Josef

Reply via email to