btrfs: split btrfs_setxattr calls regarding transaction

When the caller has already created the transaction handle,
btrfs_setxattr() will use it. Also adds assert in btrfs_setxattr().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2019-04-12 16:02:58 +08:00 committed by David Sterba
parent 353c2ea735
commit 04e6863b19
3 changed files with 33 additions and 13 deletions

View file

@ -93,7 +93,11 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
goto out;
}
ret = btrfs_setxattr_trans(trans, inode, name, value, size, 0);
if (trans)
ret = btrfs_setxattr(trans, inode, name, value, size, 0);
else
ret = btrfs_setxattr_trans(NULL, inode, name, value, size, 0);
out:
kfree(value);