On Sat, Feb 23, 2019 at 01:39:51AM +0800, Anand Jain wrote:
> The following patches
> btrfs: cleanup btrfs_set_acl
> btrfs: start transaction in btrfs_xattr_handler_set
> btrfs: create transaction in btrfs_set_prop_notrans
>
> made the btrfs_setxattr() argument trans to be never NULL, so delete the
> code when trans is NULL in btrfs_setxattr(). Also fix the c-code style.
>
> Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> ---
> v4: born
> fs/btrfs/xattr.c | 28 +++++-----------------------
> 1 file changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
> index 8e301a1ae304..b3281d4d95b9 100644
> --- a/fs/btrfs/xattr.c
> +++ b/fs/btrfs/xattr.c
> @@ -220,35 +220,17 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
> /*
> * @value: "" makes the attribute to empty, NULL removes it
> */
> -int btrfs_setxattr(struct btrfs_trans_handle *trans,
> - struct inode *inode, const char *name,
> - const void *value, size_t size, int flags)
> +int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,
> + const char *name, const void *value, size_t size, int flags)
> {
> struct btrfs_root *root = BTRFS_I(inode)->root;
> - int ret;
> +
> + ASSERT(!trans);
Isn't this reversed?
ASSERT(trans == 0) is not what we want