• Qu Wenruo's avatar
    btrfs: open_ctree() error handling cleanup · 4871c33b
    Qu Wenruo authored
    Currently open_ctree() still uses two variables for error handling, err
    and ret. This can be confusing and missing some errors and does not
    conform to current coding style.
    
    This patch will fix the problems by:
    
    - Use only ret for error handling
    
    - Add proper ret assignment
      Originally we rely on the default value (-EINVAL) of err to handle
      errors, but that doesn't really reflects the error.
      This will change it use the correct error number for the following
      call sites:
    
      * subpage_info allocation
      * btrfs_free_extra_devids()
      * btrfs_check_rw_degradable()
      * cleaner_kthread allocation
      * transaction_kthread allocation
    
    - Add an extra ASSERT()
      To make sure we error out instead of returning 0.
    Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    4871c33b
disk-io.c 146 KB