Lines Matching +full:de +full:- +full:be
22 #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK…
23 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
29 static int bin_search_in_dir_item(struct reiserfs_dir_entry *de, loff_t off) in bin_search_in_dir_item() argument
31 struct item_head *ih = de->de_ih; in bin_search_in_dir_item()
32 struct reiserfs_de_head *deh = de->de_deh; in bin_search_in_dir_item()
36 rbound = ih_entry_count(ih) - 1; in bin_search_in_dir_item()
41 rbound = j - 1; in bin_search_in_dir_item()
49 de->de_entry_num = j; in bin_search_in_dir_item()
53 de->de_entry_num = lbound; in bin_search_in_dir_item()
58 * comment? maybe something like set de to point to what the path points to?
60 static inline void set_de_item_location(struct reiserfs_dir_entry *de, in set_de_item_location() argument
63 de->de_bh = get_last_bh(path); in set_de_item_location()
64 de->de_ih = tp_item_head(path); in set_de_item_location()
65 de->de_deh = B_I_DEH(de->de_bh, de->de_ih); in set_de_item_location()
66 de->de_item_num = PATH_LAST_POSITION(path); in set_de_item_location()
72 inline void set_de_name_and_namelen(struct reiserfs_dir_entry *de) in set_de_name_and_namelen() argument
74 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num; in set_de_name_and_namelen()
76 BUG_ON(de->de_entry_num >= ih_entry_count(de->de_ih)); in set_de_name_and_namelen()
78 de->de_entrylen = entry_length(de->de_bh, de->de_ih, de->de_entry_num); in set_de_name_and_namelen()
79 de->de_namelen = de->de_entrylen - (de_with_sd(deh) ? SD_SIZE : 0); in set_de_name_and_namelen()
80 de->de_name = ih_item_body(de->de_bh, de->de_ih) + deh_location(deh); in set_de_name_and_namelen()
81 if (de->de_name[de->de_namelen - 1] == 0) in set_de_name_and_namelen()
82 de->de_namelen = strlen(de->de_name); in set_de_name_and_namelen()
86 static inline void set_de_object_key(struct reiserfs_dir_entry *de) in set_de_object_key() argument
88 BUG_ON(de->de_entry_num >= ih_entry_count(de->de_ih)); in set_de_object_key()
89 de->de_dir_id = deh_dir_id(&de->de_deh[de->de_entry_num]); in set_de_object_key()
90 de->de_objectid = deh_objectid(&de->de_deh[de->de_entry_num]); in set_de_object_key()
93 static inline void store_de_entry_key(struct reiserfs_dir_entry *de) in store_de_entry_key() argument
95 struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num; in store_de_entry_key()
97 BUG_ON(de->de_entry_num >= ih_entry_count(de->de_ih)); in store_de_entry_key()
100 de->de_entry_key.version = KEY_FORMAT_3_5; in store_de_entry_key()
101 de->de_entry_key.on_disk_key.k_dir_id = in store_de_entry_key()
102 le32_to_cpu(de->de_ih->ih_key.k_dir_id); in store_de_entry_key()
103 de->de_entry_key.on_disk_key.k_objectid = in store_de_entry_key()
104 le32_to_cpu(de->de_ih->ih_key.k_objectid); in store_de_entry_key()
105 set_cpu_key_k_offset(&de->de_entry_key, deh_offset(deh)); in store_de_entry_key()
106 set_cpu_key_k_type(&de->de_entry_key, TYPE_DIRENTRY); in store_de_entry_key()
119 /* The function is NOT SCHEDULE-SAFE! */
121 struct treepath *path, struct reiserfs_dir_entry *de) in search_by_entry_key() argument
129 reiserfs_error(sb, "vs-7000", "search_by_key " in search_by_entry_key()
134 PATH_LAST_POSITION(path)--; in search_by_entry_key()
145 reiserfs_error(sb, "vs-7002", "no path to here"); in search_by_entry_key()
149 set_de_item_location(de, path); in search_by_entry_key()
152 if (!is_direntry_le_ih(de->de_ih) || in search_by_entry_key()
153 COMP_SHORT_KEYS(&de->de_ih->ih_key, key)) { in search_by_entry_key()
154 print_block(de->de_bh, 0, -1, -1); in search_by_entry_key()
155 reiserfs_panic(sb, "vs-7005", "found item %h is not directory " in search_by_entry_key()
157 "as key %K", de->de_ih, key); in search_by_entry_key()
163 * key. sets de->de_entry_num of de in search_by_entry_key()
165 retval = bin_search_in_dir_item(de, cpu_key_k_offset(key)); in search_by_entry_key()
166 path->pos_in_item = de->de_entry_num; in search_by_entry_key()
172 set_de_name_and_namelen(de); in search_by_entry_key()
173 set_de_object_key(de); in search_by_entry_key()
178 /* Keyed 32-bit hash function using TEA in a Davis-Meyer function */
183 * but are thought about. This function should be moved to hashes.c
184 * Jedi, please do so. -Hans
196 res = REISERFS_SB(s)->s_hash_function(name, len); in get_third_component()
198 /* take bits from 7-th to 30-th including both bounds */ in get_third_component()
209 static int reiserfs_match(struct reiserfs_dir_entry *de, in reiserfs_match() argument
214 if ((namelen == de->de_namelen) && in reiserfs_match()
215 !memcmp(de->de_name, name, de->de_namelen)) in reiserfs_match()
217 (de_visible(de->de_deh + de->de_entry_num) ? NAME_FOUND : in reiserfs_match()
223 /* de's de_bh, de_ih, de_deh, de_item_num, de_entry_num are set already */
228 struct reiserfs_dir_entry *de, in linear_search_in_dir_item() argument
231 struct reiserfs_de_head *deh = de->de_deh; in linear_search_in_dir_item()
235 i = de->de_entry_num; in linear_search_in_dir_item()
237 if (i == ih_entry_count(de->de_ih) || in linear_search_in_dir_item()
240 i--; in linear_search_in_dir_item()
243 RFALSE(de->de_deh != B_I_DEH(de->de_bh, de->de_ih), in linear_search_in_dir_item()
244 "vs-7010: array of entry headers not found"); in linear_search_in_dir_item()
248 for (; i >= 0; i--, deh--) { in linear_search_in_dir_item()
256 if (de->de_gen_number_bit_string) in linear_search_in_dir_item()
258 de->de_gen_number_bit_string); in linear_search_in_dir_item()
261 de->de_entry_num = i; in linear_search_in_dir_item()
262 set_de_name_and_namelen(de); in linear_search_in_dir_item()
265 * de's de_name, de_namelen, de_recordlen are set. in linear_search_in_dir_item()
269 reiserfs_match(de, name, namelen)) != NAME_NOT_FOUND) { in linear_search_in_dir_item()
272 set_de_object_key(de); in linear_search_in_dir_item()
274 store_de_entry_key(de); in linear_search_in_dir_item()
276 /* retval can be NAME_FOUND or NAME_FOUND_INVISIBLE */ in linear_search_in_dir_item()
281 if (GET_GENERATION_NUMBER(le_ih_k_offset(de->de_ih)) == 0) in linear_search_in_dir_item()
290 * be 0. Btw, in case of Yura's hash it is probably possible, in linear_search_in_dir_item()
295 RFALSE(de->de_item_num, in linear_search_in_dir_item()
296 "vs-7015: two diritems of the same directory in one node?"); in linear_search_in_dir_item()
307 struct reiserfs_dir_entry *de) in reiserfs_find_entry() argument
312 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) 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()
323 path_to_entry, de); in reiserfs_find_entry()
325 reiserfs_error(dir->i_sb, "zam-7001", "io error"); in reiserfs_find_entry()
331 linear_search_in_dir_item(&key_to_search, de, name, in reiserfs_find_entry()
338 path_to_entry->pos_in_item = de->de_entry_num; in reiserfs_find_entry()
344 * and given entry can be there in reiserfs_find_entry()
347 le_ih_k_offset(de->de_ih) - 1); in reiserfs_find_entry()
358 struct reiserfs_dir_entry de; in reiserfs_lookup() local
361 if (REISERFS_MAX_NAME(dir->i_sb->s_blocksize) < dentry->d_name.len) in reiserfs_lookup()
362 return ERR_PTR(-ENAMETOOLONG); in reiserfs_lookup()
364 reiserfs_write_lock(dir->i_sb); in reiserfs_lookup()
366 de.de_gen_number_bit_string = NULL; in reiserfs_lookup()
368 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_lookup()
369 &path_to_entry, &de); in reiserfs_lookup()
372 inode = reiserfs_iget(dir->i_sb, in reiserfs_lookup()
373 (struct cpu_key *)&de.de_dir_id); in reiserfs_lookup()
375 reiserfs_write_unlock(dir->i_sb); in reiserfs_lookup()
376 return ERR_PTR(-EACCES); in reiserfs_lookup()
385 inode->i_flags |= S_PRIVATE; in reiserfs_lookup()
386 inode->i_opflags &= ~IOP_XATTR; in reiserfs_lookup()
389 reiserfs_write_unlock(dir->i_sb); in reiserfs_lookup()
391 return ERR_PTR(-EIO); in reiserfs_lookup()
405 struct reiserfs_dir_entry de; in reiserfs_get_parent() local
409 if (dir->i_nlink == 0) { in reiserfs_get_parent()
410 return ERR_PTR(-ENOENT); in reiserfs_get_parent()
412 de.de_gen_number_bit_string = NULL; 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()
419 return ERR_PTR(-ENOENT); 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()
427 /* add entry to the directory (entry can be hidden).
429 insert definition of when hidden directories are used here -Hans
440 struct reiserfs_dir_entry de; in reiserfs_add_entry() local
454 BUG_ON(!th->t_trans_id); in reiserfs_add_entry()
456 /* cannot allow items to be added into a busy deleted directory */ in reiserfs_add_entry()
458 return -EINVAL; in reiserfs_add_entry()
460 if (namelen > REISERFS_MAX_NAME(dir->i_sb->s_blocksize)) in reiserfs_add_entry()
461 return -ENAMETOOLONG; in reiserfs_add_entry()
465 get_third_component(dir->i_sb, name, namelen), in reiserfs_add_entry()
473 return -ENOMEM; in reiserfs_add_entry()
486 deh->deh_location = 0; /* JDM Endian safe if 0 */ in reiserfs_add_entry()
488 deh->deh_state = 0; /* JDM Endian safe if 0 */ in reiserfs_add_entry()
489 /* put key (ino analog) to de */ in reiserfs_add_entry()
492 deh->deh_dir_id = INODE_PKEY(inode)->k_dir_id; in reiserfs_add_entry()
494 deh->deh_objectid = INODE_PKEY(inode)->k_objectid; in reiserfs_add_entry()
502 * entry is ready to be pasted into tree, set 'visibility' in reiserfs_add_entry()
510 de.de_gen_number_bit_string = bit_string; in reiserfs_add_entry()
511 retval = reiserfs_find_entry(dir, name, namelen, &path, &de); in reiserfs_add_entry()
518 return -EIO; in reiserfs_add_entry()
522 reiserfs_error(dir->i_sb, "zam-7002", in reiserfs_add_entry()
527 return -EEXIST; in reiserfs_add_entry()
535 reiserfs_warning(dir->i_sb, "reiserfs-7010", in reiserfs_add_entry()
541 return -EBUSY; in reiserfs_add_entry()
547 /* update max-hash-collisions counter in reiserfs_sb_info */ in reiserfs_add_entry()
548 PROC_INFO_MAX(th->t_super, max_hash_collisions, gen_number); in reiserfs_add_entry()
550 /* we need to re-search for the insertion point */ 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()
561 return -EBUSY; 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()
578 if (!S_ISDIR(inode->i_mode) && visible) in reiserfs_add_entry()
589 * This should only be called on inodes that do not have stat data
596 inode->i_flags |= S_NOQUOTA; in drop_new_inode()
610 * Make inode invalid - just in case we are going to drop it before in new_inode_init()
613 INODE_PKEY(inode)->k_objectid = 0; in new_inode_init()
634 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_create()
635 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_create()
643 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_create()
644 return -ENOMEM; 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()
673 inode->i_op = &reiserfs_file_inode_operations; in reiserfs_create()
674 inode->i_fop = &reiserfs_file_operations; in reiserfs_create()
675 inode->i_mapping->a_ops = &reiserfs_address_space_operations; in reiserfs_create()
678 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_create()
679 dentry->d_name.len, inode, 1 /*visible */ ); in reiserfs_create()
698 reiserfs_write_unlock(dir->i_sb); in reiserfs_create()
715 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mknod()
716 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); in reiserfs_mknod()
722 if (!(inode = new_inode(dir->i_sb))) { in reiserfs_mknod()
723 return -ENOMEM; in reiserfs_mknod()
732 retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security); in reiserfs_mknod()
738 reiserfs_write_lock(dir->i_sb); in reiserfs_mknod()
740 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_mknod()
753 inode->i_op = &reiserfs_special_inode_operations; in reiserfs_mknod()
754 init_special_inode(inode, inode->i_mode, rdev); in reiserfs_mknod()
763 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mknod()
764 dentry->d_name.len, inode, 1 /*visible */ ); in reiserfs_mknod()
781 reiserfs_write_unlock(dir->i_sb); in reiserfs_mknod()
798 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + in reiserfs_mkdir()
799 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 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()
814 return -ENOMEM; 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()
844 old_format_only(dir->i_sb) ? in reiserfs_mkdir()
855 inode->i_op = &reiserfs_dir_inode_operations; in reiserfs_mkdir()
856 inode->i_fop = &reiserfs_dir_operations; in reiserfs_mkdir()
860 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_mkdir()
861 dentry->d_name.len, inode, 1 /*visible */ ); in reiserfs_mkdir()
880 reiserfs_write_unlock(dir->i_sb); in reiserfs_mkdir()
892 if (inode->i_size != EMPTY_DIR_SIZE && in reiserfs_empty_dir()
893 inode->i_size != EMPTY_DIR_SIZE_V1) { in reiserfs_empty_dir()
906 struct reiserfs_dir_entry de; in reiserfs_rmdir() local
909 * we will be doing 2 balancings and update 2 stat data, we in reiserfs_rmdir()
916 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_rmdir()
922 reiserfs_write_lock(dir->i_sb); in reiserfs_rmdir()
923 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_rmdir()
927 de.de_gen_number_bit_string = NULL; in reiserfs_rmdir()
929 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_rmdir()
930 &path, &de)) == NAME_NOT_FOUND) { in reiserfs_rmdir()
931 retval = -ENOENT; in reiserfs_rmdir()
934 retval = -EIO; in reiserfs_rmdir()
943 if (de.de_objectid != inode->i_ino) { in reiserfs_rmdir()
947 retval = -EIO; in reiserfs_rmdir()
951 retval = -ENOTEMPTY; in reiserfs_rmdir()
956 retval = reiserfs_cut_from_item(&th, &path, &de.de_entry_key, in reiserfs_rmdir()
958 0 /*new file size - not used here */ ); in reiserfs_rmdir()
962 if (inode->i_nlink != 2 && inode->i_nlink != 1) in reiserfs_rmdir()
963 reiserfs_error(inode->i_sb, "reiserfs-7040", in reiserfs_rmdir()
965 inode->i_nlink); in reiserfs_rmdir()
968 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(dir); in reiserfs_rmdir()
972 dir->i_size -= (DEH_SIZE + de.de_entrylen); in reiserfs_rmdir()
981 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
992 reiserfs_write_unlock(dir->i_sb); in reiserfs_rmdir()
1000 struct reiserfs_dir_entry de; in reiserfs_unlink() local
1013 * in this transaction we can be doing at max two balancings and in reiserfs_unlink()
1021 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_unlink()
1023 reiserfs_write_lock(dir->i_sb); in reiserfs_unlink()
1024 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_unlink()
1028 de.de_gen_number_bit_string = NULL; in reiserfs_unlink()
1030 reiserfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, in reiserfs_unlink()
1031 &path, &de)) == NAME_NOT_FOUND) { in reiserfs_unlink()
1032 retval = -ENOENT; in reiserfs_unlink()
1035 retval = -EIO; in reiserfs_unlink()
1042 if (de.de_objectid != inode->i_ino) { in reiserfs_unlink()
1046 retval = -EIO; in reiserfs_unlink()
1050 if (!inode->i_nlink) { in reiserfs_unlink()
1051 reiserfs_warning(inode->i_sb, "reiserfs-7042", in reiserfs_unlink()
1053 inode->i_ino, inode->i_nlink); in reiserfs_unlink()
1063 savelink = inode->i_nlink; in reiserfs_unlink()
1066 reiserfs_cut_from_item(&th, &path, &de.de_entry_key, dir, NULL, in reiserfs_unlink()
1072 inode->i_ctime = current_time(inode); in reiserfs_unlink()
1075 dir->i_size -= (de.de_entrylen + DEH_SIZE); in reiserfs_unlink()
1076 dir->i_ctime = dir->i_mtime = current_time(dir); in reiserfs_unlink()
1085 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1095 reiserfs_write_unlock(dir->i_sb); in reiserfs_unlink()
1116 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + in reiserfs_symlink()
1117 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb)); in reiserfs_symlink()
1123 if (!(inode = new_inode(parent_dir->i_sb))) { in reiserfs_symlink()
1124 return -ENOMEM; in reiserfs_symlink()
1132 retval = reiserfs_security_init(parent_dir, inode, &dentry->d_name, in reiserfs_symlink()
1140 reiserfs_write_lock(parent_dir->i_sb); in reiserfs_symlink()
1142 if (item_len > MAX_DIRECT_ITEM_LEN(parent_dir->i_sb->s_blocksize)) { in reiserfs_symlink()
1143 retval = -ENAMETOOLONG; in reiserfs_symlink()
1151 retval = -ENOMEM; in reiserfs_symlink()
1157 retval = journal_begin(&th, parent_dir->i_sb, jbegin_count); in reiserfs_symlink()
1175 inode->i_op = &reiserfs_symlink_inode_operations; in reiserfs_symlink()
1177 inode->i_mapping->a_ops = &reiserfs_address_space_operations; in reiserfs_symlink()
1179 retval = reiserfs_add_entry(&th, parent_dir, dentry->d_name.name, in reiserfs_symlink()
1180 dentry->d_name.len, inode, 1 /*visible */ ); in reiserfs_symlink()
1196 reiserfs_write_unlock(parent_dir->i_sb); in reiserfs_symlink()
1212 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); in reiserfs_link()
1218 reiserfs_write_lock(dir->i_sb); in reiserfs_link()
1219 if (inode->i_nlink >= REISERFS_LINK_MAX) { in reiserfs_link()
1221 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1222 return -EMLINK; in reiserfs_link()
1228 retval = journal_begin(&th, dir->i_sb, jbegin_count); in reiserfs_link()
1231 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1237 reiserfs_add_entry(&th, dir, dentry->d_name.name, in reiserfs_link()
1238 dentry->d_name.len, inode, 1 /*visible */ ); in reiserfs_link()
1247 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1251 inode->i_ctime = current_time(inode); in reiserfs_link()
1257 reiserfs_write_unlock(dir->i_sb); in reiserfs_link()
1261 /* de contains information pointing to an entry which */
1263 struct reiserfs_dir_entry *de) in de_still_valid() argument
1265 struct reiserfs_dir_entry tmp = *de; in de_still_valid()
1270 if (tmp.de_namelen != len || memcmp(name, de->de_name, len)) in de_still_valid()
1276 struct reiserfs_dir_entry *de, in entry_points_to_object() argument
1279 if (!de_still_valid(name, len, de)) in entry_points_to_object()
1283 if (!de_visible(de->de_deh + de->de_entry_num)) in entry_points_to_object()
1284 reiserfs_panic(inode->i_sb, "vs-7042", in entry_points_to_object()
1285 "entry must be visible"); in entry_points_to_object()
1286 return (de->de_objectid == inode->i_ino) ? 1 : 0; in entry_points_to_object()
1289 /* this must be added hidden entry */ in entry_points_to_object()
1290 if (de_visible(de->de_deh + de->de_entry_num)) in entry_points_to_object()
1291 reiserfs_panic(NULL, "vs-7043", "entry must be visible"); in entry_points_to_object()
1297 static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de, in set_ino_in_dir_entry() argument
1300 /* JDM These operations are endian safe - both are le */ in set_ino_in_dir_entry()
1301 de->de_deh[de->de_entry_num].deh_dir_id = key->k_dir_id; in set_ino_in_dir_entry()
1302 de->de_deh[de->de_entry_num].deh_objectid = key->k_objectid; in set_ino_in_dir_entry()
1329 return -EINVAL; in reiserfs_rename()
1343 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); in reiserfs_rename()
1360 reiserfs_write_lock(old_dir->i_sb); in reiserfs_rename()
1362 reiserfs_find_entry(old_dir, old_dentry->d_name.name, in reiserfs_rename()
1363 old_dentry->d_name.len, &old_entry_path, in reiserfs_rename()
1367 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1368 return -EIO; in reiserfs_rename()
1371 if (retval != NAME_FOUND || old_de.de_objectid != old_inode->i_ino) { in reiserfs_rename()
1372 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1373 return -ENOENT; in reiserfs_rename()
1376 old_inode_mode = old_inode->i_mode; in reiserfs_rename()
1385 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1386 return -ENOTEMPTY; in reiserfs_rename()
1391 * directory is renamed, its parent directory will be changed, in reiserfs_rename()
1400 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1401 return -EIO; in reiserfs_rename()
1404 /* inode number of .. must equal old_dir->i_ino */ in reiserfs_rename()
1405 if (dot_dot_de.de_objectid != old_dir->i_ino) { in reiserfs_rename()
1406 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1407 return -EIO; in reiserfs_rename()
1411 retval = journal_begin(&th, old_dir->i_sb, jbegin_count); in reiserfs_rename()
1413 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1419 reiserfs_add_entry(&th, new_dir, new_dentry->d_name.name, in reiserfs_rename()
1420 new_dentry->d_name.len, old_inode, 0); in reiserfs_rename()
1421 if (retval == -EEXIST) { in reiserfs_rename()
1423 reiserfs_panic(old_dir->i_sb, "vs-7050", in reiserfs_rename()
1428 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1450 search_by_entry_key(new_dir->i_sb, &old_de.de_entry_key, in reiserfs_rename()
1455 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1456 return -EIO; in reiserfs_rename()
1461 reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1); in reiserfs_rename()
1466 reiserfs_find_entry(new_dir, new_dentry->d_name.name, in reiserfs_rename()
1467 new_dentry->d_name.len, &new_entry_path, in reiserfs_rename()
1479 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1480 return -EIO; in reiserfs_rename()
1485 reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1); in reiserfs_rename()
1487 if (S_ISDIR(old_inode->i_mode)) { in reiserfs_rename()
1489 search_by_entry_key(new_dir->i_sb, in reiserfs_rename()
1497 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()
1498 return -EIO; in reiserfs_rename()
1503 reiserfs_prepare_for_journal(old_inode->i_sb, in reiserfs_rename()
1510 * should lock the buffers, yes? -Hans in reiserfs_rename()
1515 * have to be written to deal with multi-path in reiserfs_rename()
1516 * issues -chris in reiserfs_rename()
1519 * sanity checking before doing the rename - avoid races many in reiserfs_rename()
1520 * of the above checks could have scheduled. We have to be in reiserfs_rename()
1524 !entry_points_to_object(new_dentry->d_name.name, in reiserfs_rename()
1525 new_dentry->d_name.len, in reiserfs_rename()
1528 !entry_points_to_object(old_dentry->d_name.name, in reiserfs_rename()
1529 old_dentry->d_name.len, in reiserfs_rename()
1531 reiserfs_restore_prepared_buffer(old_inode->i_sb, in reiserfs_rename()
1533 reiserfs_restore_prepared_buffer(old_inode->i_sb, in reiserfs_rename()
1536 reiserfs_restore_prepared_buffer(old_inode-> in reiserfs_rename()
1546 reiserfs_restore_prepared_buffer(old_inode-> in reiserfs_rename()
1549 reiserfs_restore_prepared_buffer(old_inode-> in reiserfs_rename()
1552 reiserfs_restore_prepared_buffer(old_inode-> in reiserfs_rename()
1567 * ok, all the changes can be done in one fell swoop when we in reiserfs_rename()
1578 old_dir->i_ctime = old_dir->i_mtime = ctime; in reiserfs_rename()
1579 new_dir->i_ctime = new_dir->i_mtime = ctime; in reiserfs_rename()
1584 old_inode->i_ctime = ctime; in reiserfs_rename()
1588 if (S_ISDIR(new_dentry_inode->i_mode)) { in reiserfs_rename()
1593 new_dentry_inode->i_ctime = ctime; in reiserfs_rename()
1594 savelink = new_dentry_inode->i_nlink; in reiserfs_rename()
1609 /* old directory lost one link - ".. " of renamed directory */ in reiserfs_rename()
1621 * anybody, but it will panic if will not be able to find the in reiserfs_rename()
1627 reiserfs_error(old_dir->i_sb, "vs-7060", in reiserfs_rename()
1630 old_dir->i_size -= DEH_SIZE + old_de.de_entrylen; in reiserfs_rename()
1644 reiserfs_write_unlock(old_dir->i_sb); in reiserfs_rename()