1 Index: linux-2.6.32.i386/fs/ext4/namei.c
2 ===================================================================
3 --- linux-2.6.32.i386.orig/fs/ext4/namei.c 2010-04-07 00:16:32.000000000 +0530
4 +++ linux-2.6.32.i386/fs/ext4/namei.c 2010-04-07 00:17:09.000000000 +0530
10 + * dentry_param used by ext4_new_inode_wantedi()
12 +#define LVFS_DENTRY_PARAM_MAGIC 20070216UL
13 +struct lvfs_dentry_params
15 + unsigned long ldp_inum;
16 + unsigned long ldp_flags;
20 static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
21 static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
22 static inline unsigned dx_get_hash(struct dx_entry *entry);
23 @@ -1751,6 +1762,19 @@
27 +static unsigned ext4_dentry_goal(struct super_block *sb, struct dentry *dentry)
29 + unsigned inum = EXT4_SB(sb)->s_inode_goal;
31 + if (dentry->d_fsdata != NULL) {
32 + struct lvfs_dentry_params *param = dentry->d_fsdata;
34 + if (param->ldp_magic == LVFS_DENTRY_PARAM_MAGIC)
35 + inum = param->ldp_inum;
41 * By the time this is called, we already have created
42 * the directory cache entry for the new file, but it
43 @@ -1745,7 +1769,8 @@ retry:
45 ext4_handle_sync(handle);
47 - inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0);
48 + inode = ext4_new_inode(handle, dir, mode, &dentry->d_name,
49 + ext4_dentry_goal(dir->i_sb, dentry));
52 inode->i_op = &ext4_file_inode_operations;
53 @@ -1779,7 +1804,8 @@ retry:
55 ext4_handle_sync(handle);
57 - inode = ext4_new_inode(handle, dir, mode, &dentry->d_name, 0);
58 + inode = ext4_new_inode(handle, dir, mode, &dentry->d_name,
59 + ext4_dentry_goal(dir->i_sb, dentry));
62 init_special_inode(inode, inode->i_mode, rdev);
63 @@ -1817,7 +1843,7 @@ retry:
64 ext4_handle_sync(handle);
66 inode = ext4_new_inode(handle, dir, S_IFDIR | mode,
67 - &dentry->d_name, 0);
68 + &dentry->d_name, ext4_dentry_goal(dir->i_sb, dentry));
72 @@ -2238,7 +2264,7 @@ retry:
73 ext4_handle_sync(handle);
75 inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO,
76 - &dentry->d_name, 0);
77 + &dentry->d_name, ext4_dentry_goal(dir->i_sb, dentry));