struct user_namespace *mnt_userns,
struct inode *dir,
const char *name, int name_len,
- u64 objectid, umode_t mode, u64 *index)
+ umode_t mode, u64 *index)
{
struct btrfs_fs_info *fs_info = root->fs_info;
struct inode *inode;
struct btrfs_inode_item *inode_item;
struct btrfs_key *location;
struct btrfs_path *path;
+ u64 objectid;
struct btrfs_inode_ref *ref;
struct btrfs_key key[2];
u32 sizes[2];
if (!name)
set_nlink(inode, 0);
- /*
- * we have to initialize this early, so we can reclaim the inode
- * number if we fail afterwards in this function.
- */
+ ret = btrfs_get_free_objectid(root, &objectid);
+ if (ret) {
+ btrfs_free_path(path);
+ iput(inode);
+ return ERR_PTR(ret);
+ }
inode->i_ino = objectid;
if (dir && name) {
struct btrfs_root *root = BTRFS_I(dir)->root;
struct inode *inode = NULL;
int err;
- u64 objectid;
u64 index = 0;
/*
if (IS_ERR(trans))
return PTR_ERR(trans);
- err = btrfs_get_free_objectid(root, &objectid);
- if (err)
- goto out_unlock;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir,
dentry->d_name.name, dentry->d_name.len,
- objectid, mode, &index);
+ mode, &index);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
inode = NULL;
struct btrfs_root *root = BTRFS_I(dir)->root;
struct inode *inode = NULL;
int err;
- u64 objectid;
u64 index = 0;
/*
if (IS_ERR(trans))
return PTR_ERR(trans);
- err = btrfs_get_free_objectid(root, &objectid);
- if (err)
- goto out_unlock;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir,
dentry->d_name.name, dentry->d_name.len,
- objectid, mode, &index);
+ mode, &index);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
inode = NULL;
struct btrfs_trans_handle *trans;
struct btrfs_root *root = BTRFS_I(dir)->root;
int err = 0;
- u64 objectid = 0;
u64 index = 0;
/*
if (IS_ERR(trans))
return PTR_ERR(trans);
- err = btrfs_get_free_objectid(root, &objectid);
- if (err)
- goto out_fail;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir,
dentry->d_name.name, dentry->d_name.len,
- objectid,
S_IFDIR | mode, &index);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
struct inode *inode;
int err;
u64 index = 0;
- u64 ino;
-
- err = btrfs_get_free_objectid(new_root, &ino);
- if (err < 0)
- return err;
inode = btrfs_new_inode(trans, new_root, mnt_userns, NULL, "..", 2,
- ino,
S_IFDIR | (~current_umask() & S_IRWXUGO),
&index);
if (IS_ERR(inode))
{
int ret;
struct inode *inode;
- u64 objectid;
u64 index;
- ret = btrfs_get_free_objectid(root, &objectid);
- if (ret)
- return ret;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir,
dentry->d_name.name,
dentry->d_name.len,
- objectid,
S_IFCHR | WHITEOUT_MODE,
&index);
struct btrfs_key key;
struct inode *inode = NULL;
int err;
- u64 objectid;
u64 index = 0;
int name_len;
int datasize;
if (IS_ERR(trans))
return PTR_ERR(trans);
- err = btrfs_get_free_objectid(root, &objectid);
- if (err)
- goto out_unlock;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir,
dentry->d_name.name, dentry->d_name.len,
- objectid,
S_IFLNK | S_IRWXUGO, &index);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
struct btrfs_trans_handle *trans;
struct btrfs_root *root = BTRFS_I(dir)->root;
struct inode *inode = NULL;
- u64 objectid;
u64 index;
int ret = 0;
if (IS_ERR(trans))
return PTR_ERR(trans);
- ret = btrfs_get_free_objectid(root, &objectid);
- if (ret)
- goto out;
-
inode = btrfs_new_inode(trans, root, mnt_userns, dir, NULL, 0,
- objectid, mode, &index);
+ mode, &index);
if (IS_ERR(inode)) {
ret = PTR_ERR(inode);
inode = NULL;