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.j...@oracle.com> --- 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); if (btrfs_root_readonly(root)) return -EROFS; - if (trans) - return do_setxattr(trans, inode, name, value, size, flags); - - trans = btrfs_start_transaction(root, 2); - if (IS_ERR(trans)) - return PTR_ERR(trans); - - ret = do_setxattr(trans, inode, name, value, size, flags); - if (ret) - goto out; - - inode_inc_iversion(inode); - inode->i_ctime = current_time(inode); - set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); - ret = btrfs_update_inode(trans, root, inode); - BUG_ON(ret); -out: - btrfs_end_transaction(trans); - return ret; + return do_setxattr(trans, inode, name, value, size, flags); } ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) -- 1.8.3.1