btrfs: Make btrfs_find_name_in_backref return btrfs_inode_ref struct
btrfs_find_name_in_backref returns either 0/1 depending on whether it found a backref for the given name. If it returns true then the actual inode_ref struct is returned in one of its parameters. That's pointless, instead refactor the function such that it returns either a pointer to the btrfs_inode_ref or NULL it it didn't find anything. This streamlines the function calling convention. Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
1dc990dfd3
commit
9bb8407f54
@@ -1271,8 +1271,8 @@ again:
|
||||
parent_id, name,
|
||||
namelen, NULL);
|
||||
else
|
||||
ret = btrfs_find_name_in_backref(log_eb, log_slot, name,
|
||||
namelen, NULL);
|
||||
ret = !!btrfs_find_name_in_backref(log_eb, log_slot,
|
||||
name, namelen);
|
||||
|
||||
if (!ret) {
|
||||
struct inode *dir;
|
||||
@@ -1338,8 +1338,8 @@ static int btrfs_inode_ref_exists(struct inode *inode, struct inode *dir,
|
||||
path->slots[0], parent_id,
|
||||
name, namelen, NULL);
|
||||
else
|
||||
ret = btrfs_find_name_in_backref(path->nodes[0], path->slots[0],
|
||||
name, namelen, NULL);
|
||||
ret = !!btrfs_find_name_in_backref(path->nodes[0], path->slots[0],
|
||||
name, namelen);
|
||||
|
||||
out:
|
||||
btrfs_free_path(path);
|
||||
|
Reference in New Issue
Block a user