Lines Matching defs:inode
54 struct inode *inode,
61 if (unlikely(EXT4_SB(inode->i_sb)->s_max_dir_size_kb &&
62 ((inode->i_size >> 10) >=
63 EXT4_SB(inode->i_sb)->s_max_dir_size_kb)))
66 *block = inode->i_size >> inode->i_sb->s_blocksize_bits;
75 err = ext4_map_blocks(NULL, inode, &map, 0);
79 EXT4_ERROR_INODE(inode, "Logical block already allocated");
83 bh = ext4_bread(handle, inode, *block, EXT4_GET_BLOCKS_CREATE);
86 inode->i_size += inode->i_sb->s_blocksize;
87 EXT4_I(inode)->i_disksize = inode->i_size;
88 err = ext4_mark_inode_dirty(handle, inode);
92 err = ext4_journal_get_write_access(handle, inode->i_sb, bh,
100 ext4_std_error(inode->i_sb, err);
104 static int ext4_dx_csum_verify(struct inode *inode,
121 #define ext4_read_dirblock(inode, block, type) \
122 __ext4_read_dirblock((inode), (block), (type), __func__, __LINE__)
124 static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
134 if (block >= inode->i_size >> inode->i_blkbits) {
135 ext4_error_inode(inode, func, line, block,
137 block, inode->i_size);
141 if (ext4_simulate_fail(inode->i_sb, EXT4_SIM_DIRBLOCK_EIO))
144 bh = ext4_bread(NULL, inode, block, 0);
146 __ext4_warning(inode->i_sb, func, line,
147 "inode #%lu: lblock %lu: comm %s: "
149 inode->i_ino, (unsigned long)block,
155 ext4_error_inode(inode, func, line, block,
164 if (is_dx(inode)) {
168 inode->i_sb->s_blocksize) ==
169 inode->i_sb->s_blocksize)
173 ext4_error_inode(inode, func, line, block,
178 if (!ext4_has_metadata_csum(inode->i_sb) ||
188 if (ext4_dx_csum_verify(inode, dirent) &&
189 !ext4_simulate_fail(inode->i_sb, EXT4_SIM_DIRBLOCK_CRC))
192 ext4_error_inode_err(inode, func, line, block,
200 if (ext4_dirblock_csum_verify(inode, bh) &&
201 !ext4_simulate_fail(inode->i_sb, EXT4_SIM_DIRBLOCK_CRC))
204 ext4_error_inode_err(inode, func, line, block,
222 __le32 inode;
301 static unsigned dx_root_limit(struct inode *dir, unsigned infosize);
302 static unsigned dx_node_limit(struct inode *dir);
304 struct inode *dir,
308 static int dx_make_map(struct inode *dir, struct buffer_head *bh,
312 static struct ext4_dir_entry_2 *dx_move_dirents(struct inode *dir, char *from,
315 static struct ext4_dir_entry_2 *dx_pack_dirents(struct inode *dir, char *base,
319 static int ext4_htree_next_block(struct inode *dir, __u32 hash,
323 static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
327 struct inode *dir, struct inode *inode);
342 static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode,
346 int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
363 t = EXT4_DIRENT_TAIL(bh->b_data, EXT4_BLOCK_SIZE(inode->i_sb));
376 static __le32 ext4_dirblock_csum(struct inode *inode, void *dirent, int size)
378 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
379 struct ext4_inode_info *ei = EXT4_I(inode);
386 #define warn_no_space_for_csum(inode) \
387 __warn_no_space_for_csum((inode), __func__, __LINE__)
389 static void __warn_no_space_for_csum(struct inode *inode, const char *func,
392 __ext4_warning_inode(inode, func, line,
396 int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh)
400 if (!ext4_has_metadata_csum(inode->i_sb))
403 t = get_dirent_tail(inode, bh);
405 warn_no_space_for_csum(inode);
409 if (t->det_checksum != ext4_dirblock_csum(inode, bh->b_data,
416 static void ext4_dirblock_csum_set(struct inode *inode,
421 if (!ext4_has_metadata_csum(inode->i_sb))
424 t = get_dirent_tail(inode, bh);
426 warn_no_space_for_csum(inode);
430 t->det_checksum = ext4_dirblock_csum(inode, bh->b_data,
435 struct inode *inode,
438 ext4_dirblock_csum_set(inode, bh);
439 return ext4_handle_dirty_metadata(handle, inode, bh);
442 static struct dx_countlimit *get_dx_countlimit(struct inode *inode,
449 int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
471 static __le32 ext4_dx_csum(struct inode *inode, struct ext4_dir_entry *dirent,
474 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
475 struct ext4_inode_info *ei = EXT4_I(inode);
489 static int ext4_dx_csum_verify(struct inode *inode,
496 if (!ext4_has_metadata_csum(inode->i_sb))
499 c = get_dx_countlimit(inode, dirent, &count_offset);
501 EXT4_ERROR_INODE(inode, "dir seems corrupt? Run e2fsck -D.");
507 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
508 warn_no_space_for_csum(inode);
513 if (t->dt_checksum != ext4_dx_csum(inode, dirent, count_offset,
519 static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent)
525 if (!ext4_has_metadata_csum(inode->i_sb))
528 c = get_dx_countlimit(inode, dirent, &count_offset);
530 EXT4_ERROR_INODE(inode, "dir seems corrupt? Run e2fsck -D.");
536 EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
537 warn_no_space_for_csum(inode);
542 t->dt_checksum = ext4_dx_csum(inode, dirent, count_offset, count, t);
546 struct inode *inode,
549 ext4_dx_csum_set(inode, (struct ext4_dir_entry *)bh->b_data);
550 return ext4_handle_dirty_metadata(handle, inode, bh);
608 static inline unsigned dx_root_limit(struct inode *dir, unsigned infosize)
619 static inline unsigned dx_node_limit(struct inode *dir)
652 static struct stats dx_show_leaf(struct inode *dir,
664 if (de->inode)
741 struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
809 dx_probe(struct ext4_filename *fname, struct inode *dir,
831 ext4_warning_inode(dir, "Unrecognised inode hash code %u",
1006 static int ext4_htree_next_block(struct inode *dir, __u32 hash,
1070 struct inode *dir, ext4_lblk_t block,
1116 if (de->name_len && de->inode) {
1135 if (de->inode == 0)
1188 struct inode *dir;
1294 struct inode *dir,
1311 static int dx_make_map(struct inode *dir, struct buffer_head *bh,
1329 if (de->name_len && de->inode) {
1401 static int ext4_ci_compare(const struct inode *parent, const struct qstr *name,
1445 int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname,
1487 static bool ext4_match(struct inode *parent,
1493 if (!de->inode)
1531 struct inode *dir, struct ext4_filename *fname,
1564 static int is_dx_internal_node(struct inode *dir, ext4_lblk_t block,
1573 if (de->inode == 0 &&
1585 * itself (as a parameter - res_dir). It does NOT read the inode of the
1591 static struct buffer_head *__ext4_find_entry(struct inode *dir,
1735 static struct buffer_head *ext4_find_entry(struct inode *dir,
1756 static struct buffer_head *ext4_lookup_entry(struct inode *dir,
1777 static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
1830 static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
1832 struct inode *inode;
1842 inode = NULL;
1844 __u32 ino = le32_to_cpu(de->inode);
1847 EXT4_ERROR_INODE(dir, "bad inode number: %u", ino);
1855 inode = ext4_iget(dir->i_sb, ino, EXT4_IGET_NORMAL);
1856 if (inode == ERR_PTR(-ESTALE)) {
1858 "deleted inode referenced: %u",
1862 if (!IS_ERR(inode) && IS_ENCRYPTED(dir) &&
1863 (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) &&
1864 !fscrypt_has_permitted_context(dir, inode)) {
1865 ext4_warning(inode->i_sb,
1867 dir->i_ino, inode->i_ino);
1868 iput(inode);
1874 if (!inode && IS_CASEFOLDED(dir)) {
1883 return d_splice_alias(inode, dentry);
1898 ino = le32_to_cpu(de->inode);
1903 "bad parent inode number: %u", ino);
1915 dx_move_dirents(struct inode *dir, char *from, char *to,
1931 de->inode = 0;
1947 static struct ext4_dir_entry_2 *dx_pack_dirents(struct inode *dir, char *base,
1956 if (de->inode && de->name_len) {
1974 static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
2096 int ext4_find_dest_de(struct inode *dir, struct inode *inode,
2118 if ((de->inode ? rlen - nlen : rlen) >= reclen)
2130 void ext4_insert_dentry(struct inode *dir,
2131 struct inode *inode,
2141 if (de->inode) {
2149 de->inode = cpu_to_le32(inode->i_ino);
2150 ext4_set_de_type(inode->i_sb, de, inode->i_mode);
2171 struct inode *dir,
2172 struct inode *inode, struct ext4_dir_entry_2 *de,
2179 if (ext4_has_metadata_csum(inode->i_sb))
2183 err = ext4_find_dest_de(dir, inode, bh, bh->b_data,
2197 ext4_insert_dentry(dir, inode, de, blocksize, fname);
2206 * recovery deletes the inode, so the worst that can
2226 struct inode *dir,
2227 struct inode *inode, struct buffer_head *bh)
2242 if (ext4_has_metadata_csum(inode->i_sb))
2246 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
2349 retval = add_dirent_to_buf(handle, fname, dir, inode, de, bh2);
2369 * NOTE!! The inode part of 'de' is left at 0 - which means you
2374 struct inode *inode)
2376 struct inode *dir = d_inode(dentry->d_parent);
2387 if (ext4_has_metadata_csum(inode->i_sb))
2409 retval = ext4_try_add_inline_entry(handle, &fname, dir, inode);
2419 retval = ext4_dx_add_entry(handle, &fname, dir, inode);
2448 retval = add_dirent_to_buf(handle, &fname, dir, inode,
2456 inode, bh);
2470 de->inode = 0;
2476 retval = add_dirent_to_buf(handle, &fname, dir, inode, de, bh);
2481 ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
2489 struct inode *dir, struct inode *inode)
2518 err = add_dirent_to_buf(handle, fname, dir, inode, NULL, bh);
2644 err = add_dirent_to_buf(handle, fname, dir, inode, de, bh);
2664 int ext4_generic_delete_entry(struct inode *dir,
2696 de->inode = 0;
2715 struct inode *dir,
2763 * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
2766 static void ext4_inc_count(struct inode *inode)
2768 inc_nlink(inode);
2769 if (is_dx(inode) &&
2770 (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
2771 set_nlink(inode, 1);
2778 static void ext4_dec_count(struct inode *inode)
2780 if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
2781 drop_nlink(inode);
2786 * Add non-directory inode to a directory. On success, the inode reference is
2789 * inode reference in the safe context.
2792 struct dentry *dentry, struct inode **inodep)
2794 struct inode *dir = d_inode(dentry->d_parent);
2795 struct inode *inode = *inodep;
2796 int err = ext4_add_entry(handle, dentry, inode);
2798 err = ext4_mark_inode_dirty(handle, inode);
2801 d_instantiate_new(dentry, inode);
2805 drop_nlink(inode);
2806 ext4_mark_inode_dirty(handle, inode);
2807 ext4_orphan_add(handle, inode);
2808 unlock_new_inode(inode);
2815 * is so far negative - it has no inode.
2817 * If the create succeeds, we fill in the inode information
2820 static int ext4_create(struct mnt_idmap *idmap, struct inode *dir,
2824 struct inode *inode;
2834 inode = ext4_new_inode_start_handle(idmap, dir, mode, &dentry->d_name,
2837 err = PTR_ERR(inode);
2838 if (!IS_ERR(inode)) {
2839 inode->i_op = &ext4_file_inode_operations;
2840 inode->i_fop = &ext4_file_operations;
2841 ext4_set_aops(inode);
2842 err = ext4_add_nondir(handle, dentry, &inode);
2848 if (!IS_ERR_OR_NULL(inode))
2849 iput(inode);
2855 static int ext4_mknod(struct mnt_idmap *idmap, struct inode *dir,
2859 struct inode *inode;
2869 inode = ext4_new_inode_start_handle(idmap, dir, mode, &dentry->d_name,
2872 err = PTR_ERR(inode);
2873 if (!IS_ERR(inode)) {
2874 init_special_inode(inode, inode->i_mode, rdev);
2875 inode->i_op = &ext4_special_inode_operations;
2876 err = ext4_add_nondir(handle, dentry, &inode);
2882 if (!IS_ERR_OR_NULL(inode))
2883 iput(inode);
2889 static int ext4_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
2893 struct inode *inode;
2901 inode = ext4_new_inode_start_handle(idmap, dir, mode,
2907 err = PTR_ERR(inode);
2908 if (!IS_ERR(inode)) {
2909 inode->i_op = &ext4_file_inode_operations;
2910 inode->i_fop = &ext4_file_operations;
2911 ext4_set_aops(inode);
2912 d_tmpfile(file, inode);
2913 err = ext4_orphan_add(handle, inode);
2916 mark_inode_dirty(inode);
2917 unlock_new_inode(inode);
2926 unlock_new_inode(inode);
2930 struct ext4_dir_entry_2 *ext4_init_dot_dotdot(struct inode *inode,
2935 de->inode = cpu_to_le32(inode->i_ino);
2940 ext4_set_de_type(inode->i_sb, de, S_IFDIR);
2943 de->inode = cpu_to_le32(parent_ino);
2954 ext4_set_de_type(inode->i_sb, de, S_IFDIR);
2959 int ext4_init_new_dir(handle_t *handle, struct inode *dir,
2960 struct inode *inode)
2972 if (ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) {
2973 err = ext4_try_create_inline_dir(handle, dir, inode);
2980 inode->i_size = 0;
2981 dir_block = ext4_append(handle, inode, &block);
2985 ext4_init_dot_dotdot(inode, de, blocksize, csum_size, dir->i_ino, 0);
2986 set_nlink(inode, 2);
2991 err = ext4_handle_dirty_dirblock(handle, inode, dir_block);
3000 static int ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
3004 struct inode *inode;
3017 inode = ext4_new_inode_start_handle(idmap, dir, S_IFDIR | mode,
3021 err = PTR_ERR(inode);
3022 if (IS_ERR(inode))
3025 inode->i_op = &ext4_dir_inode_operations;
3026 inode->i_fop = &ext4_dir_operations;
3027 err = ext4_init_new_dir(handle, dir, inode);
3030 err = ext4_mark_inode_dirty(handle, inode);
3032 err = ext4_add_entry(handle, dentry, inode);
3035 clear_nlink(inode);
3036 ext4_orphan_add(handle, inode);
3037 unlock_new_inode(inode);
3038 err2 = ext4_mark_inode_dirty(handle, inode);
3042 iput(inode);
3051 d_instantiate_new(dentry, inode);
3068 bool ext4_empty_dir(struct inode *inode)
3075 if (ext4_has_inline_data(inode)) {
3079 ret = empty_inline_dir(inode, &has_inline_data);
3084 sb = inode->i_sb;
3085 if (inode->i_size < ext4_dir_rec_len(1, NULL) +
3087 EXT4_ERROR_INODE(inode, "invalid size");
3093 bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE);
3098 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size,
3100 le32_to_cpu(de->inode) != inode->i_ino || strcmp(".", de->name)) {
3101 ext4_warning_inode(inode, "directory missing '.'");
3107 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data, bh->b_size,
3109 le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) {
3110 ext4_warning_inode(inode, "directory missing '..'");
3115 while (offset < inode->i_size) {
3120 bh = ext4_read_dirblock(inode, lblock, EITHER);
3130 if (ext4_check_dir_entry(inode, NULL, de, bh,
3132 le32_to_cpu(de->inode)) {
3142 static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
3145 struct inode *inode;
3169 inode = d_inode(dentry);
3172 if (le32_to_cpu(de->inode) != inode->i_ino)
3176 if (!ext4_empty_dir(inode))
3193 if (!EXT4_DIR_LINK_EMPTY(inode))
3194 ext4_warning_inode(inode,
3197 inode->i_nlink);
3198 inode_inc_iversion(inode);
3199 clear_nlink(inode);
3203 inode->i_size = 0;
3204 ext4_orphan_add(handle, inode);
3206 inode_set_ctime_current(inode);
3207 retval = ext4_mark_inode_dirty(handle, inode);
3233 int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
3234 struct inode *inode,
3254 if (le32_to_cpu(de->inode) != inode->i_ino) {
3257 * the inode. That's because it might have gotten
3258 * renamed to a different inode number
3260 if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)
3288 if (inode->i_nlink == 0)
3289 ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
3292 drop_nlink(inode);
3293 if (!inode->i_nlink)
3294 ext4_orphan_add(handle, inode);
3295 inode_set_ctime_current(inode);
3296 retval = ext4_mark_inode_dirty(handle, inode);
3306 static int ext4_unlink(struct inode *dir, struct dentry *dentry)
3342 static int ext4_init_symlink_block(handle_t *handle, struct inode *inode,
3349 bh = ext4_bread(handle, inode, 0, EXT4_GET_BLOCKS_CREATE);
3354 err = ext4_journal_get_write_access(handle, inode->i_sb, bh, EXT4_JTR_NONE);
3360 inode->i_size = disk_link->len - 1;
3361 EXT4_I(inode)->i_disksize = inode->i_size;
3362 err = ext4_handle_dirty_metadata(handle, inode, bh);
3368 static int ext4_symlink(struct mnt_idmap *idmap, struct inode *dir,
3372 struct inode *inode;
3392 * directory. +3 for inode, inode bitmap, group descriptor allocation.
3399 inode = ext4_new_inode_start_handle(idmap, dir, S_IFLNK|S_IRWXUGO,
3403 if (IS_ERR(inode)) {
3406 err = PTR_ERR(inode);
3410 if (IS_ENCRYPTED(inode)) {
3411 err = fscrypt_encrypt_symlink(inode, symname, len, &disk_link);
3414 inode->i_op = &ext4_encrypted_symlink_inode_operations;
3417 inode->i_op = &ext4_symlink_inode_operations;
3419 inode->i_op = &ext4_fast_symlink_inode_operations;
3420 inode->i_link = (char *)&EXT4_I(inode)->i_data;
3426 err = ext4_init_symlink_block(handle, inode, &disk_link);
3431 ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
3432 memcpy((char *)&EXT4_I(inode)->i_data, disk_link.name,
3434 inode->i_size = disk_link.len - 1;
3435 EXT4_I(inode)->i_disksize = inode->i_size;
3437 err = ext4_add_nondir(handle, dentry, &inode);
3440 iput(inode);
3444 clear_nlink(inode);
3445 ext4_mark_inode_dirty(handle, inode);
3446 ext4_orphan_add(handle, inode);
3447 unlock_new_inode(inode);
3450 iput(inode);
3459 int __ext4_link(struct inode *dir, struct inode *inode, struct dentry *dentry)
3473 inode_set_ctime_current(inode);
3474 ext4_inc_count(inode);
3475 ihold(inode);
3477 err = ext4_add_entry(handle, dentry, inode);
3479 err = ext4_mark_inode_dirty(handle, inode);
3483 if (inode->i_nlink == 1)
3484 ext4_orphan_del(handle, inode);
3485 d_instantiate(dentry, inode);
3488 drop_nlink(inode);
3489 iput(inode);
3498 struct inode *dir, struct dentry *dentry)
3500 struct inode *inode = d_inode(old_dentry);
3503 if (inode->i_nlink >= EXT4_LINK_MAX)
3518 return __ext4_link(dir, inode, dentry);
3523 * It should be the inode block if it is inlined or the 1st block
3527 struct inode *inode,
3534 if (!ext4_has_inline_data(inode)) {
3541 bh = ext4_read_dirblock(inode, 0, DIRENT_HTREE);
3548 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data,
3550 le32_to_cpu(de->inode) != inode->i_ino ||
3552 EXT4_ERROR_INODE(inode, "directory missing '.'");
3558 inode->i_sb->s_blocksize);
3559 de = ext4_next_entry(de, inode->i_sb->s_blocksize);
3560 if (ext4_check_dir_entry(inode, NULL, de, bh, bh->b_data,
3562 le32_to_cpu(de->inode) == 0 || strcmp("..", de->name)) {
3563 EXT4_ERROR_INODE(inode, "directory missing '..'");
3574 return ext4_get_first_inline_block(inode, parent_de, retval);
3578 struct inode *dir;
3580 struct inode *inode;
3589 /* entry for ".." in inode if it's a directory */
3599 ent->dir_bh = ext4_get_first_dir_block(handle, ent->inode,
3604 if (le32_to_cpu(ent->parent_de->inode) != ent->dir->i_ino)
3616 ent->parent_de->inode = cpu_to_le32(dir_ino);
3619 if (is_dx(ent->inode)) {
3621 ent->inode,
3624 retval = ext4_handle_dirty_dirblock(handle, ent->inode,
3628 retval = ext4_mark_inode_dirty(handle, ent->inode);
3647 ent->de->inode = cpu_to_le32(ino);
3673 * before reset old inode info.
3690 static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
3717 if (le32_to_cpu(ent->de->inode) != ent->inode->i_ino ||
3750 static struct inode *ext4_whiteout_for_rename(struct mnt_idmap *idmap,
3754 struct inode *wh;
3759 * for inode block, sb block, group summaries,
3760 * and inode bitmap
3789 * n.b. old_{dentry,inode) refers to the source dentry/inode
3790 * while new_{dentry,inode) refers to the destination dentry/inode
3793 static int ext4_rename(struct mnt_idmap *idmap, struct inode *old_dir,
3794 struct dentry *old_dentry, struct inode *new_dir,
3801 .inode = d_inode(old_dentry),
3806 .inode = d_inode(new_dentry),
3810 struct inode *whiteout = NULL;
3814 if (new.inode && new.inode->i_nlink == 0) {
3815 EXT4_ERROR_INODE(new.inode,
3828 retval = dquot_initialize(old.inode);
3837 if (new.inode) {
3838 retval = dquot_initialize(new.inode);
3849 * Check for inode number is _not_ due to possible IO errors.
3855 if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino)
3866 if (!new.inode) {
3871 if (new.inode && !test_opt(new.dir->i_sb, NO_AUTO_DA_ALLOC))
3872 ext4_alloc_da_blocks(old.inode);
3894 if (S_ISDIR(old.inode->i_mode)) {
3895 if (new.inode) {
3897 if (!ext4_empty_dir(new.inode))
3933 retval = ext4_add_entry(handle, new.dentry, old.inode);
3938 old.inode->i_ino, old_file_type);
3950 inode_set_ctime_current(old.inode);
3951 retval = ext4_mark_inode_dirty(handle, old.inode);
3962 if (new.inode) {
3963 ext4_dec_count(new.inode);
3964 inode_set_ctime_current(new.inode);
3974 if (new.inode) {
3978 clear_nlink(new.inode);
3991 if (S_ISDIR(old.inode->i_mode)) {
3997 ext4_fc_mark_ineligible(old.inode->i_sb,
4000 struct super_block *sb = old.inode->i_sb;
4002 if (new.inode)
4007 __ext4_fc_track_link(handle, old.inode, new.dentry);
4008 __ext4_fc_track_unlink(handle, old.inode, old.dentry);
4015 if (new.inode) {
4016 retval = ext4_mark_inode_dirty(handle, new.inode);
4019 if (!new.inode->i_nlink)
4020 ext4_orphan_add(handle, new.inode);
4028 old.inode->i_ino, old_file_type);
4047 static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
4048 struct inode *new_dir, struct dentry *new_dentry)
4054 .inode = d_inode(old_dentry),
4059 .inode = d_inode(new_dentry),
4084 * Check for inode number is _not_ due to possible IO errors.
4090 if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino)
4102 if (!new.bh || le32_to_cpu(new.de->inode) != new.inode->i_ino)
4117 if (S_ISDIR(old.inode->i_mode)) {
4123 if (S_ISDIR(new.inode->i_mode)) {
4144 retval = ext4_setent(handle, &new, old.inode->i_ino, old.de->file_type);
4148 retval = ext4_setent(handle, &old, new.inode->i_ino, new_file_type);
4156 inode_set_ctime_current(old.inode);
4157 inode_set_ctime_current(new.inode);
4158 retval = ext4_mark_inode_dirty(handle, old.inode);
4161 retval = ext4_mark_inode_dirty(handle, new.inode);
4164 ext4_fc_mark_ineligible(new.inode->i_sb,
4191 struct inode *old_dir, struct dentry *old_dentry,
4192 struct inode *new_dir, struct dentry *new_dentry,