/* Returns 0, or a negative error number on failure.  */
int ext4_xattr_set(struct inode *inode, int name_index, const char *name, const void *value, size_t value_len, int flags)
/* Returns 0, or a negative error number on failure.  */
int ext4_xattr_set(struct inode *inode, int name_index, const char *name, const void *value, size_t value_len, int flags)
{
	handle_t *handle;
	int error, retries = 0;
retry:
	handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
	if (IS_ERR(handle)) {
		error = PTR_ERR(handle);
	} else {
		int error2;
		error = ext4_xattr_set_handle(handle, inode, name_index, name,
					      value, value_len, flags);
		error2 = ext4_journal_stop(handle);
		if (error == -ENOSPC &&
		    ext4_should_retry_alloc(inode->i_sb, &retries))
			goto retry;
		if (error == 0)
			error = error2;
	}
	return error;
}