• Q
    btrfs: handle errors properly inside btrfs_submit_compressed_read() · 86ccbb4d
    Qu Wenruo 提交于
    There are quite some BUG_ON()s inside btrfs_submit_compressed_read(),
    namely all errors inside the for() loop relies on BUG_ON() to handle
    -ENOMEM.
    
    Handle these errors properly by:
    
    - Wait for submitted bios to finish first
      Using wake_var_event() APIs to wait without introducing extra memory
      overhead inside compressed_bio.
      This allows us to wait for any submitted bio to finish, while still
      keeps the compressed_bio from being freed.
    
    - Introduce finish_compressed_bio_read() to finish the compressed_bio
    
    - Properly end the bio and finish compressed_bio when error happens
    
    Now in btrfs_submit_compressed_read() even when the bio submission
    failed, we can properly handle the error without triggering BUG_ON().
    Signed-off-by: NQu Wenruo <wqu@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    86ccbb4d
compression.c 47.7 KB