Lines Matching refs:dir

54 #include "dir-item.h"
594 struct inode *dir, struct dentry *dentry,
597 struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
603 struct btrfs_root *root = BTRFS_I(dir)->root;
606 struct timespec64 cur_time = current_time(dir);
608 .dir = dir,
639 new_inode_args.inode = btrfs_new_subvol_inode(idmap, dir);
661 ret = btrfs_record_root_in_trans(trans, BTRFS_I(dir)->root);
793 static int create_snapshot(struct btrfs_root *root, struct inode *dir,
797 struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
843 * 1 to add dir item
844 * 1 to add dir index
848 ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root, block_rsv,
857 pending_snapshot->dir = dir;
865 ret = btrfs_record_root_in_trans(trans, BTRFS_I(dir)->root);
915 * Check whether we can remove a link victim from directory dir, check
917 * 1. We can't do it if dir is read-only (done in permission())
918 * 2. We should have write and exec permissions on dir
919 * 3. We can't remove anything from append-only dir
920 * 4. We can't do anything with immutable dir (done in permission())
921 * 5. If the sticky bit on dir is set we should either
922 * a. be owner of dir, or
935 struct inode *dir, struct dentry *victim, int isdir)
942 /* The @victim is not inside @dir. */
943 if (d_inode(victim->d_parent) != dir)
945 audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
947 error = inode_permission(idmap, dir, MAY_WRITE | MAY_EXEC);
950 if (IS_APPEND(dir))
952 if (check_sticky(idmap, dir, d_inode(victim)) ||
963 if (IS_DEADDIR(dir))
972 struct inode *dir, struct dentry *child)
976 if (IS_DEADDIR(dir))
978 if (!fsuidgid_has_mapping(dir->i_sb, idmap))
980 return inode_permission(idmap, dir, MAY_WRITE | MAY_EXEC);
995 struct inode *dir = d_inode(parent->dentry);
996 struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
1001 error = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
1010 error = btrfs_may_create(idmap, dir, dentry);
1018 error = btrfs_check_dir_item_collision(BTRFS_I(dir)->root,
1019 dir->i_ino, &name_str);
1025 if (btrfs_root_refs(&BTRFS_I(dir)->root->root_item) == 0)
1029 error = create_snapshot(snap_src, dir, dentry, readonly, inherit);
1031 error = create_subvol(idmap, dir, dentry, inherit);
1034 fsnotify_mkdir(dir, dentry);
1040 btrfs_inode_unlock(BTRFS_I(dir), 0);
2379 struct inode *dir = d_inode(parent);
2380 struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
2382 struct btrfs_root *root = BTRFS_I(dir)->root;
2461 old_dir = dir;
2462 dir = d_inode(parent);
2481 if (old_dir != dir && idmap != &nop_mnt_idmap) {
2519 if (!S_ISDIR(dir->i_mode)) {
2524 ret = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
2559 * Do not allow deletion if the parent dir is the same
2560 * as the dir to be deleted. That means the ioctl
2575 ret = btrfs_may_delete(idmap, dir, dentry, 1);
2585 ret = btrfs_delete_subvolume(BTRFS_I(dir), dentry);
2588 d_delete_notify(dir, dentry);
2593 btrfs_inode_unlock(BTRFS_I(dir), 0);