1 Index: linux-2.6.27.21-0.1/fs/ext4/ialloc.c
2 ===================================================================
3 --- linux-2.6.27.21-0.1.orig/fs/ext4/ialloc.c 2009-06-02 18:39:22.000000000 +0530
4 +++ linux-2.6.27.21-0.1/fs/ext4/ialloc.c 2009-06-04 17:01:26.000000000 +0530
6 * For other inodes, search forward from the parent directory's block
7 * group to find a free inode.
9 -struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
10 +struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode,
13 struct super_block *sb;
14 struct buffer_head *inode_bitmap_bh = NULL;
20 + group = (goal - 1) / EXT4_INODES_PER_GROUP(sb);
21 + ino = (goal - 1) % EXT4_INODES_PER_GROUP(sb);
24 + gdp = ext4_get_group_desc(sb, group, &group_desc_bh);
28 + inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
29 + if (!inode_bitmap_bh)
32 + BUFFER_TRACE(bh, "get_write_access");
33 + err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
37 + if (ext4_set_bit_atomic(sb_bgl_lock(sbi, group),
38 + ino, inode_bitmap_bh->b_data)) {
39 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
40 + /* Oh well, we tried. */
41 + goto continue_allocation;
44 + BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata");
45 + err = ext4_journal_dirty_metadata(handle, inode_bitmap_bh);
49 + /* We've shortcircuited the allocation system successfully,
50 + * now finish filling in the inode.
52 + BUFFER_TRACE(group_desc_bh, "get_write_access");
53 + err = ext4_journal_get_write_access(handle, group_desc_bh);
61 if (sbi->s_log_groups_per_flex) {
62 ret2 = find_group_flex(sb, dir, &group);
64 Index: linux-2.6.27.21-0.1/fs/ext4/namei.c
65 ===================================================================
66 --- linux-2.6.27.21-0.1.orig/fs/ext4/namei.c 2009-06-02 18:39:22.000000000 +0530
67 +++ linux-2.6.27.21-0.1/fs/ext4/namei.c 2009-06-04 17:00:38.000000000 +0530
74 * dx_root_info is laid out so that if it should somehow get overlaid by a
75 * dirent the two low bits of the hash version will be zero. Therefore, the
80 +#define LVFS_DENTRY_PARAM_MAGIC 20070216UL
81 +struct lvfs_dentry_params
83 + unsigned long p_inum;
88 static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
89 static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
90 static inline unsigned dx_get_hash(struct dx_entry *entry);
91 @@ -1716,6 +1725,20 @@
95 +static struct inode * ext4_new_inode_wantedi(handle_t *handle, struct inode *dir,
96 + int mode, struct dentry *dentry)
98 + unsigned long inum = 0;
100 + if (dentry->d_fsdata != NULL) {
101 + struct lvfs_dentry_params *param = dentry->d_fsdata;
103 + if (param->magic == LVFS_DENTRY_PARAM_MAGIC)
104 + inum = param->p_inum;
106 + return ext4_new_inode(handle, dir, mode, inum);
110 * By the time this is called, we already have created
111 * the directory cache entry for the new file, but it
112 @@ -1741,7 +1764,7 @@
116 - inode = ext4_new_inode (handle, dir, mode);
117 + inode = ext4_new_inode_wantedi(handle, dir, mode, dentry);
118 err = PTR_ERR(inode);
119 if (!IS_ERR(inode)) {
120 inode->i_op = &ext4_file_inode_operations;
121 @@ -1775,7 +1798,7 @@
125 - inode = ext4_new_inode(handle, dir, mode);
126 + inode = ext4_new_inode_wantedi(handle, dir, mode, dentry);
127 err = PTR_ERR(inode);
128 if (!IS_ERR(inode)) {
129 init_special_inode(inode, inode->i_mode, rdev);
130 @@ -1811,7 +1834,7 @@
134 - inode = ext4_new_inode(handle, dir, S_IFDIR | mode);
135 + inode = ext4_new_inode_wantedi(handle, dir, S_IFDIR | mode, dentry);
136 err = PTR_ERR(inode);
139 @@ -2211,7 +2234,7 @@
143 - inode = ext4_new_inode(handle, dir, S_IFLNK|S_IRWXUGO);
144 + inode = ext4_new_inode_wantedi(handle, dir, S_IFLNK|S_IRWXUGO, dentry);
145 err = PTR_ERR(inode);
148 Index: linux-2.6.27.21-0.1/fs/ext4/ext4.h
149 ===================================================================
150 --- linux-2.6.27.21-0.1.orig/fs/ext4/ext4.h 2009-06-02 18:39:22.000000000 +0530
151 +++ linux-2.6.27.21-0.1/fs/ext4/ext4.h 2009-06-04 17:00:38.000000000 +0530
152 @@ -1032,7 +1032,8 @@
153 dx_hash_info *hinfo);
156 -extern struct inode * ext4_new_inode(handle_t *, struct inode *, int);
157 +extern struct inode * ext4_new_inode(handle_t *, struct inode *, int,
159 extern void ext4_free_inode(handle_t *, struct inode *);
160 extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
161 extern unsigned long ext4_count_free_inodes(struct super_block *);
162 Index: linux-2.6.27.21-0.1/fs/ext4/migrate.c
163 ===================================================================
164 --- linux-2.6.27.21-0.1.orig/fs/ext4/migrate.c 2009-06-02 18:39:22.000000000 +0530
165 +++ linux-2.6.27.21-0.1/fs/ext4/migrate.c 2009-06-04 17:00:38.000000000 +0530
168 tmp_inode = ext4_new_inode(handle,
169 inode->i_sb->s_root->d_inode,
172 if (IS_ERR(tmp_inode)) {
174 ext4_journal_stop(handle);