• Qu Wenruo's avatar
    btrfs: refactor btrfs_dec_test_* functions for ordered extents · 58f74b22
    Qu Wenruo authored
    The refactoring involves the following modifications:
    
    - Return bool instead of int
    
    - Parameter update for @cached of btrfs_dec_test_first_ordered_pending()
      For btrfs_dec_test_first_ordered_pending(), @cached is only used to
      return the finished ordered extent.
      Rename it to @finished_ret.
    
    - Comment updates
    
      * Change one stale comment
        Which still refers to btrfs_dec_test_ordered_pending(), but the
        context is calling  btrfs_dec_test_first_ordered_pending().
      * Follow the common comment style for both functions
        Add more detailed descriptions for parameters and the return value
      * Move the reason why test_and_set_bit() is used into the call sites
    
    - Change how the return value is calculated
      The most anti-human part of the return value is:
    
        if (...)
    	ret = 1;
        ...
        return ret == 0;
    
      This means, when we set ret to 1, the function returns 0.
      Change the local variable name to @finished, and directly return the
      value of it.
    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>
    58f74b22
inode.c 289 KB