Lines Matching full: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()
387 reiserfs_write_unlock(dir->i_sb); in reiserfs_lookup()
405 struct inode *dir = d_inode(child); in reiserfs_get_parent() local
407 if (dir->i_nlink == 0) { in reiserfs_get_parent()
412 reiserfs_write_lock(dir->i_sb); in reiserfs_get_parent()
413 retval = reiserfs_find_entry(dir, "..", 2, &path_to_entry, &de); in reiserfs_get_parent()
416 reiserfs_write_unlock(dir->i_sb); in reiserfs_get_parent()
419 inode = reiserfs_iget(dir->i_sb, (struct cpu_key *)&de.de_dir_id); in reiserfs_get_parent()
420 reiserfs_write_unlock(dir->i_sb); in reiserfs_get_parent()
429 Does not mark dir inode dirty, do it after successesfull call to it */
432 struct inode *dir, const char *name, int namelen, in reiserfs_add_entry() argument
455 make_cpu_key(&entry_key, dir, in reiserfs_add_entry()
456 get_third_component(dir->i_sb, name, namelen), in reiserfs_add_entry()
469 (get_inode_sd_version(dir) == in reiserfs_add_entry()
473 * fill buffer : directory entry head, name[, dir objectid | , in reiserfs_add_entry()
474 * stat data | ,stat data, dir objectid ] in reiserfs_add_entry()
502 retval = reiserfs_find_entry(dir, name, namelen, &path, &de); in reiserfs_add_entry()
513 reiserfs_error(dir->i_sb, "zam-7002", in reiserfs_add_entry()
526 reiserfs_warning(dir->i_sb, "reiserfs-7010", in reiserfs_add_entry()
543 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != in reiserfs_add_entry()
545 reiserfs_warning(dir->i_sb, "vs-7032", in reiserfs_add_entry()
558 reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer, in reiserfs_add_entry()
567 dir->i_size += paste_size; in reiserfs_add_entry()
568 inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); in reiserfs_add_entry()
571 reiserfs_update_sd(th, dir); in reiserfs_add_entry()
598 static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) in new_inode_init() argument
610 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); in new_inode_init()
614 static int reiserfs_create(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_create() argument
625 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_create()
626 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_create()
630 retval = dquot_initialize(dir); in reiserfs_create()
634 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_create()
637 retval = new_inode_init(inode, dir, mode); in reiserfs_create()
643 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_create()
644 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_create()
650 reiserfs_write_lock(dir->i_sb); in reiserfs_create()
652 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_create()
659 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_create()
669 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_create()
683 reiserfs_update_inode_transaction(dir); in reiserfs_create()
689 reiserfs_write_unlock(dir->i_sb); in reiserfs_create()
694 static int reiserfs_mknod(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_mknod() argument
707 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mknod()
708 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mknod()
710 retval = dquot_initialize(dir); in reiserfs_mknod()
714 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mknod()
717 retval = new_inode_init(inode, dir, mode); in reiserfs_mknod()
723 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mknod()
724 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mknod()
730 reiserfs_write_lock(dir->i_sb); in reiserfs_mknod()
732 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mknod()
739 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_mknod()
752 reiserfs_update_inode_transaction(dir); in reiserfs_mknod()
755 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mknod()
773 reiserfs_write_unlock(dir->i_sb); in reiserfs_mknod()
778 static int reiserfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_mkdir() argument
791 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mkdir()
792 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mkdir()
794 retval = dquot_initialize(dir); in reiserfs_mkdir()
803 REISERFS_I(dir)->new_packing_locality = 1; in reiserfs_mkdir()
806 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mkdir()
809 retval = new_inode_init(inode, dir, mode); in reiserfs_mkdir()
815 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mkdir()
816 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mkdir()
822 reiserfs_write_lock(dir->i_sb); in reiserfs_mkdir()
824 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mkdir()
834 INC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
836 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */, in reiserfs_mkdir()
837 old_format_only(dir->i_sb) ? in reiserfs_mkdir()
841 DEC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
846 reiserfs_update_inode_transaction(dir); in reiserfs_mkdir()
851 /* note, _this_ add_entry will not update dir's stat data */ in reiserfs_mkdir()
853 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mkdir()
858 DEC_DIR_INODE_NLINK(dir); in reiserfs_mkdir()
867 /* the above add_entry did not update dir's stat data */ in reiserfs_mkdir()
868 reiserfs_update_sd(&th, dir); in reiserfs_mkdir()
873 reiserfs_write_unlock(dir->i_sb); in reiserfs_mkdir()
881 * we can cheat because an old format dir cannot have in reiserfs_empty_dir()
882 * EMPTY_DIR_SIZE, and a new format dir cannot have in reiserfs_empty_dir()
893 static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) in reiserfs_rmdir() argument
910 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_rmdir()
912 retval = dquot_initialize(dir); in reiserfs_rmdir()
916 reiserfs_write_lock(dir->i_sb); in reiserfs_rmdir()
917 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_rmdir()
923 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_rmdir()
935 reiserfs_update_inode_transaction(dir); in reiserfs_rmdir()
949 /* cut entry from dir directory */ in reiserfs_rmdir()
951 dir, NULL, /* page */ in reiserfs_rmdir()
962 inode_set_mtime_to_ts(dir, in reiserfs_rmdir()
963 inode_set_ctime_to_ts(dir, inode_set_ctime_current(inode))); in reiserfs_rmdir()
966 DEC_DIR_INODE_NLINK(dir) in reiserfs_rmdir()
967 dir->i_size -= (DEH_SIZE + de.de_entrylen); in reiserfs_rmdir()
968 reiserfs_update_sd(&th, dir); in reiserfs_rmdir()
976 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
987 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
991 static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) in reiserfs_unlink() argument
1001 retval = dquot_initialize(dir); in reiserfs_unlink()
1016 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_unlink()
1018 reiserfs_write_lock(dir->i_sb); in reiserfs_unlink()
1019 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_unlink()
1025 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_unlink()
1035 reiserfs_update_inode_transaction(dir); in reiserfs_unlink()
1061 reiserfs_cut_from_item(&th, &path, &de.de_entry_key, dir, NULL, in reiserfs_unlink()
1070 dir->i_size -= (de.de_entrylen + DEH_SIZE); in reiserfs_unlink()
1071 inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir)); in reiserfs_unlink()
1072 reiserfs_update_sd(&th, dir); in reiserfs_unlink()
1080 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1090 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1196 static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, in reiserfs_link() argument
1208 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_link()
1210 retval = dquot_initialize(dir); in reiserfs_link()
1214 reiserfs_write_lock(dir->i_sb); in reiserfs_link()
1217 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1224 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_link()
1227 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1233 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_link()
1237 reiserfs_update_inode_transaction(dir); in reiserfs_link()
1243 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1253 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()