Whamcloud - gitweb
- extents patch updated from b1_4:
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-extents-oflag-2.4.18-chaos.patch
1  fs/ext3/ialloc.c            |    5 +++--
2  fs/ext3/inode.c             |    2 +-
3  fs/ext3/namei.c             |   43 +++++++++++++++++++++++++++++++++++++------
4  include/asm-alpha/fcntl.h   |    1 +
5  include/asm-arm/fcntl.h     |    1 +
6  include/asm-cris/fcntl.h    |    1 +
7  include/asm-i386/fcntl.h    |    1 +
8  include/asm-ia64/fcntl.h    |    1 +
9  include/asm-m68k/fcntl.h    |    1 +
10  include/asm-mips/fcntl.h    |    1 +
11  include/asm-mips64/fcntl.h  |    1 +
12  include/asm-parisc/fcntl.h  |    1 +
13  include/asm-ppc/fcntl.h     |    1 +
14  include/asm-s390/fcntl.h    |    1 +
15  include/asm-s390x/fcntl.h   |    1 +
16  include/asm-sh/fcntl.h      |    1 +
17  include/asm-sparc/fcntl.h   |    1 +
18  include/asm-sparc64/fcntl.h |    1 +
19  include/linux/ext3_fs.h     |    2 +-
20  19 files changed, 57 insertions(+), 10 deletions(-)
21
22 --- linux-2.4.18-chaos/fs/ext3/ialloc.c~ext3-extents-oflag-2.4.18-chaos 2003-10-08 10:29:12.000000000 +0400
23 +++ linux-2.4.18-chaos-alexey/fs/ext3/ialloc.c  2003-10-08 10:29:30.000000000 +0400
24 @@ -331,7 +331,8 @@ int ext3_itable_block_used(struct super_
25   */
26  struct inode * ext3_new_inode (handle_t *handle,
27                                 const struct inode * dir, int mode,
28 -                               unsigned long goal)
29 +                               unsigned long goal,
30 +                               struct lookup_intent *it)
31  {
32         struct super_block * sb;
33         struct buffer_head * bh;
34 @@ -573,7 +574,7 @@ repeat:
35         ei->i_prealloc_count = 0;
36  #endif
37         ei->i_block_group = i;
38 -       if (test_opt(sb, EXTENTS))
39 +       if (test_opt(sb, EXTENTS) && it && (it->it_flags & O_EXTENTS))
40                 EXT3_I(inode)->i_flags |= EXT3_EXTENTS_FL;
41         ei->i_depth = 0;
42         sema_init(&ei->i_ext_sem, 1);
43 --- linux-2.4.18-chaos/fs/ext3/namei.c~ext3-extents-oflag-2.4.18-chaos  2003-10-08 10:29:11.000000000 +0400
44 +++ linux-2.4.18-chaos-alexey/fs/ext3/namei.c   2003-10-08 10:36:33.000000000 +0400
45 @@ -1204,7 +1204,9 @@ static int ext3_add_nondir(handle_t *han
46  }
47  
48  static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
49 -                                               int mode, struct dentry *dentry)
50 +                                               int mode, struct dentry *dentry,
51 +                                               struct lookup_intent *it)
52 +
53  {
54         unsigned long inum = 0;
55  
56 @@ -1213,7 +1215,7 @@ static struct inode * ext3_new_inode_wan
57                         (struct dentry_params *) dentry->d_fsdata;
58                 inum = param->p_inum;
59         }
60 -       return ext3_new_inode(handle, dir, mode, inum);
61 +       return ext3_new_inode(handle, dir, mode, inum, it);
62  }
63  
64  /*
65 @@ -1238,7 +1240,35 @@ static int ext3_create (struct inode * d
66         if (IS_SYNC(dir))
67                 handle->h_sync = 1;
68  
69 -       inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
70 +       inode = ext3_new_inode_wantedi (handle, dir, mode, dentry, NULL);
71 +       err = PTR_ERR(inode);
72 +       if (!IS_ERR(inode)) {
73 +               inode->i_op = &ext3_file_inode_operations;
74 +               inode->i_fop = &ext3_file_operations;
75 +               inode->i_mapping->a_ops = &ext3_aops;
76 +               err = ext3_add_nondir(handle, dentry, inode);
77 +               ext3_mark_inode_dirty(handle, inode);
78 +       }
79 +       ext3_journal_stop(handle, dir);
80 +       return err;
81 +}
82 +
83 +static int ext3_create_it (struct inode * dir, struct dentry * dentry, int mode,
84 +                               struct lookup_intent *it)
85 +{
86 +       handle_t *handle; 
87 +       struct inode * inode;
88 +       int err;
89 +
90 +       handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS +
91 +                                       EXT3_INDEX_EXTRA_TRANS_BLOCKS + 3);
92 +       if (IS_ERR(handle))
93 +               return PTR_ERR(handle);
94 +
95 +       if (IS_SYNC(dir))
96 +               handle->h_sync = 1;
97 +
98 +       inode = ext3_new_inode_wantedi (handle, dir, mode, dentry, it);
99         err = PTR_ERR(inode);
100         if (!IS_ERR(inode)) {
101                 inode->i_op = &ext3_file_inode_operations;
102 @@ -1266,7 +1296,7 @@ static int ext3_mknod (struct inode * di
103         if (IS_SYNC(dir))
104                 handle->h_sync = 1;
105  
106 -       inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
107 +       inode = ext3_new_inode_wantedi (handle, dir, mode, dentry, NULL);
108         err = PTR_ERR(inode);
109         if (!IS_ERR(inode)) {
110                 init_special_inode(inode, mode, rdev);
111 @@ -1296,7 +1326,7 @@ static int ext3_mkdir(struct inode * dir
112         if (IS_SYNC(dir))
113                 handle->h_sync = 1;
114  
115 -       inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
116 +       inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR|mode, dentry, NULL);
117         err = PTR_ERR(inode);
118         if (IS_ERR(inode))
119                 goto out_stop;
120 @@ -1688,7 +1718,7 @@ static int ext3_symlink (struct inode * 
121         if (IS_SYNC(dir))
122                 handle->h_sync = 1;
123  
124 -       inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
125 +       inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry,NULL);
126         err = PTR_ERR(inode);
127         if (IS_ERR(inode))
128                 goto out_stop;
129 @@ -1892,6 +1922,7 @@ end_rename:
130   * directories can handle most operations...
131   */
132  struct inode_operations ext3_dir_inode_operations = {
133 +       create_it:      ext3_create_it,         /* BKL held */
134         create:         ext3_create,            /* BKL held */
135         lookup:         ext3_lookup,            /* BKL held */
136         link:           ext3_link,              /* BKL held */
137 --- linux-2.4.18-chaos/include/asm-alpha/fcntl.h~ext3-extents-oflag-2.4.18-chaos        2003-07-28 17:52:07.000000000 +0400
138 +++ linux-2.4.18-chaos-alexey/include/asm-alpha/fcntl.h 2003-10-08 10:29:30.000000000 +0400
139 @@ -22,6 +22,7 @@
140  #define O_LARGEFILE    0400000 /* will be set by the kernel on every open */
141  #define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */
142  #define O_DIRECT       02000000 /* direct disk access - should check with OSF/1 */
143 +#define O_EXTENTS      04000000 /* create file with extents if possible */
144  
145  #define F_DUPFD                0       /* dup */
146  #define F_GETFD                1       /* get close_on_exec */
147 --- linux-2.4.18-chaos/include/asm-arm/fcntl.h~ext3-extents-oflag-2.4.18-chaos  2003-07-28 17:52:07.000000000 +0400
148 +++ linux-2.4.18-chaos-alexey/include/asm-arm/fcntl.h   2003-10-08 10:29:30.000000000 +0400
149 @@ -21,6 +21,7 @@
150  #define O_DIRECT       0200000 /* direct disk access hint - currently ignored */
151  #define O_LARGEFILE    0400000
152  #define O_ATOMICLOOKUP 01000000
153 +#define O_EXTENTS      02000000 /* create file with extents if possible */
154  
155  #define F_DUPFD                0       /* dup */
156  #define F_GETFD                1       /* get close_on_exec */
157 --- linux-2.4.18-chaos/include/asm-cris/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2001-02-09 03:32:44.000000000 +0300
158 +++ linux-2.4.18-chaos-alexey/include/asm-cris/fcntl.h  2003-10-08 10:29:30.000000000 +0400
159 @@ -22,6 +22,7 @@
160  #define O_LARGEFILE    0100000
161  #define O_DIRECTORY    0200000 /* must be a directory */
162  #define O_NOFOLLOW     0400000 /* don't follow links */
163 +#define O_EXTENTS      01000000 /* create file with extents if possible */
164  
165  #define F_DUPFD                0       /* dup */
166  #define F_GETFD                1       /* get f_flags */
167 --- linux-2.4.18-chaos/include/asm-i386/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2003-07-28 17:52:09.000000000 +0400
168 +++ linux-2.4.18-chaos-alexey/include/asm-i386/fcntl.h  2003-10-08 10:29:30.000000000 +0400
169 @@ -21,6 +21,7 @@
170  #define O_DIRECTORY    0200000 /* must be a directory */
171  #define O_NOFOLLOW     0400000 /* don't follow links */
172  #define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */
173 +#define O_EXTENTS      02000000 /* create file with extents if possible */
174  
175  #define F_DUPFD                0       /* dup */
176  #define F_GETFD                1       /* get close_on_exec */
177 --- linux-2.4.18-chaos/include/asm-ia64/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2003-07-28 17:52:09.000000000 +0400
178 +++ linux-2.4.18-chaos-alexey/include/asm-ia64/fcntl.h  2003-10-08 10:29:30.000000000 +0400
179 @@ -29,6 +29,7 @@
180  #define O_DIRECTORY    0200000 /* must be a directory */
181  #define O_NOFOLLOW     0400000 /* don't follow links */
182  #define O_ATOMICLOOKUP  01000000 /* do atomic file lookup */
183 +#define O_EXTENTS      02000000 /* create file with extents if possible */
184  
185  #define F_DUPFD                0       /* dup */
186  #define F_GETFD                1       /* get close_on_exec */
187 --- linux-2.4.18-chaos/include/asm-m68k/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2000-11-28 05:00:49.000000000 +0300
188 +++ linux-2.4.18-chaos-alexey/include/asm-m68k/fcntl.h  2003-10-08 10:29:30.000000000 +0400
189 @@ -20,6 +20,7 @@
190  #define O_NOFOLLOW     0100000 /* don't follow links */
191  #define O_DIRECT       0200000 /* direct disk access hint - currently ignored */
192  #define O_LARGEFILE    0400000
193 +#define O_EXTENTS      01000000 /* create file with extents if possible */
194  
195  #define F_DUPFD                0       /* dup */
196  #define F_GETFD                1       /* get close_on_exec */
197 --- linux-2.4.18-chaos/include/asm-mips64/fcntl.h~ext3-extents-oflag-2.4.18-chaos       2003-07-28 17:52:15.000000000 +0400
198 +++ linux-2.4.18-chaos-alexey/include/asm-mips64/fcntl.h        2003-10-08 10:29:30.000000000 +0400
199 @@ -27,6 +27,7 @@
200  #define O_DIRECTORY    0x10000 /* must be a directory */
201  #define O_NOFOLLOW     0x20000 /* don't follow links */
202  #define O_ATOMICLOOKUP 0x40000
203 +#define O_EXTENTS      0x80000 /* create file with extents if possible */
204  
205  #define O_NDELAY       O_NONBLOCK
206  
207 --- linux-2.4.18-chaos/include/asm-mips/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2003-07-28 17:52:14.000000000 +0400
208 +++ linux-2.4.18-chaos-alexey/include/asm-mips/fcntl.h  2003-10-08 10:29:30.000000000 +0400
209 @@ -27,6 +27,7 @@
210  #define O_DIRECTORY    0x10000 /* must be a directory */
211  #define O_NOFOLLOW     0x20000 /* don't follow links */
212  #define O_ATOMICLOOKUP 0x40000
213 +#define O_EXTENTS      02000000 /* create file with extents if possible */
214  
215  #define O_NDELAY       O_NONBLOCK
216  
217 --- linux-2.4.18-chaos/include/asm-parisc/fcntl.h~ext3-extents-oflag-2.4.18-chaos       2000-12-05 23:29:39.000000000 +0300
218 +++ linux-2.4.18-chaos-alexey/include/asm-parisc/fcntl.h        2003-10-08 10:29:30.000000000 +0400
219 @@ -19,6 +19,7 @@
220  #define O_NOCTTY       00400000 /* not fcntl */
221  #define O_DSYNC                01000000 /* HPUX only */
222  #define O_RSYNC                02000000 /* HPUX only */
223 +#define O_EXTENTS      04000000 /* create file with extents if possible */
224  
225  #define FASYNC         00020000 /* fcntl, for BSD compatibility */
226  #define O_DIRECT       00040000 /* direct disk access hint - currently ignored */
227 --- linux-2.4.18-chaos/include/asm-ppc/fcntl.h~ext3-extents-oflag-2.4.18-chaos  2003-07-28 17:52:15.000000000 +0400
228 +++ linux-2.4.18-chaos-alexey/include/asm-ppc/fcntl.h   2003-10-08 10:29:30.000000000 +0400
229 @@ -24,6 +24,7 @@
230  #define O_LARGEFILE     0200000
231  #define O_DIRECT       0400000 /* direct disk access hint */
232  #define O_ATOMICLOOKUP 01000000        /* do atomic file lookup */
233 +#define O_EXTENT       02000000 /* create file with extents if possible */
234  
235  #define F_DUPFD                0       /* dup */
236  #define F_GETFD                1       /* get close_on_exec */
237 --- linux-2.4.18-chaos/include/asm-s390/fcntl.h~ext3-extents-oflag-2.4.18-chaos 2003-07-28 17:52:15.000000000 +0400
238 +++ linux-2.4.18-chaos-alexey/include/asm-s390/fcntl.h  2003-10-08 10:29:30.000000000 +0400
239 @@ -28,6 +28,7 @@
240  #define O_DIRECTORY    0200000 /* must be a directory */
241  #define O_NOFOLLOW     0400000 /* don't follow links */
242  #define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */
243 +#define O_EXTENTS      02000000 /* create file with extents if possible */
244  
245  #define F_DUPFD                0       /* dup */
246  #define F_GETFD                1       /* get close_on_exec */
247 --- linux-2.4.18-chaos/include/asm-s390x/fcntl.h~ext3-extents-oflag-2.4.18-chaos        2003-07-28 17:52:15.000000000 +0400
248 +++ linux-2.4.18-chaos-alexey/include/asm-s390x/fcntl.h 2003-10-08 10:29:30.000000000 +0400
249 @@ -28,6 +28,7 @@
250  #define O_DIRECTORY    0200000 /* must be a directory */
251  #define O_NOFOLLOW     0400000 /* don't follow links */
252  #define O_ATOMICLOOKUP 01000000        /* do atomic file lookup */
253 +#define O_EXTENTS      02000000 /* create file with extents if possible */
254  
255  #define F_DUPFD                0       /* dup */
256  #define F_GETFD                1       /* get close_on_exec */
257 --- linux-2.4.18-chaos/include/asm-sh/fcntl.h~ext3-extents-oflag-2.4.18-chaos   2003-07-28 17:52:15.000000000 +0400
258 +++ linux-2.4.18-chaos-alexey/include/asm-sh/fcntl.h    2003-10-08 10:29:30.000000000 +0400
259 @@ -21,6 +21,7 @@
260  #define O_DIRECTORY    0200000 /* must be a directory */
261  #define O_NOFOLLOW     0400000 /* don't follow links */
262  #define O_ATOMICLOOKUP  01000000
263 +#define O_EXTENTS      02000000 /* create file with extents if possible */
264  
265  #define F_DUPFD                0       /* dup */
266  #define F_GETFD                1       /* get close_on_exec */
267 --- linux-2.4.18-chaos/include/asm-sparc64/fcntl.h~ext3-extents-oflag-2.4.18-chaos      2003-07-28 17:52:16.000000000 +0400
268 +++ linux-2.4.18-chaos-alexey/include/asm-sparc64/fcntl.h       2003-10-08 10:29:30.000000000 +0400
269 @@ -22,6 +22,7 @@
270  #define O_LARGEFILE    0x40000
271  #define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */
272  #define O_DIRECT        0x100000 /* direct disk access hint */
273 +#define O_EXTENTS      0x200000 /* create file with extents if possible */
274  
275  
276  #define F_DUPFD                0       /* dup */
277 --- linux-2.4.18-chaos/include/asm-sparc/fcntl.h~ext3-extents-oflag-2.4.18-chaos        2003-07-28 17:52:16.000000000 +0400
278 +++ linux-2.4.18-chaos-alexey/include/asm-sparc/fcntl.h 2003-10-08 10:29:30.000000000 +0400
279 @@ -22,6 +22,7 @@
280  #define O_LARGEFILE    0x40000
281  #define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */
282  #define O_DIRECT        0x100000 /* direct disk access hint */
283 +#define O_EXTENTS      0x200000 /* create file with extents if possible */
284  
285  #define F_DUPFD                0       /* dup */
286  #define F_GETFD                1       /* get close_on_exec */
287 --- linux-2.4.18-chaos/include/linux/ext3_fs.h~ext3-extents-oflag-2.4.18-chaos  2003-10-08 10:29:12.000000000 +0400
288 +++ linux-2.4.18-chaos-alexey/include/linux/ext3_fs.h   2003-10-08 10:29:30.000000000 +0400
289 @@ -641,7 +641,7 @@ extern int ext3_sync_file (struct file *
290  
291  /* ialloc.c */
292  extern struct inode * ext3_new_inode (handle_t *, const struct inode *, int,
293 -                                     unsigned long);
294 +                                     unsigned long, struct lookup_intent *);
295  extern void ext3_free_inode (handle_t *, struct inode *);
296  extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
297  extern unsigned long ext3_count_free_inodes (struct super_block *);
298 --- linux-2.4.18-chaos/fs/ext3/inode.c~ext3-extents-oflag-2.4.18-chaos  2003-10-08 10:29:12.000000000 +0400
299 +++ linux-2.4.18-chaos-alexey/fs/ext3/inode.c   2003-10-08 10:29:30.000000000 +0400
300 @@ -2204,7 +2204,7 @@ void ext3_truncate_thread(struct inode *
301         if (IS_ERR(handle))
302                 goto out_truncate;
303  
304 -       new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode, 0);
305 +       new_inode = ext3_new_inode(handle, old_inode, old_inode->i_mode, 0, 0);
306         if (IS_ERR(new_inode)) {
307                 ext3_debug("truncate inode %lu directly (no new inodes)\n",
308                            old_inode->i_ino);
309
310 _