1 fs/ext3/ialloc.c | 40 ++++++++++++++++++++++++++++++++++++++--
3 fs/ext3/ioctl.c | 25 +++++++++++++++++++++++++
4 fs/ext3/namei.c | 21 +++++++++++++++++----
5 include/linux/dcache.h | 5 +++++
6 include/linux/ext3_fs.h | 5 ++++-
7 6 files changed, 90 insertions(+), 8 deletions(-)
9 Index: linux-2.4.24/fs/ext3/namei.c
10 ===================================================================
11 --- linux-2.4.24.orig/fs/ext3/namei.c 2004-05-19 13:58:43.000000000 +0400
12 +++ linux-2.4.24/fs/ext3/namei.c 2004-05-21 18:26:43.000000000 +0400
13 @@ -1533,6 +1533,23 @@
17 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
18 + int mode, struct dentry *dentry)
20 + struct dentry_params *param = (struct dentry_params *) dentry->d_fsdata;
21 + unsigned long inum = 0;
22 + struct inode *inode;
25 + inum = param->p_inum;
26 + inode = ext3_new_inode(handle, dir, mode, inum);
27 + if (inode && param && inum && param->p_generation) {
28 + inode->i_generation = param->p_generation;
29 + ext3_mark_inode_dirty(handle, inode);
35 * By the time this is called, we already have created
36 * the directory cache entry for the new file, but it
41 - inode = ext3_new_inode (handle, dir, mode);
42 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
45 inode->i_op = &ext3_file_inode_operations;
50 - inode = ext3_new_inode (handle, dir, mode);
51 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
54 init_special_inode(inode, mode, rdev);
59 - inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
60 + inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
68 - inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
69 + inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
73 Index: linux-2.4.24/fs/ext3/ialloc.c
74 ===================================================================
75 --- linux-2.4.24.orig/fs/ext3/ialloc.c 2004-05-19 13:58:43.000000000 +0400
76 +++ linux-2.4.24/fs/ext3/ialloc.c 2004-05-19 13:58:43.000000000 +0400
78 * group to find a free inode.
80 struct inode * ext3_new_inode (handle_t *handle,
81 - const struct inode * dir, int mode)
82 + const struct inode * dir, int mode,
85 struct super_block * sb;
86 struct buffer_head * bh;
88 init_rwsem(&inode->u.ext3_i.truncate_sem);
91 - es = sb->u.ext3_sb.s_es;
92 + es = EXT3_SB(sb)->s_es;
95 + i = (goal - 1) / EXT3_INODES_PER_GROUP(sb);
96 + j = (goal - 1) % EXT3_INODES_PER_GROUP(sb);
97 + gdp = ext3_get_group_desc(sb, i, &bh2);
99 + bitmap_nr = load_inode_bitmap (sb, i);
100 + if (bitmap_nr < 0) {
105 + bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
107 + BUFFER_TRACE(bh, "get_write_access");
108 + err = ext3_journal_get_write_access(handle, bh);
109 + if (err) goto fail;
111 + if (ext3_set_bit(j, bh->b_data)) {
112 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
113 + /* Oh well, we tried. */
117 + BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
118 + err = ext3_journal_dirty_metadata(handle, bh);
119 + if (err) goto fail;
121 + /* We've shortcircuited the allocation system successfully,
122 + * now finish filling in the inode.
124 + goto have_bit_and_group;
134 + have_bit_and_group:
135 j += i * EXT3_INODES_PER_GROUP(sb) + 1;
136 if (j < EXT3_FIRST_INO(sb) || j > le32_to_cpu(es->s_inodes_count)) {
137 ext3_error (sb, "ext3_new_inode",
138 Index: linux-2.4.24/fs/ext3/inode.c
139 ===================================================================
140 --- linux-2.4.24.orig/fs/ext3/inode.c 2004-05-19 13:58:43.000000000 +0400
141 +++ linux-2.4.24/fs/ext3/inode.c 2004-05-19 13:58:43.000000000 +0400
142 @@ -2605,7 +2605,7 @@
146 - new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode);
147 + new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode, 0);
148 if (IS_ERR(new_inode)) {
149 ext3_debug("truncate inode %lu directly (no new inodes)\n",
151 Index: linux-2.4.24/fs/ext3/ioctl.c
152 ===================================================================
153 --- linux-2.4.24.orig/fs/ext3/ioctl.c 2004-01-10 17:04:42.000000000 +0300
154 +++ linux-2.4.24/fs/ext3/ioctl.c 2004-05-19 13:58:43.000000000 +0400
156 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
159 + case EXT3_IOC_CREATE_INUM: {
161 + struct dentry *dchild, *dparent;
164 + dparent = list_entry(inode->i_dentry.next, struct dentry,
166 + snprintf(name, sizeof name, "%lu", arg);
167 + dchild = lookup_one_len(name, dparent, strlen(name));
168 + if (dchild->d_inode) {
169 + printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
170 + dparent->d_name.len, dparent->d_name.name, arg,
171 + dchild->d_inode->i_ino);
174 + dchild->d_fsdata = (void *)arg;
175 + rc = vfs_create(inode, dchild, 0644);
177 + printk(KERN_ERR "vfs_create: %d\n", rc);
178 + else if (dchild->d_inode->i_ino != arg)
184 case EXT3_IOC_GETFLAGS:
185 flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
186 return put_user(flags, (int *) arg);
187 Index: linux-2.4.24/include/linux/ext3_fs.h
188 ===================================================================
189 --- linux-2.4.24.orig/include/linux/ext3_fs.h 2004-05-19 13:58:43.000000000 +0400
190 +++ linux-2.4.24/include/linux/ext3_fs.h 2004-05-19 13:58:43.000000000 +0400
192 #define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
193 #define EXT3_IOC_GETVERSION _IOR('f', 3, long)
194 #define EXT3_IOC_SETVERSION _IOW('f', 4, long)
195 +/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
196 #define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long)
197 #define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
198 #ifdef CONFIG_JBD_DEBUG
200 dx_hash_info *hinfo);
203 -extern struct inode * ext3_new_inode (handle_t *, const struct inode *, int);
204 +extern struct inode * ext3_new_inode (handle_t *, const struct inode *, int,
206 extern void ext3_free_inode (handle_t *, struct inode *);
207 extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
208 extern unsigned long ext3_count_free_inodes (struct super_block *);
211 #endif /* __KERNEL__ */
213 +#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
214 #endif /* _LINUX_EXT3_FS_H */
215 Index: linux-2.4.24/include/linux/dcache.h
216 ===================================================================
217 --- linux-2.4.24.orig/include/linux/dcache.h 2004-05-19 13:58:42.000000000 +0400
218 +++ linux-2.4.24/include/linux/dcache.h 2004-05-21 18:20:34.000000000 +0400
221 #define IS_ROOT(x) ((x) == (x)->d_parent)
223 +struct dentry_params {
224 + unsigned long p_inum;
225 + unsigned long p_generation;
230 * "quick string" -- eases parameter passing, but more importantly
231 * saves "metadata" about the string (ie length and the hash).