@@ -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)
The following patches btrfs: start transaction in btrfs_xattr_handler_set btrfs: start transaction in btrfs_set_acl btrfs: start transaction in btrfs_set_prop_trans brought changes so that btrfs_setxattr() argument trans is never NULL, so delete the part of the code when trans is NULL. Also fix the c-code style. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- v5: Fix ASSERT, assert on trans == NULL. Fix change log. v4: born fs/btrfs/xattr.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-)