Lines Matching refs:dir
305 static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, in reiserfs_find_entry() argument
312 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) in reiserfs_find_entry()
316 make_cpu_key(&key_to_search, dir, in reiserfs_find_entry()
317 get_third_component(dir->i_sb, name, namelen), in reiserfs_find_entry()
322 search_by_entry_key(dir->i_sb, &key_to_search, in reiserfs_find_entry()
325 reiserfs_error(dir->i_sb, "zam-7001", "io error"); in reiserfs_find_entry()
353 static struct dentry *reiserfs_lookup(struct inode *dir, struct dentry *dentry, in reiserfs_lookup() argument
361 if (REISERFS_MAX_NAME(dir->i_sb->s_blocksize) < dentry->d_name.len) in reiserfs_lookup()
364 reiserfs_write_lock(dir->i_sb); in reiserfs_lookup()
368 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_lookup()
372 inode = reiserfs_iget(dir->i_sb, in reiserfs_lookup()
375 reiserfs_write_unlock(dir->i_sb); in reiserfs_lookup()
384 if (IS_PRIVATE(dir)) { in reiserfs_lookup()
389 reiserfs_write_unlock(dir->i_sb); in reiserfs_lookup()
407 struct inode *dir = d_inode(child); in reiserfs_get_parent() local
409 if (dir->i_nlink == 0) { in reiserfs_get_parent()
414 reiserfs_write_lock(dir->i_sb); in reiserfs_get_parent()
415 retval = reiserfs_find_entry(dir, "..", 2, &path_to_entry, &de); in reiserfs_get_parent()
418 reiserfs_write_unlock(dir->i_sb); in reiserfs_get_parent()
421 inode = reiserfs_iget(dir->i_sb, (struct cpu_key *)&de.de_dir_id); in reiserfs_get_parent()
422 reiserfs_write_unlock(dir->i_sb); in reiserfs_get_parent()
434 struct inode *dir, const char *name, int namelen, in reiserfs_add_entry() argument
460 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) in reiserfs_add_entry()
464 make_cpu_key(&entry_key, dir, in reiserfs_add_entry()
465 get_third_component(dir->i_sb, name, namelen), in reiserfs_add_entry()
478 (get_inode_sd_version(dir) == in reiserfs_add_entry()
511 retval = reiserfs_find_entry(dir, name, namelen, &path, &de); in reiserfs_add_entry()
522 reiserfs_error(dir->i_sb, "zam-7002", in reiserfs_add_entry()
535 reiserfs_warning(dir->i_sb, "reiserfs-7010", in reiserfs_add_entry()
552 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != in reiserfs_add_entry()
554 reiserfs_warning(dir->i_sb, "vs-7032", in reiserfs_add_entry()
567 reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer, in reiserfs_add_entry()
576 dir->i_size += paste_size; in reiserfs_add_entry()
577 dir->i_mtime = dir->i_ctime = current_time(dir); in reiserfs_add_entry()
580 reiserfs_update_sd(th, dir); in reiserfs_add_entry()
607 static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) in new_inode_init() argument
619 inode_init_owner(&init_user_ns, inode, dir, mode); in new_inode_init()
623 static int reiserfs_create(struct user_namespace *mnt_userns, struct inode *dir, in reiserfs_create() argument
634 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_create()
635 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_create()
639 retval = dquot_initialize(dir); in reiserfs_create()
643 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_create()
646 retval = new_inode_init(inode, dir, mode); in reiserfs_create()
652 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_create()
653 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_create()
659 reiserfs_write_lock(dir->i_sb); in reiserfs_create()
661 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_create()
668 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_create()
678 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_create()
692 reiserfs_update_inode_transaction(dir); in reiserfs_create()
698 reiserfs_write_unlock(dir->i_sb); in reiserfs_create()
703 static int reiserfs_mknod(struct user_namespace *mnt_userns, struct inode *dir, in reiserfs_mknod() argument
716 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mknod()
717 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mknod()
719 retval = dquot_initialize(dir); in reiserfs_mknod()
723 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mknod()
726 retval = new_inode_init(inode, dir, mode); in reiserfs_mknod()
732 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mknod()
733 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mknod()
739 reiserfs_write_lock(dir->i_sb); in reiserfs_mknod()
741 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mknod()
748 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_mknod()
761 reiserfs_update_inode_transaction(dir); in reiserfs_mknod()
764 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mknod()
782 reiserfs_write_unlock(dir->i_sb); in reiserfs_mknod()
787 static int reiserfs_mkdir(struct user_namespace *mnt_userns, struct inode *dir, in reiserfs_mkdir() argument
800 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mkdir()
801 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mkdir()
803 retval = dquot_initialize(dir); in reiserfs_mkdir()
812 REISERFS_I(dir)->new_packing_locality = 1; in reiserfs_mkdir()
815 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mkdir()
818 retval = new_inode_init(inode, dir, mode); in reiserfs_mkdir()
824 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mkdir()
825 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mkdir()
831 reiserfs_write_lock(dir->i_sb); in reiserfs_mkdir()
833 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mkdir()
843 INC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
845 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */, in reiserfs_mkdir()
846 old_format_only(dir->i_sb) ? in reiserfs_mkdir()
850 DEC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
855 reiserfs_update_inode_transaction(dir); in reiserfs_mkdir()
862 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mkdir()
867 DEC_DIR_INODE_NLINK(dir); in reiserfs_mkdir()
877 reiserfs_update_sd(&th, dir); in reiserfs_mkdir()
882 reiserfs_write_unlock(dir->i_sb); in reiserfs_mkdir()
902 static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) in reiserfs_rmdir() argument
919 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_rmdir()
921 retval = dquot_initialize(dir); in reiserfs_rmdir()
925 reiserfs_write_lock(dir->i_sb); in reiserfs_rmdir()
926 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_rmdir()
932 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_rmdir()
944 reiserfs_update_inode_transaction(dir); in reiserfs_rmdir()
960 dir, NULL, /* page */ in reiserfs_rmdir()
971 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(dir); in reiserfs_rmdir()
974 DEC_DIR_INODE_NLINK(dir) in reiserfs_rmdir()
975 dir->i_size -= (DEH_SIZE + de.de_entrylen); in reiserfs_rmdir()
976 reiserfs_update_sd(&th, dir); in reiserfs_rmdir()
984 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
995 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
999 static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) in reiserfs_unlink() argument
1009 retval = dquot_initialize(dir); in reiserfs_unlink()
1024 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_unlink()
1026 reiserfs_write_lock(dir->i_sb); in reiserfs_unlink()
1027 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_unlink()
1033 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_unlink()
1043 reiserfs_update_inode_transaction(dir); in reiserfs_unlink()
1069 reiserfs_cut_from_item(&th, &path, &de.de_entry_key, dir, NULL, in reiserfs_unlink()
1078 dir->i_size -= (de.de_entrylen + DEH_SIZE); in reiserfs_unlink()
1079 dir->i_ctime = dir->i_mtime = current_time(dir); in reiserfs_unlink()
1080 reiserfs_update_sd(&th, dir); in reiserfs_unlink()
1088 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1098 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1204 static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, in reiserfs_link() argument
1216 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_link()
1218 retval = dquot_initialize(dir); in reiserfs_link()
1222 reiserfs_write_lock(dir->i_sb); in reiserfs_link()
1225 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1232 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_link()
1235 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1241 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_link()
1245 reiserfs_update_inode_transaction(dir); in reiserfs_link()
1251 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1261 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()