• N
    btrfs: Replace owner argument in add_pinned_bytes with a boolean · 29d2b84c
    Nikolay Borisov 提交于
    add_pinned_bytes really cares whether the bytes being pinned are either
    data or metadata. To that effect it checks whether the 'owner' argument
    is less than BTRFS_FIRST_FREE_OBJECTID (256). This works because
    owner can really have 2 types of values:
    
     a) For metadata extents it holds the level at which the parent is in
        the btree. This amounts to owner having the values 0-7
    
     b) In case of modifying data extents, owner is the inode number
        to which those extents belongs.
    
    Let's make this more explicit byt converting the owner parameter to a
    boolean value and either pass it directly when we know the type of
    extents we are working with (i.e. in btrfs_free_tree_block). In cases
    when the parent function can be called on both metadata/data extents
    perform the check in the caller. This hopefully makes the interface
    of add_pinned_bytes more intuitive.
    Signed-off-by: NNikolay Borisov <nborisov@suse.com>
    Reviewed-by: NDavid Sterba <dsterba@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    29d2b84c
extent-tree.c 303.0 KB