1 fs/ext3/ialloc.c | 35 ++++++++++++++++++++++++++++++++++-
2 fs/ext3/ioctl.c | 25 +++++++++++++++++++++++++
3 fs/ext3/namei.c | 21 +++++++++++++++++----
4 include/linux/dcache.h | 5 +++++
5 include/linux/ext3_fs.h | 5 ++++-
6 5 files changed, 85 insertions(+), 6 deletions(-)
8 Index: uml-2.6.3/fs/ext3/ialloc.c
9 ===================================================================
10 --- uml-2.6.3.orig/fs/ext3/ialloc.c 2004-02-20 15:00:48.000000000 +0800
11 +++ uml-2.6.3/fs/ext3/ialloc.c 2004-02-21 00:24:45.202693776 +0800
13 * For other inodes, search forward from the parent directory's block
14 * group to find a free inode.
16 -struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
17 +struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode,
20 struct super_block *sb;
21 struct buffer_head *bitmap_bh = NULL;
27 + group = (goal - 1) / EXT3_INODES_PER_GROUP(sb);
28 + ino = (goal - 1) % EXT3_INODES_PER_GROUP(sb);
29 + gdp = ext3_get_group_desc(sb, group, &bh2);
32 + bitmap_bh = read_inode_bitmap (sb, group);
36 + BUFFER_TRACE(bh, "get_write_access");
37 + err = ext3_journal_get_write_access(handle, bitmap_bh);
40 + if (ext3_set_bit_atomic(sb_bgl_lock(sbi, group),
41 + ino, bitmap_bh->b_data)) {
42 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
43 + /* Oh well, we tried. */
44 + goto continue_allocation;
47 + BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
48 + err = ext3_journal_dirty_metadata(handle, bitmap_bh);
51 + /* We've shortcircuited the allocation system successfully,
52 + * now finish filling in the inode.
59 if (test_opt (sb, OLDALLOC))
60 group = find_group_dir(sb, dir);
61 Index: uml-2.6.3/fs/ext3/ioctl.c
62 ===================================================================
63 --- uml-2.6.3.orig/fs/ext3/ioctl.c 2004-01-09 14:59:26.000000000 +0800
64 +++ uml-2.6.3/fs/ext3/ioctl.c 2004-02-21 00:21:04.541239416 +0800
66 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
69 + case EXT3_IOC_CREATE_INUM: {
71 + struct dentry *dchild, *dparent;
74 + dparent = list_entry(inode->i_dentry.next, struct dentry,
76 + snprintf(name, sizeof name, "%lu", arg);
77 + dchild = lookup_one_len(name, dparent, strlen(name));
78 + if (dchild->d_inode) {
79 + printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
80 + dparent->d_name.len, dparent->d_name.name, arg,
81 + dchild->d_inode->i_ino);
84 + dchild->d_fsdata = (void *)arg;
85 + rc = vfs_create(inode, dchild, 0644, NULL);
87 + printk(KERN_ERR "vfs_create: %d\n", rc);
88 + else if (dchild->d_inode->i_ino != arg)
94 case EXT3_IOC_GETFLAGS:
95 flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
96 return put_user(flags, (int *) arg);
97 Index: uml-2.6.3/fs/ext3/namei.c
98 ===================================================================
99 --- uml-2.6.3.orig/fs/ext3/namei.c 2004-02-20 15:01:27.000000000 +0800
100 +++ uml-2.6.3/fs/ext3/namei.c 2004-02-21 00:21:04.611228776 +0800
101 @@ -1617,6 +1617,19 @@
105 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
106 + int mode, struct dentry *dentry)
108 + unsigned long inum = 0;
110 + if (dentry->d_fsdata != NULL) {
111 + struct dentry_params *param =
112 + (struct dentry_params *) dentry->d_fsdata;
113 + inum = param->p_inum;
115 + return ext3_new_inode(handle, dir, mode, inum);
119 * By the time this is called, we already have created
120 * the directory cache entry for the new file, but it
121 @@ -1640,7 +1653,7 @@
125 - inode = ext3_new_inode (handle, dir, mode);
126 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
127 err = PTR_ERR(inode);
128 if (!IS_ERR(inode)) {
129 inode->i_op = &ext3_file_inode_operations;
130 @@ -1670,7 +1683,7 @@
134 - inode = ext3_new_inode (handle, dir, mode);
135 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
136 err = PTR_ERR(inode);
137 if (!IS_ERR(inode)) {
138 init_special_inode(inode, inode->i_mode, rdev);
139 @@ -1702,7 +1715,7 @@
143 - inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
144 + inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
145 err = PTR_ERR(inode);
148 @@ -2094,7 +2107,7 @@
152 - inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
153 + inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
154 err = PTR_ERR(inode);
157 Index: uml-2.6.3/include/linux/ext3_fs.h
158 ===================================================================
159 --- uml-2.6.3.orig/include/linux/ext3_fs.h 2004-01-09 14:59:44.000000000 +0800
160 +++ uml-2.6.3/include/linux/ext3_fs.h 2004-02-21 00:21:04.613228472 +0800
162 #define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
163 #define EXT3_IOC_GETVERSION _IOR('f', 3, long)
164 #define EXT3_IOC_SETVERSION _IOW('f', 4, long)
165 +/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
166 #define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long)
167 #define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
168 #ifdef CONFIG_JBD_DEBUG
170 dx_hash_info *hinfo);
173 -extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
174 +extern struct inode * ext3_new_inode (handle_t *, struct inode *, int,
176 extern void ext3_free_inode (handle_t *, struct inode *);
177 extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
178 extern unsigned long ext3_count_free_inodes (struct super_block *);
181 #endif /* __KERNEL__ */
183 +#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
184 #endif /* _LINUX_EXT3_FS_H */