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
458 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) in reiserfs_add_entry()
462 make_cpu_key(&entry_key, dir, in reiserfs_add_entry()
463 get_third_component(dir->i_sb, name, namelen), in reiserfs_add_entry()
476 (get_inode_sd_version(dir) == in reiserfs_add_entry()
480 * fill buffer : directory entry head, name[, dir objectid | , in reiserfs_add_entry()
481 * stat data | ,stat data, dir objectid ] in reiserfs_add_entry()
509 retval = reiserfs_find_entry(dir, name, namelen, &path, &de); in reiserfs_add_entry()
520 reiserfs_error(dir->i_sb, "zam-7002", in reiserfs_add_entry()
533 reiserfs_warning(dir->i_sb, "reiserfs-7010", in reiserfs_add_entry()
550 if (search_by_entry_key(dir->i_sb, &entry_key, &path, &de) != in reiserfs_add_entry()
552 reiserfs_warning(dir->i_sb, "vs-7032", in reiserfs_add_entry()
565 reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer, in reiserfs_add_entry()
574 dir->i_size += paste_size; in reiserfs_add_entry()
575 dir->i_mtime = inode_set_ctime_current(dir); in reiserfs_add_entry()
578 reiserfs_update_sd(th, dir); in reiserfs_add_entry()
605 static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) in new_inode_init() argument
617 inode_init_owner(&nop_mnt_idmap, inode, dir, mode); in new_inode_init()
621 static int reiserfs_create(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_create() argument
632 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_create()
633 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_create()
637 retval = dquot_initialize(dir); in reiserfs_create()
641 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_create()
644 retval = new_inode_init(inode, dir, mode); in reiserfs_create()
650 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_create()
651 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_create()
657 reiserfs_write_lock(dir->i_sb); in reiserfs_create()
659 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_create()
666 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_create()
676 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_create()
690 reiserfs_update_inode_transaction(dir); in reiserfs_create()
696 reiserfs_write_unlock(dir->i_sb); in reiserfs_create()
701 static int reiserfs_mknod(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_mknod() argument
714 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mknod()
715 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mknod()
717 retval = dquot_initialize(dir); in reiserfs_mknod()
721 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mknod()
724 retval = new_inode_init(inode, dir, mode); in reiserfs_mknod()
730 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mknod()
731 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mknod()
737 reiserfs_write_lock(dir->i_sb); in reiserfs_mknod()
739 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mknod()
746 reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry, in reiserfs_mknod()
759 reiserfs_update_inode_transaction(dir); in reiserfs_mknod()
762 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mknod()
780 reiserfs_write_unlock(dir->i_sb); in reiserfs_mknod()
785 static int reiserfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, in reiserfs_mkdir() argument
798 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mkdir()
799 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mkdir()
801 retval = dquot_initialize(dir); in reiserfs_mkdir()
810 REISERFS_I(dir)->new_packing_locality = 1; in reiserfs_mkdir()
813 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mkdir()
816 retval = new_inode_init(inode, dir, mode); in reiserfs_mkdir()
822 jbegin_count += reiserfs_cache_default_acl(dir); in reiserfs_mkdir()
823 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mkdir()
829 reiserfs_write_lock(dir->i_sb); in reiserfs_mkdir()
831 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mkdir()
841 INC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
843 retval = reiserfs_new_inode(&th, dir, mode, NULL /*symlink */, in reiserfs_mkdir()
844 old_format_only(dir->i_sb) ? in reiserfs_mkdir()
848 DEC_DIR_INODE_NLINK(dir) in reiserfs_mkdir()
853 reiserfs_update_inode_transaction(dir); in reiserfs_mkdir()
858 /* note, _this_ add_entry will not update dir's stat data */ in reiserfs_mkdir()
860 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mkdir()
865 DEC_DIR_INODE_NLINK(dir); in reiserfs_mkdir()
874 /* the above add_entry did not update dir's stat data */ in reiserfs_mkdir()
875 reiserfs_update_sd(&th, dir); in reiserfs_mkdir()
880 reiserfs_write_unlock(dir->i_sb); in reiserfs_mkdir()
888 * we can cheat because an old format dir cannot have in reiserfs_empty_dir()
889 * EMPTY_DIR_SIZE, and a new format dir cannot have in reiserfs_empty_dir()
900 static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) in reiserfs_rmdir() argument
917 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_rmdir()
919 retval = dquot_initialize(dir); in reiserfs_rmdir()
923 reiserfs_write_lock(dir->i_sb); in reiserfs_rmdir()
924 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_rmdir()
930 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_rmdir()
942 reiserfs_update_inode_transaction(dir); in reiserfs_rmdir()
956 /* cut entry from dir directory */ in reiserfs_rmdir()
958 dir, NULL, /* page */ in reiserfs_rmdir()
969 dir->i_mtime = inode_set_ctime_to_ts(dir, in reiserfs_rmdir()
973 DEC_DIR_INODE_NLINK(dir) in reiserfs_rmdir()
974 dir->i_size -= (DEH_SIZE + de.de_entrylen); in reiserfs_rmdir()
975 reiserfs_update_sd(&th, dir); in reiserfs_rmdir()
983 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
994 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
998 static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) in reiserfs_unlink() argument
1008 retval = dquot_initialize(dir); in reiserfs_unlink()
1023 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_unlink()
1025 reiserfs_write_lock(dir->i_sb); in reiserfs_unlink()
1026 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_unlink()
1032 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_unlink()
1042 reiserfs_update_inode_transaction(dir); in reiserfs_unlink()
1068 reiserfs_cut_from_item(&th, &path, &de.de_entry_key, dir, NULL, in reiserfs_unlink()
1077 dir->i_size -= (de.de_entrylen + DEH_SIZE); in reiserfs_unlink()
1078 dir->i_mtime = inode_set_ctime_current(dir); in reiserfs_unlink()
1079 reiserfs_update_sd(&th, dir); in reiserfs_unlink()
1087 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1097 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1203 static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, in reiserfs_link() argument
1215 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_link()
1217 retval = dquot_initialize(dir); in reiserfs_link()
1221 reiserfs_write_lock(dir->i_sb); in reiserfs_link()
1224 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1231 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_link()
1234 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1240 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_link()
1244 reiserfs_update_inode_transaction(dir); in reiserfs_link()
1250 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1260 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()