]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit2ecaf2ff4a0f511288d14d85d5b1b71b3a970d0c
tree163f177ea08b31be1b62608ce8b5917ae3bf36d8
parent5e82c0ed0aa1e7487ee9b8c6685f127d866d64cb
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