1 fs/ext3/ialloc.c | 41 +++++++++++++++++++++++++++++++++++++++--
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, 91 insertions(+), 8 deletions(-)
9 --- linux-2.4.22-ac1/fs/ext3/ialloc.c~extN-wantedi-2.4.22-rh 2003-09-26 00:57:29.000000000 +0400
10 +++ linux-2.4.22-ac1-alexey/fs/ext3/ialloc.c 2003-09-26 01:00:17.000000000 +0400
11 @@ -524,7 +524,8 @@ static int find_group_other(struct super
12 * group to find a free inode.
14 struct inode * ext3_new_inode (handle_t *handle,
15 - const struct inode * dir, int mode)
16 + const struct inode * dir, int mode,
19 struct super_block * sb;
20 struct buffer_head * bh;
21 @@ -549,7 +550,41 @@ struct inode * ext3_new_inode (handle_t
22 init_rwsem(&inode->u.ext3_i.truncate_sem);
25 - es = sb->u.ext3_sb.s_es;
26 + es = EXT3_SB(sb)->s_es;
29 + group = (goal - 1) / EXT3_INODES_PER_GROUP(sb);
30 + ino = (goal - 1) % EXT3_INODES_PER_GROUP(sb);
31 + gdp = ext3_get_group_desc(sb, group, &bh2);
33 + bitmap_nr = load_inode_bitmap (sb, group);
34 + if (bitmap_nr < 0) {
39 + bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
41 + BUFFER_TRACE(bh, "get_write_access");
42 + err = ext3_journal_get_write_access(handle, bh);
45 + if (ext3_set_bit(ino, bh->b_data)) {
46 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
47 + /* Oh well, we tried. */
51 + BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
52 + err = ext3_journal_dirty_metadata(handle, bh);
55 + /* We've shortcircuited the allocation system successfully,
56 + * now finish filling in the inode.
58 + goto have_bit_and_group;
63 if (test_opt (sb, OLDALLOC))
64 @@ -606,6 +641,8 @@ repeat:
70 ino += group * EXT3_INODES_PER_GROUP(sb) + 1;
71 if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
72 ext3_error (sb, "ext3_new_inode",
73 --- linux-2.4.22-ac1/fs/ext3/inode.c~extN-wantedi-2.4.22-rh 2003-09-26 00:57:29.000000000 +0400
74 +++ linux-2.4.22-ac1-alexey/fs/ext3/inode.c 2003-09-26 00:57:29.000000000 +0400
75 @@ -2614,7 +2614,7 @@ void ext3_truncate_thread(struct inode *
79 - new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode);
80 + new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode, 0);
81 if (IS_ERR(new_inode)) {
82 ext3_debug("truncate inode %lu directly (no new inodes)\n",
84 --- linux-2.4.22-ac1/fs/ext3/ioctl.c~extN-wantedi-2.4.22-rh 2003-09-25 14:16:23.000000000 +0400
85 +++ linux-2.4.22-ac1-alexey/fs/ext3/ioctl.c 2003-09-26 00:57:29.000000000 +0400
86 @@ -23,6 +23,31 @@ int ext3_ioctl (struct inode * inode, st
87 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
90 + case EXT3_IOC_CREATE_INUM: {
92 + struct dentry *dchild, *dparent;
95 + dparent = list_entry(inode->i_dentry.next, struct dentry,
97 + snprintf(name, sizeof name, "%lu", arg);
98 + dchild = lookup_one_len(name, dparent, strlen(name));
99 + if (dchild->d_inode) {
100 + printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
101 + dparent->d_name.len, dparent->d_name.name, arg,
102 + dchild->d_inode->i_ino);
105 + dchild->d_fsdata = (void *)arg;
106 + rc = vfs_create(inode, dchild, 0644);
108 + printk(KERN_ERR "vfs_create: %d\n", rc);
109 + else if (dchild->d_inode->i_ino != arg)
115 case EXT3_IOC_GETFLAGS:
116 flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
117 return put_user(flags, (int *) arg);
118 --- linux-2.4.22-ac1/fs/ext3/namei.c~extN-wantedi-2.4.22-rh 2003-09-26 00:57:28.000000000 +0400
119 +++ linux-2.4.22-ac1-alexey/fs/ext3/namei.c 2003-09-26 00:57:29.000000000 +0400
120 @@ -1534,6 +1534,19 @@ static int ext3_add_nondir(handle_t *han
124 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
125 + int mode, struct dentry *dentry)
127 + unsigned long inum = 0;
129 + if (dentry->d_fsdata != NULL) {
130 + struct dentry_params *param =
131 + (struct dentry_params *) dentry->d_fsdata;
132 + inum = param->p_inum;
134 + return ext3_new_inode(handle, dir, mode, inum);
138 * By the time this is called, we already have created
139 * the directory cache entry for the new file, but it
140 @@ -1557,7 +1570,7 @@ static int ext3_create (struct inode * d
144 - inode = ext3_new_inode (handle, dir, mode);
145 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
146 err = PTR_ERR(inode);
147 if (!IS_ERR(inode)) {
148 inode->i_op = &ext3_file_inode_operations;
149 @@ -1585,7 +1598,7 @@ static int ext3_mknod (struct inode * di
153 - inode = ext3_new_inode (handle, dir, mode);
154 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
155 err = PTR_ERR(inode);
156 if (!IS_ERR(inode)) {
157 init_special_inode(inode, mode, rdev);
158 @@ -1615,7 +1628,7 @@ static int ext3_mkdir(struct inode * dir
162 - inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
163 + inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
164 err = PTR_ERR(inode);
167 @@ -2010,7 +2023,7 @@ static int ext3_symlink (struct inode *
171 - inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
172 + inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
173 err = PTR_ERR(inode);
176 --- linux-2.4.22-ac1/include/linux/dcache.h~extN-wantedi-2.4.22-rh 2003-09-26 00:57:27.000000000 +0400
177 +++ linux-2.4.22-ac1-alexey/include/linux/dcache.h 2003-09-26 00:57:29.000000000 +0400
178 @@ -63,6 +63,11 @@ static inline void intent_init(struct lo
180 #define IS_ROOT(x) ((x) == (x)->d_parent)
182 +struct dentry_params {
183 + unsigned long p_inum;
188 * "quick string" -- eases parameter passing, but more importantly
189 * saves "metadata" about the string (ie length and the hash).
190 --- linux-2.4.22-ac1/include/linux/ext3_fs.h~extN-wantedi-2.4.22-rh 2003-09-26 00:57:29.000000000 +0400
191 +++ linux-2.4.22-ac1-alexey/include/linux/ext3_fs.h 2003-09-26 00:57:29.000000000 +0400
192 @@ -203,6 +203,7 @@ struct ext3_group_desc
193 #define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
194 #define EXT3_IOC_GETVERSION _IOR('f', 3, long)
195 #define EXT3_IOC_SETVERSION _IOW('f', 4, long)
196 +/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
197 #define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long)
198 #define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
199 #ifdef CONFIG_JBD_DEBUG
200 @@ -676,7 +677,8 @@ extern int ext3fs_dirhash(const char *na
201 dx_hash_info *hinfo);
204 -extern struct inode * ext3_new_inode (handle_t *, const struct inode *, int);
205 +extern struct inode * ext3_new_inode (handle_t *, const struct inode *, int,
207 extern void ext3_free_inode (handle_t *, struct inode *);
208 extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
209 extern unsigned long ext3_count_free_inodes (struct super_block *);
210 @@ -769,4 +771,5 @@ extern struct inode_operations ext3_fast
212 #endif /* __KERNEL__ */
214 +#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
215 #endif /* _LINUX_EXT3_FS_H */