Whamcloud - gitweb
- put the exit(1)s back in after MPI_Abort() in the hopes that MPI
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-wantedi-2.6-suse.patch
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(-)
7
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
12 @@ -420,7 +420,8 @@
13   * For other inodes, search forward from the parent directory's block
14   * group to find a free inode.
15   */
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,
18 +                               unsigned long goal)
19  {
20         struct super_block *sb;
21         struct buffer_head *bitmap_bh = NULL;
22 @@ -448,6 +449,38 @@
23  
24         sbi = EXT3_SB(sb);
25         es = sbi->s_es;
26 +       if (goal) {
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);
30 +
31 +               err = -EIO;
32 +               bitmap_bh = read_inode_bitmap (sb, group);
33 +               if (!bitmap_bh)
34 +                       goto fail;
35 +
36 +               BUFFER_TRACE(bh, "get_write_access");
37 +               err = ext3_journal_get_write_access(handle, bitmap_bh);
38 +               if (err) goto fail;
39 +
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;
45 +               }
46 +
47 +               BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
48 +               err = ext3_journal_dirty_metadata(handle, bitmap_bh);
49 +               if (err) goto fail;
50 +
51 +               /* We've shortcircuited the allocation system successfully,
52 +                * now finish filling in the inode.
53 +                */
54 +               goto got;
55 +       }
56 +
57 +continue_allocation:
58         if (S_ISDIR(mode)) {
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
65 @@ -24,6 +24,31 @@
66         ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
67  
68         switch (cmd) {
69 +       case EXT3_IOC_CREATE_INUM: {
70 +               char name[32];
71 +               struct dentry *dchild, *dparent;
72 +               int rc = 0;
73 +
74 +               dparent = list_entry(inode->i_dentry.next, struct dentry,
75 +                                    d_alias);
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);
82 +                       rc = -EEXIST;
83 +               } else {
84 +                       dchild->d_fsdata = (void *)arg;
85 +                       rc = vfs_create(inode, dchild, 0644, NULL);
86 +                       if (rc)
87 +                               printk(KERN_ERR "vfs_create: %d\n", rc);
88 +                       else if (dchild->d_inode->i_ino != arg)
89 +                               rc = -EEXIST;
90 +               }
91 +               dput(dchild);
92 +               return rc;
93 +       }
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 @@
102         return err;
103  }
104  
105 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
106 +                                               int mode, struct dentry *dentry)
107 +{
108 +       unsigned long inum = 0;
109 +
110 +       if (dentry->d_fsdata != NULL) {
111 +               struct dentry_params *param =
112 +                       (struct dentry_params *) dentry->d_fsdata;
113 +               inum = param->p_inum;
114 +       }
115 +       return ext3_new_inode(handle, dir, mode, inum);
116 +}
117 +
118  /*
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 @@
122         if (IS_DIRSYNC(dir))
123                 handle->h_sync = 1;
124  
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 @@
131         if (IS_DIRSYNC(dir))
132                 handle->h_sync = 1;
133  
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 @@
140         if (IS_DIRSYNC(dir))
141                 handle->h_sync = 1;
142  
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);
146         if (IS_ERR(inode))
147                 goto out_stop;
148 @@ -2094,7 +2107,7 @@
149         if (IS_DIRSYNC(dir))
150                 handle->h_sync = 1;
151  
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);
155         if (IS_ERR(inode))
156                 goto out_stop;
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
161 @@ -203,6 +203,7 @@
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
169 @@ -707,7 +708,8 @@
170                           dx_hash_info *hinfo);
171  
172  /* ialloc.c */
173 -extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
174 +extern struct inode * ext3_new_inode (handle_t *, struct inode *, int,
175 +                                     unsigned long);
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 *);
179 @@ -792,4 +794,5 @@
180  
181  #endif /* __KERNEL__ */
182  
183 +#define EXT3_IOC_CREATE_INUM                   _IOW('f', 5, long)
184  #endif /* _LINUX_EXT3_FS_H */