Index: linux-2.6.32.i386/fs/ext4/namei.c =================================================================== --- linux-2.6.32.i386.orig/fs/ext4/namei.c 2010-04-07 00:16:32.000000000 +0530 +++ linux-2.6.32.i386/fs/ext4/namei.c 2010-04-07 00:17:09.000000000 +0530 @@ -144,6 +144,17 @@ u16 size; }; +/* + * dentry_param used by ext4_new_inode_wantedi() + */ +#define LVFS_DENTRY_PARAM_MAGIC 20070216UL +struct lvfs_dentry_params +{ + unsigned long ldp_inum; + unsigned long ldp_flags; + u32 ldp_magic; +}; + static inline ext4_lblk_t dx_get_block(struct dx_entry *entry); static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value); static inline unsigned dx_get_hash(struct dx_entry *entry); @@ -1751,6 +1762,19 @@ return err; } +static unsigned ext4_dentry_goal(struct super_block *sb, struct dentry *dentry) +{ + unsigned inum = EXT4_SB(sb)->s_inode_goal; + + if (dentry->d_fsdata != NULL) { + struct lvfs_dentry_params *param = dentry->d_fsdata; + + if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC) + inum = param->ldp_inum; + } + return inum; +} + /* * By the time this is called, we already have created * the directory cache entry for the new file, but it @@ -1745,7 +1769,8 @@ retry: if (IS_DIRSYNC(dir)) ext4_handle_sync(handle); - inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0); + inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, + ext4_dentry_goal(dir->i_sb, dentry)); err = PTR_ERR(inode); if (!IS_ERR(inode)) { inode->i_op = &ext4_file_inode_operations; @@ -1779,7 +1804,8 @@ retry: if (IS_DIRSYNC(dir)) ext4_handle_sync(handle); - inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0); + inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, + ext4_dentry_goal(dir->i_sb, dentry)); err = PTR_ERR(inode); if (!IS_ERR(inode)) { init_special_inode(inode, inode->i_mode, rdev); @@ -1817,7 +1843,7 @@ retry: ext4_handle_sync(handle); inode = ext4_new_inode(handle, dir, S_IFDIR | mode, - &dentry->d_name, 0); + &dentry->d_name, ext4_dentry_goal(dir->i_sb, dentry)); err = PTR_ERR(inode); if (IS_ERR(inode)) goto out_stop; @@ -2238,7 +2264,7 @@ retry: ext4_handle_sync(handle); inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO, - &dentry->d_name, 0); + &dentry->d_name, ext4_dentry_goal(dir->i_sb, dentry)); err = PTR_ERR(inode); if (IS_ERR(inode)) goto out_stop;