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);
31 + gdp = ext3_get_group_desc(sb, group, &bh2);
35 + bitmap_bh = read_inode_bitmap (sb, group);
39 + BUFFER_TRACE(bh, "get_write_access");
40 + err = ext3_journal_get_write_access(handle, bitmap_bh);
43 + if (ext3_set_bit_atomic(sb_bgl_lock(sbi, group),
44 + ino, bitmap_bh->b_data)) {
45 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
46 + /* Oh well, we tried. */
47 + goto continue_allocation;
50 + BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
51 + err = ext3_journal_dirty_metadata(handle, bitmap_bh);
54 + /* We've shortcircuited the allocation system successfully,
55 + * now finish filling in the inode.
62 if (test_opt (sb, OLDALLOC))
63 group = find_group_dir(sb, dir);
64 Index: uml-2.6.3/fs/ext3/ioctl.c
65 ===================================================================
66 --- uml-2.6.3.orig/fs/ext3/ioctl.c 2004-01-09 14:59:26.000000000 +0800
67 +++ uml-2.6.3/fs/ext3/ioctl.c 2004-02-21 00:21:04.541239416 +0800
69 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
72 + case EXT3_IOC_CREATE_INUM: {
74 + struct dentry *dchild, *dparent;
77 + dparent = list_entry(inode->i_dentry.next, struct dentry,
79 + snprintf(name, sizeof name, "%lu", arg);
80 + dchild = lookup_one_len(name, dparent, strlen(name));
81 + if (dchild->d_inode) {
82 + printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
83 + dparent->d_name.len, dparent->d_name.name, arg,
84 + dchild->d_inode->i_ino);
87 + dchild->d_fsdata = (void *)arg;
88 + rc = vfs_create(inode, dchild, 0644, NULL);
90 + printk(KERN_ERR "vfs_create: %d\n", rc);
91 + else if (dchild->d_inode->i_ino != arg)
97 case EXT3_IOC_GETFLAGS:
98 flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
99 return put_user(flags, (int *) arg);
100 Index: uml-2.6.3/fs/ext3/namei.c
101 ===================================================================
102 --- uml-2.6.3.orig/fs/ext3/namei.c 2004-02-20 15:01:27.000000000 +0800
103 +++ uml-2.6.3/fs/ext3/namei.c 2004-02-21 00:21:04.611228776 +0800
104 @@ -1617,6 +1617,19 @@
108 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
109 + int mode, struct dentry *dentry)
111 + unsigned long inum = 0;
113 + if (dentry->d_fsdata != NULL) {
114 + struct dentry_params *param =
115 + (struct dentry_params *) dentry->d_fsdata;
116 + inum = param->p_inum;
118 + return ext3_new_inode(handle, dir, mode, inum);
122 * By the time this is called, we already have created
123 * the directory cache entry for the new file, but it
124 @@ -1640,7 +1653,7 @@
128 - inode = ext3_new_inode (handle, dir, mode);
129 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
130 err = PTR_ERR(inode);
131 if (!IS_ERR(inode)) {
132 inode->i_op = &ext3_file_inode_operations;
133 @@ -1670,7 +1683,7 @@
137 - inode = ext3_new_inode (handle, dir, mode);
138 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
139 err = PTR_ERR(inode);
140 if (!IS_ERR(inode)) {
141 init_special_inode(inode, inode->i_mode, rdev);
142 @@ -1702,7 +1715,7 @@
146 - inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
147 + inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
148 err = PTR_ERR(inode);
151 @@ -2094,7 +2107,7 @@
155 - inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
156 + inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
157 err = PTR_ERR(inode);
160 Index: uml-2.6.3/include/linux/ext3_fs.h
161 ===================================================================
162 --- uml-2.6.3.orig/include/linux/ext3_fs.h 2004-01-09 14:59:44.000000000 +0800
163 +++ uml-2.6.3/include/linux/ext3_fs.h 2004-02-21 00:21:04.613228472 +0800
165 dx_hash_info *hinfo);
168 -extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
169 +extern struct inode * ext3_new_inode (handle_t *, struct inode *, int,
171 extern void ext3_free_inode (handle_t *, struct inode *);
172 extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
173 extern unsigned long ext3_count_free_inodes (struct super_block *);
176 #endif /* __KERNEL__ */
178 +/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
179 +#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
180 #endif /* _LINUX_EXT3_FS_H */