• Qu Wenruo's avatar
    btrfs: introduce write_one_subpage_eb() function · 35b6ddfa
    Qu Wenruo authored
    The new function, write_one_subpage_eb(), as a subroutine for subpage
    metadata write, will handle the extent buffer bio submission.
    
    The major differences between the new write_one_subpage_eb() and
    write_one_eb() is:
    
    - No page locking
      When entering write_one_subpage_eb() the page is no longer locked.
      We only lock the page for its status update, and unlock immediately.
      Now we completely rely on extent io tree locking.
    
    - Extra bitmap update along with page status update
      Now page dirty and writeback is controlled by
      btrfs_subpage::dirty_bitmap and btrfs_subpage::writeback_bitmap.
      They both follow the schema that any sector is dirty/writeback, then
      the full page gets dirty/writeback.
    
    - When to update the nr_written number
      Now we take a shortcut, if we have cleared the last dirty bit of the
      page, we update nr_written.
      This is not completely perfect, but should emulate the old behavior
      well enough.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    35b6ddfa
extent_io.c 182 KB