OSDN Git Service

btrfs: Replace owner argument in add_pinned_bytes with a boolean
authorNikolay Borisov <nborisov@suse.com>
Fri, 30 Mar 2018 09:58:47 +0000 (12:58 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 11:12:11 +0000 (13:12 +0200)
commit29d2b84cf92780b74fd768f5506b0fc8dab56237
tree163f177ea08b31be1b62608ce8b5917ae3bf36d8
parentb04e217704b7f879c6b91222b066983a44a7a09f
btrfs: Replace owner argument in add_pinned_bytes with a boolean

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: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c