Lines Matching defs:dir
144 struct inode *inode, struct inode *dir,
149 err = btrfs_init_acl(trans, inode, dir);
151 err = btrfs_xattr_security_init(trans, inode, dir, qstr);
3612 struct btrfs_inode *dir,
3622 u64 dir_ino = btrfs_ino(dir);
3643 * If we don't have dir index, we have to get it by looking up
3647 * But if we have dir index, needn't search inode ref to get it.
3670 ret = btrfs_delete_delayed_dir_index(trans, dir, index);
3683 ret = btrfs_del_dir_entries_in_log(trans, root, name, name_len, dir,
3705 btrfs_i_size_write(dir, dir->vfs_inode.i_size - name_len * 2);
3707 inode_inc_iversion(&dir->vfs_inode);
3708 inode->vfs_inode.i_ctime = dir->vfs_inode.i_mtime =
3709 dir->vfs_inode.i_ctime = current_time(&inode->vfs_inode);
3710 ret = btrfs_update_inode(trans, root, &dir->vfs_inode);
3717 struct btrfs_inode *dir, struct btrfs_inode *inode,
3721 ret = __btrfs_unlink_inode(trans, root, dir, inode, name, name_len);
3737 static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir)
3739 struct btrfs_root *root = BTRFS_I(dir)->root;
3743 * 1 for the dir item
3744 * 1 for the dir index
3751 static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
3753 struct btrfs_root *root = BTRFS_I(dir)->root;
3758 trans = __unlink_start_trans(dir);
3762 btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)),
3765 ret = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
3784 struct inode *dir, struct dentry *dentry)
3786 struct btrfs_root *root = BTRFS_I(dir)->root;
3797 u64 dir_ino = btrfs_ino(BTRFS_I(dir));
3864 ret = btrfs_delete_delayed_dir_index(trans, BTRFS_I(dir), index);
3870 btrfs_i_size_write(BTRFS_I(dir), dir->i_size - name_len * 2);
3871 inode_inc_iversion(dir);
3872 dir->i_mtime = dir->i_ctime = current_time(dir);
3873 ret = btrfs_update_inode_fallback(trans, root, dir);
4000 int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry)
4003 struct btrfs_root *root = BTRFS_I(dir)->root;
4046 * One for dir inode,
4047 * two for dir entries,
4062 btrfs_record_snapshot_destroy(trans, BTRFS_I(dir));
4064 ret = btrfs_unlink_subvol(trans, dir, dentry);
4139 static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4143 struct btrfs_root *root = BTRFS_I(dir)->root;
4150 return btrfs_delete_subvolume(dir, dentry);
4152 trans = __unlink_start_trans(dir);
4157 err = btrfs_unlink_subvol(trans, dir, dentry);
4168 err = btrfs_unlink_inode(trans, root, BTRFS_I(dir),
4174 * Propagate the last_unlink_trans value of the deleted dir to
4177 * 1) create dir foo
4178 * 2) create snapshot under dir foo
4185 BTRFS_I(dir)->last_unlink_trans = last_unlink_trans;
5220 * Return the key found in the dir entry in the location pointer, fill @type
5223 * If no dir entries were found, returns -ENOENT.
5224 * If found a corrupted location in dir entry, returns -EUCLEAN.
5226 static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
5233 struct btrfs_root *root = BTRFS_I(dir)->root;
5240 di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)),
5253 __func__, name, btrfs_ino(BTRFS_I(dir)),
5269 struct inode *dir,
5289 key.objectid = BTRFS_I(dir)->root->root_key.objectid;
5302 if (btrfs_root_ref_dirid(leaf, ref) != btrfs_ino(BTRFS_I(dir)) ||
5517 struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
5519 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
5521 struct btrfs_root *root = BTRFS_I(dir)->root;
5530 ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
5535 inode = btrfs_iget(dir->i_sb, location.objectid, root);
5542 "inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u",
5551 ret = fixup_tree_root_location(fs_info, dir, dentry,
5557 inode = new_simple_dir(dir->i_sb, &location, sub_root);
5559 inode = btrfs_iget(dir->i_sb, location.objectid, sub_root);
5597 static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry,
5600 struct inode *inode = btrfs_lookup_dentry(dir, dentry);
5918 int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index)
5922 if (dir->index_cnt == (u64)-1) {
5923 ret = btrfs_inode_delayed_dir_index_count(dir);
5925 ret = btrfs_set_inode_index_count(dir);
5931 *index = dir->index_cnt;
5932 dir->index_cnt++;
5954 static void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
5958 if (!dir)
5961 flags = BTRFS_I(dir)->flags;
5982 struct inode *dir,
6025 if (dir && name) {
6026 trace_btrfs_inode_request(dir);
6028 ret = btrfs_set_inode_index(BTRFS_I(dir), index);
6034 } else if (dir) {
6038 * index_cnt is ignored for everything but a dir,
6092 inode_init_owner(inode, dir, mode);
6118 btrfs_inherit_iflags(inode, dir);
6135 ret = btrfs_inode_inherit_props(trans, inode, dir);
6146 if (dir && name)
6147 BTRFS_I(dir)->index_cnt--;
6242 struct btrfs_inode *dir, struct dentry *dentry,
6245 int err = btrfs_add_link(trans, dir, inode,
6253 static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
6256 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
6258 struct btrfs_root *root = BTRFS_I(dir)->root;
6266 * 2 for dir items
6277 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
6278 dentry->d_name.len, btrfs_ino(BTRFS_I(dir)), objectid,
6295 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
6299 err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
6317 static int btrfs_create(struct inode *dir, struct dentry *dentry,
6320 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
6322 struct btrfs_root *root = BTRFS_I(dir)->root;
6330 * 2 for dir items
6341 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
6342 dentry->d_name.len, btrfs_ino(BTRFS_I(dir)), objectid,
6359 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
6367 err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
6384 static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
6388 struct btrfs_root *root = BTRFS_I(dir)->root;
6402 err = btrfs_set_inode_index(BTRFS_I(dir), &index);
6408 * 2 items for dir items
6419 /* There are several dir indexes for this inode, clear the cache. */
6427 err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry, BTRFS_I(inode),
6462 static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
6464 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
6467 struct btrfs_root *root = BTRFS_I(dir)->root;
6474 * 2 items for dir items
6485 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
6486 dentry->d_name.len, btrfs_ino(BTRFS_I(dir)), objectid,
6498 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
6507 err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
9127 struct inode *dir,
9139 inode = btrfs_new_inode(trans, root, dir,
9142 btrfs_ino(BTRFS_I(dir)),
9156 ret = btrfs_init_inode_security(trans, inode, dir,
9161 ret = btrfs_add_nondir(trans, BTRFS_I(dir), dentry,
9246 * new inode (1 inode item, 1 inode ref, 2 dir items and 1 xattr item
9598 static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
9601 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
9603 struct btrfs_root *root = BTRFS_I(dir)->root;
9622 * 2 items for dir items
9635 inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name,
9636 dentry->d_name.len, btrfs_ino(BTRFS_I(dir)),
9654 err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name);
9700 err = btrfs_add_nondir(trans, BTRFS_I(dir), dentry,
9945 static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
9947 struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
9949 struct btrfs_root *root = BTRFS_I(dir)->root;
9966 inode = btrfs_new_inode(trans, root, dir, NULL, 0,
9967 btrfs_ino(BTRFS_I(dir)), objectid, mode, &index);
9979 ret = btrfs_init_inode_security(trans, inode, dir, NULL);