diff options
author | Joel Becker <joel.becker@oracle.com> | 2010-04-30 16:37:29 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-04-30 16:37:29 -0400 |
commit | f9221fd80343285514568da6c5dbda0f87109de8 (patch) | |
tree | 3a2f0077ebea9d094bdeedb319c97cb591d51c51 /fs | |
parent | a36d515c7a2dfacebcf41729f6812dbc424ebcf0 (diff) | |
parent | a9743fcdc0eb43d028b71267438076e1b0112ba0 (diff) |
Merge branch 'skip_delete_inode' of git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2-mark into ocfs2-fixes
Diffstat (limited to 'fs')
387 files changed, 1370 insertions, 905 deletions
diff --git a/fs/9p/cache.c b/fs/9p/cache.c index e777961939f3..0dbe0d139ac2 100644 --- a/fs/9p/cache.c +++ b/fs/9p/cache.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/jiffies.h> | 23 | #include <linux/jiffies.h> |
24 | #include <linux/file.h> | 24 | #include <linux/file.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/stat.h> | 26 | #include <linux/stat.h> |
26 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
27 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index 08b2eb157048..7317b39b2815 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
28 | #include <linux/idr.h> | 29 | #include <linux/idr.h> |
29 | #include <net/9p/9p.h> | 30 | #include <net/9p/9p.h> |
@@ -110,7 +111,7 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
110 | { | 111 | { |
111 | int i, n, l, clone, any, access; | 112 | int i, n, l, clone, any, access; |
112 | u32 uid; | 113 | u32 uid; |
113 | struct p9_fid *fid; | 114 | struct p9_fid *fid, *old_fid = NULL; |
114 | struct dentry *d, *ds; | 115 | struct dentry *d, *ds; |
115 | struct v9fs_session_info *v9ses; | 116 | struct v9fs_session_info *v9ses; |
116 | char **wnames, *uname; | 117 | char **wnames, *uname; |
@@ -183,10 +184,18 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry) | |||
183 | l = min(n - i, P9_MAXWELEM); | 184 | l = min(n - i, P9_MAXWELEM); |
184 | fid = p9_client_walk(fid, l, &wnames[i], clone); | 185 | fid = p9_client_walk(fid, l, &wnames[i], clone); |
185 | if (IS_ERR(fid)) { | 186 | if (IS_ERR(fid)) { |
187 | if (old_fid) { | ||
188 | /* | ||
189 | * If we fail, clunk fid which are mapping | ||
190 | * to path component and not the last component | ||
191 | * of the path. | ||
192 | */ | ||
193 | p9_client_clunk(old_fid); | ||
194 | } | ||
186 | kfree(wnames); | 195 | kfree(wnames); |
187 | return fid; | 196 | return fid; |
188 | } | 197 | } |
189 | 198 | old_fid = fid; | |
190 | i += l; | 199 | i += l; |
191 | clone = 0; | 200 | clone = 0; |
192 | } | 201 | } |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 6c7f6a251115..5c5bc8480070 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/parser.h> | 30 | #include <linux/parser.h> |
31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
32 | #include <linux/slab.h> | ||
32 | #include <net/9p/9p.h> | 33 | #include <net/9p/9p.h> |
33 | #include <net/9p/client.h> | 34 | #include <net/9p/client.h> |
34 | #include <net/9p/transport.h> | 35 | #include <net/9p/transport.h> |
@@ -241,7 +242,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
241 | list_add(&v9ses->slist, &v9fs_sessionlist); | 242 | list_add(&v9ses->slist, &v9fs_sessionlist); |
242 | spin_unlock(&v9fs_sessionlist_lock); | 243 | spin_unlock(&v9fs_sessionlist_lock); |
243 | 244 | ||
244 | v9ses->flags = V9FS_PROTO_2000U | V9FS_ACCESS_USER; | 245 | v9ses->flags = V9FS_ACCESS_USER; |
245 | strcpy(v9ses->uname, V9FS_DEFUSER); | 246 | strcpy(v9ses->uname, V9FS_DEFUSER); |
246 | strcpy(v9ses->aname, V9FS_DEFANAME); | 247 | strcpy(v9ses->aname, V9FS_DEFANAME); |
247 | v9ses->uid = ~0; | 248 | v9ses->uid = ~0; |
@@ -262,8 +263,10 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses, | |||
262 | goto error; | 263 | goto error; |
263 | } | 264 | } |
264 | 265 | ||
265 | if (!p9_is_proto_dotu(v9ses->clnt)) | 266 | if (p9_is_proto_dotl(v9ses->clnt)) |
266 | v9ses->flags &= ~V9FS_PROTO_2000U; | 267 | v9ses->flags |= V9FS_PROTO_2000L; |
268 | else if (p9_is_proto_dotu(v9ses->clnt)) | ||
269 | v9ses->flags |= V9FS_PROTO_2000U; | ||
267 | 270 | ||
268 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; | 271 | v9ses->maxdata = v9ses->clnt->msize - P9_IOHDRSZ; |
269 | 272 | ||
@@ -340,6 +343,19 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) { | |||
340 | p9_client_disconnect(v9ses->clnt); | 343 | p9_client_disconnect(v9ses->clnt); |
341 | } | 344 | } |
342 | 345 | ||
346 | /** | ||
347 | * v9fs_session_begin_cancel - Begin terminate of a session | ||
348 | * @v9ses: session to terminate | ||
349 | * | ||
350 | * After this call we don't allow any request other than clunk. | ||
351 | */ | ||
352 | |||
353 | void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses) | ||
354 | { | ||
355 | P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses); | ||
356 | p9_client_begin_disconnect(v9ses->clnt); | ||
357 | } | ||
358 | |||
343 | extern int v9fs_error_init(void); | 359 | extern int v9fs_error_init(void); |
344 | 360 | ||
345 | static struct kobject *v9fs_kobj; | 361 | static struct kobject *v9fs_kobj; |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 6b801d1ddf4b..a0a8d3dd1361 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -108,6 +108,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, | |||
108 | char *); | 108 | char *); |
109 | void v9fs_session_close(struct v9fs_session_info *v9ses); | 109 | void v9fs_session_close(struct v9fs_session_info *v9ses); |
110 | void v9fs_session_cancel(struct v9fs_session_info *v9ses); | 110 | void v9fs_session_cancel(struct v9fs_session_info *v9ses); |
111 | void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses); | ||
111 | 112 | ||
112 | #define V9FS_MAGIC 0x01021997 | 113 | #define V9FS_MAGIC 0x01021997 |
113 | 114 | ||
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index d74325295b1e..cbf4e50f3933 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/namei.h> | 34 | #include <linux/namei.h> |
35 | #include <linux/idr.h> | 35 | #include <linux/idr.h> |
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/slab.h> | ||
37 | #include <net/9p/9p.h> | 38 | #include <net/9p/9p.h> |
38 | #include <net/9p/client.h> | 39 | #include <net/9p/client.h> |
39 | 40 | ||
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index d8a3afe4ff72..0adfd64dfcee 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/inet.h> | 33 | #include <linux/inet.h> |
34 | #include <linux/idr.h> | 34 | #include <linux/idr.h> |
35 | #include <linux/slab.h> | ||
35 | #include <net/9p/9p.h> | 36 | #include <net/9p/9p.h> |
36 | #include <net/9p/client.h> | 37 | #include <net/9p/client.h> |
37 | 38 | ||
@@ -130,6 +131,8 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
130 | rdir = (struct p9_rdir *) fid->rdir; | 131 | rdir = (struct p9_rdir *) fid->rdir; |
131 | 132 | ||
132 | err = mutex_lock_interruptible(&rdir->mutex); | 133 | err = mutex_lock_interruptible(&rdir->mutex); |
134 | if (err) | ||
135 | return err; | ||
133 | while (err == 0) { | 136 | while (err == 0) { |
134 | if (rdir->tail == rdir->head) { | 137 | if (rdir->tail == rdir->head) { |
135 | err = v9fs_file_readn(filp, rdir->buf, NULL, | 138 | err = v9fs_file_readn(filp, rdir->buf, NULL, |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 5fe45d692c9f..f2434fc9d2c4 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/namei.h> | 34 | #include <linux/namei.h> |
35 | #include <linux/idr.h> | 35 | #include <linux/idr.h> |
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/slab.h> | ||
37 | #include <net/9p/9p.h> | 38 | #include <net/9p/9p.h> |
38 | #include <net/9p/client.h> | 39 | #include <net/9p/client.h> |
39 | 40 | ||
@@ -431,6 +432,7 @@ error: | |||
431 | 432 | ||
432 | static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) | 433 | static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) |
433 | { | 434 | { |
435 | int retval; | ||
434 | struct inode *file_inode; | 436 | struct inode *file_inode; |
435 | struct v9fs_session_info *v9ses; | 437 | struct v9fs_session_info *v9ses; |
436 | struct p9_fid *v9fid; | 438 | struct p9_fid *v9fid; |
@@ -444,7 +446,10 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) | |||
444 | if (IS_ERR(v9fid)) | 446 | if (IS_ERR(v9fid)) |
445 | return PTR_ERR(v9fid); | 447 | return PTR_ERR(v9fid); |
446 | 448 | ||
447 | return p9_client_remove(v9fid); | 449 | retval = p9_client_remove(v9fid); |
450 | if (!retval) | ||
451 | drop_nlink(file_inode); | ||
452 | return retval; | ||
448 | } | 453 | } |
449 | 454 | ||
450 | static int | 455 | static int |
@@ -656,6 +661,9 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
656 | P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n", | 661 | P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n", |
657 | dir, dentry->d_name.name, dentry, nameidata); | 662 | dir, dentry->d_name.name, dentry, nameidata); |
658 | 663 | ||
664 | if (dentry->d_name.len > NAME_MAX) | ||
665 | return ERR_PTR(-ENAMETOOLONG); | ||
666 | |||
659 | sb = dir->i_sb; | 667 | sb = dir->i_sb; |
660 | v9ses = v9fs_inode2v9ses(dir); | 668 | v9ses = v9fs_inode2v9ses(dir); |
661 | dfid = v9fs_fid_lookup(dentry->d_parent); | 669 | dfid = v9fs_fid_lookup(dentry->d_parent); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 69357c0d9899..491108bd6e0d 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/mount.h> | 37 | #include <linux/mount.h> |
38 | #include <linux/idr.h> | 38 | #include <linux/idr.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/slab.h> | ||
40 | #include <net/9p/9p.h> | 41 | #include <net/9p/9p.h> |
41 | #include <net/9p/client.h> | 42 | #include <net/9p/client.h> |
42 | 43 | ||
@@ -193,6 +194,7 @@ static void v9fs_kill_super(struct super_block *s) | |||
193 | 194 | ||
194 | kill_anon_super(s); | 195 | kill_anon_super(s); |
195 | 196 | ||
197 | v9fs_session_cancel(v9ses); | ||
196 | v9fs_session_close(v9ses); | 198 | v9fs_session_close(v9ses); |
197 | kfree(v9ses); | 199 | kfree(v9ses); |
198 | s->s_fs_info = NULL; | 200 | s->s_fs_info = NULL; |
@@ -205,7 +207,7 @@ v9fs_umount_begin(struct super_block *sb) | |||
205 | struct v9fs_session_info *v9ses; | 207 | struct v9fs_session_info *v9ses; |
206 | 208 | ||
207 | v9ses = sb->s_fs_info; | 209 | v9ses = sb->s_fs_info; |
208 | v9fs_session_cancel(v9ses); | 210 | v9fs_session_begin_cancel(v9ses); |
209 | } | 211 | } |
210 | 212 | ||
211 | static const struct super_operations v9fs_super_ops = { | 213 | static const struct super_operations v9fs_super_ops = { |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 6910a98bd73c..4a3af7075c1d 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/parser.h> | 13 | #include <linux/parser.h> |
14 | #include <linux/mount.h> | 14 | #include <linux/mount.h> |
15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/smp_lock.h> | 17 | #include <linux/smp_lock.h> |
17 | #include <linux/statfs.h> | 18 | #include <linux/statfs.h> |
18 | #include "adfs.h" | 19 | #include "adfs.h" |
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c index 8306d53307ed..3e262711ae06 100644 --- a/fs/affs/bitmap.c +++ b/fs/affs/bitmap.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * block allocation, deallocation, calculation of free space. | 7 | * block allocation, deallocation, calculation of free space. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
10 | #include "affs.h" | 11 | #include "affs.h" |
11 | 12 | ||
12 | /* This is, of course, shamelessly stolen from fs/minix */ | 13 | /* This is, of course, shamelessly stolen from fs/minix */ |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index c9744d771d98..f4b2a4ee4f91 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * (C) 1991 Linus Torvalds - minix filesystem | 10 | * (C) 1991 Linus Torvalds - minix filesystem |
11 | */ | 11 | */ |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/gfp.h> | ||
13 | #include "affs.h" | 14 | #include "affs.h" |
14 | 15 | ||
15 | extern const struct inode_operations affs_symlink_inode_operations; | 16 | extern const struct inode_operations affs_symlink_inode_operations; |
diff --git a/fs/affs/super.c b/fs/affs/super.c index d41e9673cd97..16a3e4765f68 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/magic.h> | 17 | #include <linux/magic.h> |
18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/slab.h> | ||
20 | #include "affs.h" | 21 | #include "affs.h" |
21 | 22 | ||
22 | extern struct timezone sys_tz; | 23 | extern struct timezone sys_tz; |
diff --git a/fs/afs/cache.c b/fs/afs/cache.c index e2b1d3f16519..0fb315dd4d2a 100644 --- a/fs/afs/cache.c +++ b/fs/afs/cache.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
14 | #include "internal.h" | 13 | #include "internal.h" |
15 | 14 | ||
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index eb765489164f..a3bcec75c54a 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
15 | #include <linux/ip.h> | 16 | #include <linux/ip.h> |
16 | #include "internal.h" | 17 | #include "internal.h" |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 88067f36e5e7..adc1cb771b57 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
17 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
18 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
diff --git a/fs/afs/file.c b/fs/afs/file.c index 39b301662f22..0df9bc2b724d 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -12,10 +12,10 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
17 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
18 | #include <linux/writeback.h> | 17 | #include <linux/writeback.h> |
18 | #include <linux/gfp.h> | ||
19 | #include "internal.h" | 19 | #include "internal.h" |
20 | 20 | ||
21 | static int afs_readpage(struct file *file, struct page *page); | 21 | static int afs_readpage(struct file *file, struct page *page); |
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c index 023b95b0d9d7..4bd0218473a9 100644 --- a/fs/afs/fsclient.c +++ b/fs/afs/fsclient.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/circ_buf.h> | 15 | #include <linux/circ_buf.h> |
15 | #include "internal.h" | 16 | #include "internal.h" |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index c048f0658751..d00b312e3110 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/slab.h> | ||
20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
21 | #include <linux/pagemap.h> | 20 | #include <linux/pagemap.h> |
22 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 5ffb570cd3a8..b3feddc4f7d6 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -12,11 +12,11 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
17 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
18 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
19 | #include <linux/namei.h> | 18 | #include <linux/namei.h> |
19 | #include <linux/gfp.h> | ||
20 | #include "internal.h" | 20 | #include "internal.h" |
21 | 21 | ||
22 | 22 | ||
@@ -138,9 +138,9 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
138 | { | 138 | { |
139 | struct afs_super_info *super; | 139 | struct afs_super_info *super; |
140 | struct vfsmount *mnt; | 140 | struct vfsmount *mnt; |
141 | struct page *page = NULL; | 141 | struct page *page; |
142 | size_t size; | 142 | size_t size; |
143 | char *buf, *devname = NULL, *options = NULL; | 143 | char *buf, *devname, *options; |
144 | int ret; | 144 | int ret; |
145 | 145 | ||
146 | _enter("{%s}", mntpt->d_name.name); | 146 | _enter("{%s}", mntpt->d_name.name); |
@@ -150,22 +150,22 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
150 | ret = -EINVAL; | 150 | ret = -EINVAL; |
151 | size = mntpt->d_inode->i_size; | 151 | size = mntpt->d_inode->i_size; |
152 | if (size > PAGE_SIZE - 1) | 152 | if (size > PAGE_SIZE - 1) |
153 | goto error; | 153 | goto error_no_devname; |
154 | 154 | ||
155 | ret = -ENOMEM; | 155 | ret = -ENOMEM; |
156 | devname = (char *) get_zeroed_page(GFP_KERNEL); | 156 | devname = (char *) get_zeroed_page(GFP_KERNEL); |
157 | if (!devname) | 157 | if (!devname) |
158 | goto error; | 158 | goto error_no_devname; |
159 | 159 | ||
160 | options = (char *) get_zeroed_page(GFP_KERNEL); | 160 | options = (char *) get_zeroed_page(GFP_KERNEL); |
161 | if (!options) | 161 | if (!options) |
162 | goto error; | 162 | goto error_no_options; |
163 | 163 | ||
164 | /* read the contents of the AFS special symlink */ | 164 | /* read the contents of the AFS special symlink */ |
165 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); | 165 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); |
166 | if (IS_ERR(page)) { | 166 | if (IS_ERR(page)) { |
167 | ret = PTR_ERR(page); | 167 | ret = PTR_ERR(page); |
168 | goto error; | 168 | goto error_no_page; |
169 | } | 169 | } |
170 | 170 | ||
171 | ret = -EIO; | 171 | ret = -EIO; |
@@ -196,12 +196,12 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
196 | return mnt; | 196 | return mnt; |
197 | 197 | ||
198 | error: | 198 | error: |
199 | if (page) | 199 | page_cache_release(page); |
200 | page_cache_release(page); | 200 | error_no_page: |
201 | if (devname) | 201 | free_page((unsigned long) options); |
202 | free_page((unsigned long) devname); | 202 | error_no_options: |
203 | if (options) | 203 | free_page((unsigned long) devname); |
204 | free_page((unsigned long) options); | 204 | error_no_devname: |
205 | _leave(" = %d", ret); | 205 | _leave(" = %d", ret); |
206 | return ERR_PTR(ret); | 206 | return ERR_PTR(ret); |
207 | } | 207 | } |
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index bde3f19c0995..67cf810e0fd6 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/slab.h> | ||
12 | #include <net/sock.h> | 13 | #include <net/sock.h> |
13 | #include <net/af_rxrpc.h> | 14 | #include <net/af_rxrpc.h> |
14 | #include <rxrpc/packet.h> | 15 | #include <rxrpc/packet.h> |
diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c index 36c1306e09e0..340afd0cd182 100644 --- a/fs/afs/vlclient.c +++ b/fs/afs/vlclient.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/gfp.h> | ||
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include "internal.h" | 15 | #include "internal.h" |
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c index 6e689208def2..9ac260d1361d 100644 --- a/fs/afs/vlocation.c +++ b/fs/afs/vlocation.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/init.h> | 15 | #include <linux/init.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
16 | #include "internal.h" | 17 | #include "internal.h" |
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c index 2f05c4fc2a70..25cf4c3f4ff7 100644 --- a/fs/afs/vnode.c +++ b/fs/afs/vnode.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
17 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
18 | #include "internal.h" | 17 | #include "internal.h" |
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 2de009565d8e..e4b75d6eda83 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/file.h> | 12 | #include <linux/file.h> |
13 | #include <linux/poll.h> | 13 | #include <linux/poll.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 4a1401cea0a1..8713c7cfbc79 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/capability.h> | 13 | #include <linux/capability.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/stat.h> | 15 | #include <linux/stat.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/param.h> | 17 | #include <linux/param.h> |
17 | #include <linux/time.h> | 18 | #include <linux/time.h> |
18 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index c8a80dffb455..d29b7f6df862 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/magic.h> | 22 | #include <linux/magic.h> |
23 | #include <linux/dcache.h> | 23 | #include <linux/dcache.h> |
24 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "autofs_i.h" | 27 | #include "autofs_i.h" |
27 | 28 | ||
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index a015b49891df..109a6c606d92 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/capability.h> | 15 | #include <linux/capability.h> |
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/stat.h> | 17 | #include <linux/stat.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/param.h> | 19 | #include <linux/param.h> |
19 | #include <linux/time.h> | 20 | #include <linux/time.h> |
20 | #include "autofs_i.h" | 21 | #include "autofs_i.h" |
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index e3287d0d1a58..59096b5e0fc7 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/slab.h> | ||
15 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
16 | #include <linux/string.h> | 15 | #include <linux/string.h> |
17 | 16 | ||
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 9b6aef0f75e5..f96eff04e11a 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -20,11 +20,11 @@ | |||
20 | #include <linux/fcntl.h> | 20 | #include <linux/fcntl.h> |
21 | #include <linux/ptrace.h> | 21 | #include <linux/ptrace.h> |
22 | #include <linux/user.h> | 22 | #include <linux/user.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/binfmts.h> | 23 | #include <linux/binfmts.h> |
25 | #include <linux/personality.h> | 24 | #include <linux/personality.h> |
26 | #include <linux/init.h> | 25 | #include <linux/init.h> |
27 | #include <linux/coredump.h> | 26 | #include <linux/coredump.h> |
27 | #include <linux/slab.h> | ||
28 | 28 | ||
29 | #include <asm/system.h> | 29 | #include <asm/system.h> |
30 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c index 32fb00b52cd0..b8e8b0acf9bd 100644 --- a/fs/binfmt_em86.c +++ b/fs/binfmt_em86.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/stat.h> | 13 | #include <linux/stat.h> |
14 | #include <linux/slab.h> | ||
15 | #include <linux/binfmts.h> | 14 | #include <linux/binfmts.h> |
16 | #include <linux/elf.h> | 15 | #include <linux/elf.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index e0e769bdca59..49566c1687d8 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -355,7 +355,7 @@ calc_reloc(unsigned long r, struct lib_info *p, int curid, int internalp) | |||
355 | 355 | ||
356 | if (!flat_reloc_valid(r, start_brk - start_data + text_len)) { | 356 | if (!flat_reloc_valid(r, start_brk - start_data + text_len)) { |
357 | printk("BINFMT_FLAT: reloc outside program 0x%x (0 - 0x%x/0x%x)", | 357 | printk("BINFMT_FLAT: reloc outside program 0x%x (0 - 0x%x/0x%x)", |
358 | (int) r,(int)(start_brk-start_code),(int)text_len); | 358 | (int) r,(int)(start_brk-start_data+text_len),(int)text_len); |
359 | goto failed; | 359 | goto failed; |
360 | } | 360 | } |
361 | 361 | ||
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index 08343505e184..aca9d55afb22 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
10 | #include <linux/stat.h> | 10 | #include <linux/stat.h> |
11 | #include <linux/slab.h> | ||
12 | #include <linux/binfmts.h> | 11 | #include <linux/binfmts.h> |
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
14 | #include <linux/file.h> | 13 | #include <linux/file.h> |
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index a16f29e888cd..612a5c38d3c1 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/mempool.h> | 24 | #include <linux/mempool.h> |
25 | #include <linux/bio.h> | 25 | #include <linux/bio.h> |
26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
27 | #include <linux/slab.h> | ||
27 | 28 | ||
28 | struct integrity_slab { | 29 | struct integrity_slab { |
29 | struct kmem_cache *slab; | 30 | struct kmem_cache *slab; |
@@ -554,7 +554,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
554 | .bi_rw = bio->bi_rw, | 554 | .bi_rw = bio->bi_rw, |
555 | }; | 555 | }; |
556 | 556 | ||
557 | if (q->merge_bvec_fn(q, &bvm, prev) < len) { | 557 | if (q->merge_bvec_fn(q, &bvm, prev) < prev->bv_len) { |
558 | prev->bv_len -= len; | 558 | prev->bv_len -= len; |
559 | return 0; | 559 | return 0; |
560 | } | 560 | } |
@@ -607,7 +607,7 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
607 | * merge_bvec_fn() returns number of bytes it can accept | 607 | * merge_bvec_fn() returns number of bytes it can accept |
608 | * at this offset | 608 | * at this offset |
609 | */ | 609 | */ |
610 | if (q->merge_bvec_fn(q, &bvm, bvec) < len) { | 610 | if (q->merge_bvec_fn(q, &bvm, bvec) < bvec->bv_len) { |
611 | bvec->bv_page = NULL; | 611 | bvec->bv_page = NULL; |
612 | bvec->bv_len = 0; | 612 | bvec->bv_len = 0; |
613 | bvec->bv_offset = 0; | 613 | bvec->bv_offset = 0; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index d11d0289f3d2..2a6d0193f139 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -404,7 +404,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) | |||
404 | * NULL first argument is nfsd_sync_dir() and that's not a directory. | 404 | * NULL first argument is nfsd_sync_dir() and that's not a directory. |
405 | */ | 405 | */ |
406 | 406 | ||
407 | static int block_fsync(struct file *filp, struct dentry *dentry, int datasync) | 407 | int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync) |
408 | { | 408 | { |
409 | struct block_device *bdev = I_BDEV(filp->f_mapping->host); | 409 | struct block_device *bdev = I_BDEV(filp->f_mapping->host); |
410 | int error; | 410 | int error; |
@@ -418,6 +418,7 @@ static int block_fsync(struct file *filp, struct dentry *dentry, int datasync) | |||
418 | error = 0; | 418 | error = 0; |
419 | return error; | 419 | return error; |
420 | } | 420 | } |
421 | EXPORT_SYMBOL(blkdev_fsync); | ||
421 | 422 | ||
422 | /* | 423 | /* |
423 | * pseudo-fs | 424 | * pseudo-fs |
@@ -1481,7 +1482,7 @@ const struct file_operations def_blk_fops = { | |||
1481 | .aio_read = generic_file_aio_read, | 1482 | .aio_read = generic_file_aio_read, |
1482 | .aio_write = blkdev_aio_write, | 1483 | .aio_write = blkdev_aio_write, |
1483 | .mmap = generic_file_mmap, | 1484 | .mmap = generic_file_mmap, |
1484 | .fsync = block_fsync, | 1485 | .fsync = blkdev_fsync, |
1485 | .unlocked_ioctl = block_ioctl, | 1486 | .unlocked_ioctl = block_ioctl, |
1486 | #ifdef CONFIG_COMPAT | 1487 | #ifdef CONFIG_COMPAT |
1487 | .compat_ioctl = compat_blkdev_ioctl, | 1488 | .compat_ioctl = compat_blkdev_ioctl, |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 6df6d6ed74fd..6ef7b26724ec 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/posix_acl_xattr.h> | 22 | #include <linux/posix_acl_xattr.h> |
23 | #include <linux/posix_acl.h> | 23 | #include <linux/posix_acl.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/slab.h> | ||
25 | 26 | ||
26 | #include "ctree.h" | 27 | #include "ctree.h" |
27 | #include "btrfs_inode.h" | 28 | #include "btrfs_inode.h" |
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index c0861e781cdb..462859a30141 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/kthread.h> | 19 | #include <linux/kthread.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/list.h> | 21 | #include <linux/list.h> |
21 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
22 | #include <linux/freezer.h> | 23 | #include <linux/freezer.h> |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 28b92a7218ab..396039b3a8a2 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/swap.h> | 31 | #include <linux/swap.h> |
32 | #include <linux/writeback.h> | 32 | #include <linux/writeback.h> |
33 | #include <linux/bit_spinlock.h> | 33 | #include <linux/bit_spinlock.h> |
34 | #include <linux/pagevec.h> | 34 | #include <linux/slab.h> |
35 | #include "compat.h" | 35 | #include "compat.h" |
36 | #include "ctree.h" | 36 | #include "ctree.h" |
37 | #include "disk-io.h" | 37 | #include "disk-io.h" |
@@ -445,7 +445,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
445 | unsigned long nr_pages = 0; | 445 | unsigned long nr_pages = 0; |
446 | struct extent_map *em; | 446 | struct extent_map *em; |
447 | struct address_space *mapping = inode->i_mapping; | 447 | struct address_space *mapping = inode->i_mapping; |
448 | struct pagevec pvec; | ||
449 | struct extent_map_tree *em_tree; | 448 | struct extent_map_tree *em_tree; |
450 | struct extent_io_tree *tree; | 449 | struct extent_io_tree *tree; |
451 | u64 end; | 450 | u64 end; |
@@ -461,7 +460,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
461 | 460 | ||
462 | end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; | 461 | end_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; |
463 | 462 | ||
464 | pagevec_init(&pvec, 0); | ||
465 | while (last_offset < compressed_end) { | 463 | while (last_offset < compressed_end) { |
466 | page_index = last_offset >> PAGE_CACHE_SHIFT; | 464 | page_index = last_offset >> PAGE_CACHE_SHIFT; |
467 | 465 | ||
@@ -478,26 +476,17 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
478 | goto next; | 476 | goto next; |
479 | } | 477 | } |
480 | 478 | ||
481 | page = alloc_page(mapping_gfp_mask(mapping) & ~__GFP_FS); | 479 | page = __page_cache_alloc(mapping_gfp_mask(mapping) & |
480 | ~__GFP_FS); | ||
482 | if (!page) | 481 | if (!page) |
483 | break; | 482 | break; |
484 | 483 | ||
485 | page->index = page_index; | 484 | if (add_to_page_cache_lru(page, mapping, page_index, |
486 | /* | 485 | GFP_NOFS)) { |
487 | * what we want to do here is call add_to_page_cache_lru, | ||
488 | * but that isn't exported, so we reproduce it here | ||
489 | */ | ||
490 | if (add_to_page_cache(page, mapping, | ||
491 | page->index, GFP_NOFS)) { | ||
492 | page_cache_release(page); | 486 | page_cache_release(page); |
493 | goto next; | 487 | goto next; |
494 | } | 488 | } |
495 | 489 | ||
496 | /* open coding of lru_cache_add, also not exported */ | ||
497 | page_cache_get(page); | ||
498 | if (!pagevec_add(&pvec, page)) | ||
499 | __pagevec_lru_add_file(&pvec); | ||
500 | |||
501 | end = last_offset + PAGE_CACHE_SIZE - 1; | 490 | end = last_offset + PAGE_CACHE_SIZE - 1; |
502 | /* | 491 | /* |
503 | * at this point, we have a locked page in the page cache | 492 | * at this point, we have a locked page in the page cache |
@@ -551,8 +540,6 @@ static noinline int add_ra_bio_pages(struct inode *inode, | |||
551 | next: | 540 | next: |
552 | last_offset += PAGE_CACHE_SIZE; | 541 | last_offset += PAGE_CACHE_SIZE; |
553 | } | 542 | } |
554 | if (pagevec_count(&pvec)) | ||
555 | __pagevec_lru_add_file(&pvec); | ||
556 | return 0; | 543 | return 0; |
557 | } | 544 | } |
558 | 545 | ||
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index c4bc570a396e..6795a713b205 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/slab.h> | ||
20 | #include "ctree.h" | 21 | #include "ctree.h" |
21 | #include "disk-io.h" | 22 | #include "disk-io.h" |
22 | #include "transaction.h" | 23 | #include "transaction.h" |
@@ -3040,6 +3041,10 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, | |||
3040 | if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0])) | 3041 | if (ret > 0 || item_size != btrfs_item_size_nr(leaf, path->slots[0])) |
3041 | goto err; | 3042 | goto err; |
3042 | 3043 | ||
3044 | /* the leaf has changed, it now has room. return now */ | ||
3045 | if (btrfs_leaf_free_space(root, path->nodes[0]) >= ins_len) | ||
3046 | goto err; | ||
3047 | |||
3043 | if (key.type == BTRFS_EXTENT_DATA_KEY) { | 3048 | if (key.type == BTRFS_EXTENT_DATA_KEY) { |
3044 | fi = btrfs_item_ptr(leaf, path->slots[0], | 3049 | fi = btrfs_item_ptr(leaf, path->slots[0], |
3045 | struct btrfs_file_extent_item); | 3050 | struct btrfs_file_extent_item); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0af2e3868573..746a7248678e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
29 | #include <linux/slab.h> | ||
29 | #include <asm/kmap_types.h> | 30 | #include <asm/kmap_types.h> |
30 | #include "extent_io.h" | 31 | #include "extent_io.h" |
31 | #include "extent_map.h" | 32 | #include "extent_map.h" |
@@ -834,7 +835,6 @@ struct btrfs_fs_info { | |||
834 | u64 last_trans_log_full_commit; | 835 | u64 last_trans_log_full_commit; |
835 | u64 open_ioctl_trans; | 836 | u64 open_ioctl_trans; |
836 | unsigned long mount_opt; | 837 | unsigned long mount_opt; |
837 | u64 max_extent; | ||
838 | u64 max_inline; | 838 | u64 max_inline; |
839 | u64 alloc_start; | 839 | u64 alloc_start; |
840 | struct btrfs_transaction *running_transaction; | 840 | struct btrfs_transaction *running_transaction; |
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 84e6781413b1..902ce507c4e3 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/sort.h> | 21 | #include <linux/sort.h> |
21 | #include "ctree.h" | 22 | #include "ctree.h" |
22 | #include "delayed-ref.h" | 23 | #include "delayed-ref.h" |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 11d0ad30e203..e7b8f2c89ccb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kthread.h> | 27 | #include <linux/kthread.h> |
28 | #include <linux/freezer.h> | 28 | #include <linux/freezer.h> |
29 | #include <linux/crc32c.h> | 29 | #include <linux/crc32c.h> |
30 | #include <linux/slab.h> | ||
30 | #include "compat.h" | 31 | #include "compat.h" |
31 | #include "ctree.h" | 32 | #include "ctree.h" |
32 | #include "disk-io.h" | 33 | #include "disk-io.h" |
@@ -1634,7 +1635,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1634 | atomic_set(&fs_info->async_submit_draining, 0); | 1635 | atomic_set(&fs_info->async_submit_draining, 0); |
1635 | atomic_set(&fs_info->nr_async_bios, 0); | 1636 | atomic_set(&fs_info->nr_async_bios, 0); |
1636 | fs_info->sb = sb; | 1637 | fs_info->sb = sb; |
1637 | fs_info->max_extent = (u64)-1; | ||
1638 | fs_info->max_inline = 8192 * 1024; | 1638 | fs_info->max_inline = 8192 * 1024; |
1639 | fs_info->metadata_ratio = 0; | 1639 | fs_info->metadata_ratio = 0; |
1640 | 1640 | ||
@@ -1922,7 +1922,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1922 | 1922 | ||
1923 | csum_root->track_dirty = 1; | 1923 | csum_root->track_dirty = 1; |
1924 | 1924 | ||
1925 | btrfs_read_block_groups(extent_root); | 1925 | ret = btrfs_read_block_groups(extent_root); |
1926 | if (ret) { | ||
1927 | printk(KERN_ERR "Failed to read block groups: %d\n", ret); | ||
1928 | goto fail_block_groups; | ||
1929 | } | ||
1926 | 1930 | ||
1927 | fs_info->generation = generation; | 1931 | fs_info->generation = generation; |
1928 | fs_info->last_trans_committed = generation; | 1932 | fs_info->last_trans_committed = generation; |
@@ -1932,7 +1936,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1932 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 1936 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
1933 | "btrfs-cleaner"); | 1937 | "btrfs-cleaner"); |
1934 | if (IS_ERR(fs_info->cleaner_kthread)) | 1938 | if (IS_ERR(fs_info->cleaner_kthread)) |
1935 | goto fail_csum_root; | 1939 | goto fail_block_groups; |
1936 | 1940 | ||
1937 | fs_info->transaction_kthread = kthread_run(transaction_kthread, | 1941 | fs_info->transaction_kthread = kthread_run(transaction_kthread, |
1938 | tree_root, | 1942 | tree_root, |
@@ -2020,7 +2024,8 @@ fail_cleaner: | |||
2020 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); | 2024 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); |
2021 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 2025 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
2022 | 2026 | ||
2023 | fail_csum_root: | 2027 | fail_block_groups: |
2028 | btrfs_free_block_groups(fs_info); | ||
2024 | free_extent_buffer(csum_root->node); | 2029 | free_extent_buffer(csum_root->node); |
2025 | free_extent_buffer(csum_root->commit_root); | 2030 | free_extent_buffer(csum_root->commit_root); |
2026 | fail_dev_root: | 2031 | fail_dev_root: |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1727b26fb194..b34d32fdaaec 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/sort.h> | 22 | #include <linux/sort.h> |
23 | #include <linux/rcupdate.h> | 23 | #include <linux/rcupdate.h> |
24 | #include <linux/kthread.h> | 24 | #include <linux/kthread.h> |
25 | #include <linux/slab.h> | ||
25 | #include "compat.h" | 26 | #include "compat.h" |
26 | #include "hash.h" | 27 | #include "hash.h" |
27 | #include "ctree.h" | 28 | #include "ctree.h" |
@@ -2676,6 +2677,8 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, | |||
2676 | 2677 | ||
2677 | INIT_LIST_HEAD(&found->block_groups); | 2678 | INIT_LIST_HEAD(&found->block_groups); |
2678 | init_rwsem(&found->groups_sem); | 2679 | init_rwsem(&found->groups_sem); |
2680 | init_waitqueue_head(&found->flush_wait); | ||
2681 | init_waitqueue_head(&found->allocate_wait); | ||
2679 | spin_lock_init(&found->lock); | 2682 | spin_lock_init(&found->lock); |
2680 | found->flags = flags; | 2683 | found->flags = flags; |
2681 | found->total_bytes = total_bytes; | 2684 | found->total_bytes = total_bytes; |
@@ -2846,7 +2849,7 @@ int btrfs_unreserve_metadata_for_delalloc(struct btrfs_root *root, | |||
2846 | } | 2849 | } |
2847 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 2850 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
2848 | 2851 | ||
2849 | BTRFS_I(inode)->reserved_extents--; | 2852 | BTRFS_I(inode)->reserved_extents -= num_items; |
2850 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); | 2853 | BUG_ON(BTRFS_I(inode)->reserved_extents < 0); |
2851 | 2854 | ||
2852 | if (meta_sinfo->bytes_delalloc < num_bytes) { | 2855 | if (meta_sinfo->bytes_delalloc < num_bytes) { |
@@ -2944,12 +2947,10 @@ static void flush_delalloc(struct btrfs_root *root, | |||
2944 | 2947 | ||
2945 | spin_lock(&info->lock); | 2948 | spin_lock(&info->lock); |
2946 | 2949 | ||
2947 | if (!info->flushing) { | 2950 | if (!info->flushing) |
2948 | info->flushing = 1; | 2951 | info->flushing = 1; |
2949 | init_waitqueue_head(&info->flush_wait); | 2952 | else |
2950 | } else { | ||
2951 | wait = true; | 2953 | wait = true; |
2952 | } | ||
2953 | 2954 | ||
2954 | spin_unlock(&info->lock); | 2955 | spin_unlock(&info->lock); |
2955 | 2956 | ||
@@ -3011,7 +3012,6 @@ static int maybe_allocate_chunk(struct btrfs_root *root, | |||
3011 | if (!info->allocating_chunk) { | 3012 | if (!info->allocating_chunk) { |
3012 | info->force_alloc = 1; | 3013 | info->force_alloc = 1; |
3013 | info->allocating_chunk = 1; | 3014 | info->allocating_chunk = 1; |
3014 | init_waitqueue_head(&info->allocate_wait); | ||
3015 | } else { | 3015 | } else { |
3016 | wait = true; | 3016 | wait = true; |
3017 | } | 3017 | } |
@@ -3111,7 +3111,7 @@ again: | |||
3111 | return -ENOSPC; | 3111 | return -ENOSPC; |
3112 | } | 3112 | } |
3113 | 3113 | ||
3114 | BTRFS_I(inode)->reserved_extents++; | 3114 | BTRFS_I(inode)->reserved_extents += num_items; |
3115 | check_force_delalloc(meta_sinfo); | 3115 | check_force_delalloc(meta_sinfo); |
3116 | spin_unlock(&meta_sinfo->lock); | 3116 | spin_unlock(&meta_sinfo->lock); |
3117 | 3117 | ||
@@ -3235,7 +3235,8 @@ int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode, | |||
3235 | u64 bytes) | 3235 | u64 bytes) |
3236 | { | 3236 | { |
3237 | struct btrfs_space_info *data_sinfo; | 3237 | struct btrfs_space_info *data_sinfo; |
3238 | int ret = 0, committed = 0; | 3238 | u64 used; |
3239 | int ret = 0, committed = 0, flushed = 0; | ||
3239 | 3240 | ||
3240 | /* make sure bytes are sectorsize aligned */ | 3241 | /* make sure bytes are sectorsize aligned */ |
3241 | bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1); | 3242 | bytes = (bytes + root->sectorsize - 1) & ~((u64)root->sectorsize - 1); |
@@ -3247,12 +3248,21 @@ int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode, | |||
3247 | again: | 3248 | again: |
3248 | /* make sure we have enough space to handle the data first */ | 3249 | /* make sure we have enough space to handle the data first */ |
3249 | spin_lock(&data_sinfo->lock); | 3250 | spin_lock(&data_sinfo->lock); |
3250 | if (data_sinfo->total_bytes - data_sinfo->bytes_used - | 3251 | used = data_sinfo->bytes_used + data_sinfo->bytes_delalloc + |
3251 | data_sinfo->bytes_delalloc - data_sinfo->bytes_reserved - | 3252 | data_sinfo->bytes_reserved + data_sinfo->bytes_pinned + |
3252 | data_sinfo->bytes_pinned - data_sinfo->bytes_readonly - | 3253 | data_sinfo->bytes_readonly + data_sinfo->bytes_may_use + |
3253 | data_sinfo->bytes_may_use - data_sinfo->bytes_super < bytes) { | 3254 | data_sinfo->bytes_super; |
3255 | |||
3256 | if (used + bytes > data_sinfo->total_bytes) { | ||
3254 | struct btrfs_trans_handle *trans; | 3257 | struct btrfs_trans_handle *trans; |
3255 | 3258 | ||
3259 | if (!flushed) { | ||
3260 | spin_unlock(&data_sinfo->lock); | ||
3261 | flush_delalloc(root, data_sinfo); | ||
3262 | flushed = 1; | ||
3263 | goto again; | ||
3264 | } | ||
3265 | |||
3256 | /* | 3266 | /* |
3257 | * if we don't have enough free bytes in this space then we need | 3267 | * if we don't have enough free bytes in this space then we need |
3258 | * to alloc a new chunk. | 3268 | * to alloc a new chunk. |
@@ -4170,6 +4180,10 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
4170 | ins->offset = 0; | 4180 | ins->offset = 0; |
4171 | 4181 | ||
4172 | space_info = __find_space_info(root->fs_info, data); | 4182 | space_info = __find_space_info(root->fs_info, data); |
4183 | if (!space_info) { | ||
4184 | printk(KERN_ERR "No space info for %d\n", data); | ||
4185 | return -ENOSPC; | ||
4186 | } | ||
4173 | 4187 | ||
4174 | if (orig_root->ref_cows || empty_size) | 4188 | if (orig_root->ref_cows || empty_size) |
4175 | allowed_chunk_alloc = 1; | 4189 | allowed_chunk_alloc = 1; |
@@ -5205,6 +5219,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
5205 | next = btrfs_find_tree_block(root, bytenr, blocksize); | 5219 | next = btrfs_find_tree_block(root, bytenr, blocksize); |
5206 | if (!next) { | 5220 | if (!next) { |
5207 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); | 5221 | next = btrfs_find_create_tree_block(root, bytenr, blocksize); |
5222 | if (!next) | ||
5223 | return -ENOMEM; | ||
5208 | reada = 1; | 5224 | reada = 1; |
5209 | } | 5225 | } |
5210 | btrfs_tree_lock(next); | 5226 | btrfs_tree_lock(next); |
@@ -5417,7 +5433,8 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans, | |||
5417 | if (ret > 0) { | 5433 | if (ret > 0) { |
5418 | path->slots[level]++; | 5434 | path->slots[level]++; |
5419 | continue; | 5435 | continue; |
5420 | } | 5436 | } else if (ret < 0) |
5437 | return ret; | ||
5421 | level = wc->level; | 5438 | level = wc->level; |
5422 | } | 5439 | } |
5423 | return 0; | 5440 | return 0; |
@@ -7369,7 +7386,6 @@ static int find_first_block_group(struct btrfs_root *root, | |||
7369 | } | 7386 | } |
7370 | path->slots[0]++; | 7387 | path->slots[0]++; |
7371 | } | 7388 | } |
7372 | ret = -ENOENT; | ||
7373 | out: | 7389 | out: |
7374 | return ret; | 7390 | return ret; |
7375 | } | 7391 | } |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c99121ac5d6b..d2d03684fab2 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <linux/slab.h> | 2 | #include <linux/slab.h> |
3 | #include <linux/bio.h> | 3 | #include <linux/bio.h> |
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <linux/gfp.h> | ||
6 | #include <linux/pagemap.h> | 5 | #include <linux/pagemap.h> |
7 | #include <linux/page-flags.h> | 6 | #include <linux/page-flags.h> |
8 | #include <linux/module.h> | 7 | #include <linux/module.h> |
@@ -2679,33 +2678,20 @@ int extent_readpages(struct extent_io_tree *tree, | |||
2679 | { | 2678 | { |
2680 | struct bio *bio = NULL; | 2679 | struct bio *bio = NULL; |
2681 | unsigned page_idx; | 2680 | unsigned page_idx; |
2682 | struct pagevec pvec; | ||
2683 | unsigned long bio_flags = 0; | 2681 | unsigned long bio_flags = 0; |
2684 | 2682 | ||
2685 | pagevec_init(&pvec, 0); | ||
2686 | for (page_idx = 0; page_idx < nr_pages; page_idx++) { | 2683 | for (page_idx = 0; page_idx < nr_pages; page_idx++) { |
2687 | struct page *page = list_entry(pages->prev, struct page, lru); | 2684 | struct page *page = list_entry(pages->prev, struct page, lru); |
2688 | 2685 | ||
2689 | prefetchw(&page->flags); | 2686 | prefetchw(&page->flags); |
2690 | list_del(&page->lru); | 2687 | list_del(&page->lru); |
2691 | /* | 2688 | if (!add_to_page_cache_lru(page, mapping, |
2692 | * what we want to do here is call add_to_page_cache_lru, | ||
2693 | * but that isn't exported, so we reproduce it here | ||
2694 | */ | ||
2695 | if (!add_to_page_cache(page, mapping, | ||
2696 | page->index, GFP_KERNEL)) { | 2689 | page->index, GFP_KERNEL)) { |
2697 | |||
2698 | /* open coding of lru_cache_add, also not exported */ | ||
2699 | page_cache_get(page); | ||
2700 | if (!pagevec_add(&pvec, page)) | ||
2701 | __pagevec_lru_add_file(&pvec); | ||
2702 | __extent_read_full_page(tree, page, get_extent, | 2690 | __extent_read_full_page(tree, page, get_extent, |
2703 | &bio, 0, &bio_flags); | 2691 | &bio, 0, &bio_flags); |
2704 | } | 2692 | } |
2705 | page_cache_release(page); | 2693 | page_cache_release(page); |
2706 | } | 2694 | } |
2707 | if (pagevec_count(&pvec)) | ||
2708 | __pagevec_lru_add_file(&pvec); | ||
2709 | BUG_ON(!list_empty(pages)); | 2695 | BUG_ON(!list_empty(pages)); |
2710 | if (bio) | 2696 | if (bio) |
2711 | submit_one_bio(READ, bio, 0, bio_flags); | 2697 | submit_one_bio(READ, bio, 0, bio_flags); |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 28d87ba60ce8..454ca52d6451 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -1,5 +1,4 @@ | |||
1 | #include <linux/err.h> | 1 | #include <linux/err.h> |
2 | #include <linux/gfp.h> | ||
3 | #include <linux/slab.h> | 2 | #include <linux/slab.h> |
4 | #include <linux/module.h> | 3 | #include <linux/module.h> |
5 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 9b99886562d0..54a255065aa3 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/bio.h> | 19 | #include <linux/bio.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
21 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
22 | #include "ctree.h" | 23 | #include "ctree.h" |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index ee3323c7fc1c..29ff749ff4ca 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
29 | #include <linux/statfs.h> | 29 | #include <linux/statfs.h> |
30 | #include <linux/compat.h> | 30 | #include <linux/compat.h> |
31 | #include <linux/slab.h> | ||
31 | #include "ctree.h" | 32 | #include "ctree.h" |
32 | #include "disk-io.h" | 33 | #include "disk-io.h" |
33 | #include "transaction.h" | 34 | #include "transaction.h" |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index dd831ed31eea..f488fac04d99 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/math64.h> | 22 | #include <linux/math64.h> |
22 | #include "ctree.h" | 23 | #include "ctree.h" |
23 | #include "free-space-cache.h" | 24 | #include "free-space-cache.h" |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 02bb099845fd..2bfdc641d4e3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/xattr.h> | 36 | #include <linux/xattr.h> |
37 | #include <linux/posix_acl.h> | 37 | #include <linux/posix_acl.h> |
38 | #include <linux/falloc.h> | 38 | #include <linux/falloc.h> |
39 | #include <linux/slab.h> | ||
39 | #include "compat.h" | 40 | #include "compat.h" |
40 | #include "ctree.h" | 41 | #include "ctree.h" |
41 | #include "disk-io.h" | 42 | #include "disk-io.h" |
@@ -796,7 +797,7 @@ static noinline int cow_file_range(struct inode *inode, | |||
796 | while (disk_num_bytes > 0) { | 797 | while (disk_num_bytes > 0) { |
797 | unsigned long op; | 798 | unsigned long op; |
798 | 799 | ||
799 | cur_alloc_size = min(disk_num_bytes, root->fs_info->max_extent); | 800 | cur_alloc_size = disk_num_bytes; |
800 | ret = btrfs_reserve_extent(trans, root, cur_alloc_size, | 801 | ret = btrfs_reserve_extent(trans, root, cur_alloc_size, |
801 | root->sectorsize, 0, alloc_hint, | 802 | root->sectorsize, 0, alloc_hint, |
802 | (u64)-1, &ins, 1); | 803 | (u64)-1, &ins, 1); |
@@ -1227,30 +1228,9 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page, | |||
1227 | static int btrfs_split_extent_hook(struct inode *inode, | 1228 | static int btrfs_split_extent_hook(struct inode *inode, |
1228 | struct extent_state *orig, u64 split) | 1229 | struct extent_state *orig, u64 split) |
1229 | { | 1230 | { |
1230 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
1231 | u64 size; | ||
1232 | |||
1233 | if (!(orig->state & EXTENT_DELALLOC)) | 1231 | if (!(orig->state & EXTENT_DELALLOC)) |
1234 | return 0; | 1232 | return 0; |
1235 | 1233 | ||
1236 | size = orig->end - orig->start + 1; | ||
1237 | if (size > root->fs_info->max_extent) { | ||
1238 | u64 num_extents; | ||
1239 | u64 new_size; | ||
1240 | |||
1241 | new_size = orig->end - split + 1; | ||
1242 | num_extents = div64_u64(size + root->fs_info->max_extent - 1, | ||
1243 | root->fs_info->max_extent); | ||
1244 | |||
1245 | /* | ||
1246 | * if we break a large extent up then leave oustanding_extents | ||
1247 | * be, since we've already accounted for the large extent. | ||
1248 | */ | ||
1249 | if (div64_u64(new_size + root->fs_info->max_extent - 1, | ||
1250 | root->fs_info->max_extent) < num_extents) | ||
1251 | return 0; | ||
1252 | } | ||
1253 | |||
1254 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 1234 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
1255 | BTRFS_I(inode)->outstanding_extents++; | 1235 | BTRFS_I(inode)->outstanding_extents++; |
1256 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 1236 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
@@ -1268,38 +1248,10 @@ static int btrfs_merge_extent_hook(struct inode *inode, | |||
1268 | struct extent_state *new, | 1248 | struct extent_state *new, |
1269 | struct extent_state *other) | 1249 | struct extent_state *other) |
1270 | { | 1250 | { |
1271 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
1272 | u64 new_size, old_size; | ||
1273 | u64 num_extents; | ||
1274 | |||
1275 | /* not delalloc, ignore it */ | 1251 | /* not delalloc, ignore it */ |
1276 | if (!(other->state & EXTENT_DELALLOC)) | 1252 | if (!(other->state & EXTENT_DELALLOC)) |
1277 | return 0; | 1253 | return 0; |
1278 | 1254 | ||
1279 | old_size = other->end - other->start + 1; | ||
1280 | if (new->start < other->start) | ||
1281 | new_size = other->end - new->start + 1; | ||
1282 | else | ||
1283 | new_size = new->end - other->start + 1; | ||
1284 | |||
1285 | /* we're not bigger than the max, unreserve the space and go */ | ||
1286 | if (new_size <= root->fs_info->max_extent) { | ||
1287 | spin_lock(&BTRFS_I(inode)->accounting_lock); | ||
1288 | BTRFS_I(inode)->outstanding_extents--; | ||
1289 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | ||
1290 | return 0; | ||
1291 | } | ||
1292 | |||
1293 | /* | ||
1294 | * If we grew by another max_extent, just return, we want to keep that | ||
1295 | * reserved amount. | ||
1296 | */ | ||
1297 | num_extents = div64_u64(old_size + root->fs_info->max_extent - 1, | ||
1298 | root->fs_info->max_extent); | ||
1299 | if (div64_u64(new_size + root->fs_info->max_extent - 1, | ||
1300 | root->fs_info->max_extent) > num_extents) | ||
1301 | return 0; | ||
1302 | |||
1303 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 1255 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
1304 | BTRFS_I(inode)->outstanding_extents--; | 1256 | BTRFS_I(inode)->outstanding_extents--; |
1305 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 1257 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
@@ -1328,6 +1280,7 @@ static int btrfs_set_bit_hook(struct inode *inode, u64 start, u64 end, | |||
1328 | BTRFS_I(inode)->outstanding_extents++; | 1280 | BTRFS_I(inode)->outstanding_extents++; |
1329 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 1281 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
1330 | btrfs_delalloc_reserve_space(root, inode, end - start + 1); | 1282 | btrfs_delalloc_reserve_space(root, inode, end - start + 1); |
1283 | |||
1331 | spin_lock(&root->fs_info->delalloc_lock); | 1284 | spin_lock(&root->fs_info->delalloc_lock); |
1332 | BTRFS_I(inode)->delalloc_bytes += end - start + 1; | 1285 | BTRFS_I(inode)->delalloc_bytes += end - start + 1; |
1333 | root->fs_info->delalloc_bytes += end - start + 1; | 1286 | root->fs_info->delalloc_bytes += end - start + 1; |
@@ -1356,6 +1309,7 @@ static int btrfs_clear_bit_hook(struct inode *inode, | |||
1356 | 1309 | ||
1357 | if (bits & EXTENT_DO_ACCOUNTING) { | 1310 | if (bits & EXTENT_DO_ACCOUNTING) { |
1358 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 1311 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
1312 | WARN_ON(!BTRFS_I(inode)->outstanding_extents); | ||
1359 | BTRFS_I(inode)->outstanding_extents--; | 1313 | BTRFS_I(inode)->outstanding_extents--; |
1360 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 1314 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
1361 | btrfs_unreserve_metadata_for_delalloc(root, inode, 1); | 1315 | btrfs_unreserve_metadata_for_delalloc(root, inode, 1); |
@@ -5384,7 +5338,6 @@ free: | |||
5384 | void btrfs_drop_inode(struct inode *inode) | 5338 | void btrfs_drop_inode(struct inode *inode) |
5385 | { | 5339 | { |
5386 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5340 | struct btrfs_root *root = BTRFS_I(inode)->root; |
5387 | |||
5388 | if (inode->i_nlink > 0 && btrfs_root_refs(&root->root_item) == 0) | 5341 | if (inode->i_nlink > 0 && btrfs_root_refs(&root->root_item) == 0) |
5389 | generic_delete_inode(inode); | 5342 | generic_delete_inode(inode); |
5390 | else | 5343 | else |
@@ -5788,18 +5741,15 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5788 | struct btrfs_trans_handle *trans; | 5741 | struct btrfs_trans_handle *trans; |
5789 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5742 | struct btrfs_root *root = BTRFS_I(inode)->root; |
5790 | struct btrfs_key ins; | 5743 | struct btrfs_key ins; |
5791 | u64 alloc_size; | ||
5792 | u64 cur_offset = start; | 5744 | u64 cur_offset = start; |
5793 | u64 num_bytes = end - start; | 5745 | u64 num_bytes = end - start; |
5794 | int ret = 0; | 5746 | int ret = 0; |
5795 | u64 i_size; | 5747 | u64 i_size; |
5796 | 5748 | ||
5797 | while (num_bytes > 0) { | 5749 | while (num_bytes > 0) { |
5798 | alloc_size = min(num_bytes, root->fs_info->max_extent); | ||
5799 | |||
5800 | trans = btrfs_start_transaction(root, 1); | 5750 | trans = btrfs_start_transaction(root, 1); |
5801 | 5751 | ||
5802 | ret = btrfs_reserve_extent(trans, root, alloc_size, | 5752 | ret = btrfs_reserve_extent(trans, root, num_bytes, |
5803 | root->sectorsize, 0, alloc_hint, | 5753 | root->sectorsize, 0, alloc_hint, |
5804 | (u64)-1, &ins, 1); | 5754 | (u64)-1, &ins, 1); |
5805 | if (ret) { | 5755 | if (ret) { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2845c6ceecd2..e84ef60ffe35 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/security.h> | 39 | #include <linux/security.h> |
40 | #include <linux/xattr.h> | 40 | #include <linux/xattr.h> |
41 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
42 | #include <linux/slab.h> | ||
42 | #include "compat.h" | 43 | #include "compat.h" |
43 | #include "ctree.h" | 44 | #include "ctree.h" |
44 | #include "disk-io.h" | 45 | #include "disk-io.h" |
@@ -48,7 +49,6 @@ | |||
48 | #include "print-tree.h" | 49 | #include "print-tree.h" |
49 | #include "volumes.h" | 50 | #include "volumes.h" |
50 | #include "locking.h" | 51 | #include "locking.h" |
51 | #include "ctree.h" | ||
52 | 52 | ||
53 | /* Mask out flags that are inappropriate for the given type of inode. */ | 53 | /* Mask out flags that are inappropriate for the given type of inode. */ |
54 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) | 54 | static inline __u32 btrfs_mask_flags(umode_t mode, __u32 flags) |
@@ -511,7 +511,7 @@ static int should_defrag_range(struct inode *inode, u64 start, u64 len, | |||
511 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); | 511 | em = btrfs_get_extent(inode, NULL, 0, start, len, 0); |
512 | unlock_extent(io_tree, start, start + len - 1, GFP_NOFS); | 512 | unlock_extent(io_tree, start, start + len - 1, GFP_NOFS); |
513 | 513 | ||
514 | if (!em) | 514 | if (IS_ERR(em)) |
515 | return 0; | 515 | return 0; |
516 | } | 516 | } |
517 | 517 | ||
@@ -1212,6 +1212,9 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file, | |||
1212 | return -EPERM; | 1212 | return -EPERM; |
1213 | 1213 | ||
1214 | args = kmalloc(sizeof(*args), GFP_KERNEL); | 1214 | args = kmalloc(sizeof(*args), GFP_KERNEL); |
1215 | if (!args) | ||
1216 | return -ENOMEM; | ||
1217 | |||
1215 | if (copy_from_user(args, argp, sizeof(*args))) { | 1218 | if (copy_from_user(args, argp, sizeof(*args))) { |
1216 | kfree(args); | 1219 | kfree(args); |
1217 | return -EFAULT; | 1220 | return -EFAULT; |
@@ -1375,6 +1378,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
1375 | sizeof(*range))) { | 1378 | sizeof(*range))) { |
1376 | ret = -EFAULT; | 1379 | ret = -EFAULT; |
1377 | kfree(range); | 1380 | kfree(range); |
1381 | goto out; | ||
1378 | } | 1382 | } |
1379 | /* compression requires us to start the IO */ | 1383 | /* compression requires us to start the IO */ |
1380 | if ((range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)) { | 1384 | if ((range->flags & BTRFS_DEFRAG_RANGE_COMPRESS)) { |
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 1c36e5cd8f55..6151f2ea38bb 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * Boston, MA 021110-1307, USA. | 16 | * Boston, MA 021110-1307, USA. |
17 | */ | 17 | */ |
18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
19 | #include <linux/gfp.h> | ||
20 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
21 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
22 | #include <linux/page-flags.h> | 21 | #include <linux/page-flags.h> |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index a8ffecd0b491..a127c0ebb2dc 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * Boston, MA 021110-1307, USA. | 16 | * Boston, MA 021110-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/gfp.h> | ||
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
22 | #include <linux/writeback.h> | 21 | #include <linux/writeback.h> |
@@ -303,6 +302,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
303 | struct btrfs_ordered_extent *entry) | 302 | struct btrfs_ordered_extent *entry) |
304 | { | 303 | { |
305 | struct btrfs_ordered_inode_tree *tree; | 304 | struct btrfs_ordered_inode_tree *tree; |
305 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
306 | struct rb_node *node; | 306 | struct rb_node *node; |
307 | 307 | ||
308 | tree = &BTRFS_I(inode)->ordered_tree; | 308 | tree = &BTRFS_I(inode)->ordered_tree; |
@@ -312,12 +312,13 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
312 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); | 312 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); |
313 | 313 | ||
314 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 314 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
315 | WARN_ON(!BTRFS_I(inode)->outstanding_extents); | ||
315 | BTRFS_I(inode)->outstanding_extents--; | 316 | BTRFS_I(inode)->outstanding_extents--; |
316 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 317 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
317 | btrfs_unreserve_metadata_for_delalloc(BTRFS_I(inode)->root, | 318 | btrfs_unreserve_metadata_for_delalloc(BTRFS_I(inode)->root, |
318 | inode, 1); | 319 | inode, 1); |
319 | 320 | ||
320 | spin_lock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock); | 321 | spin_lock(&root->fs_info->ordered_extent_lock); |
321 | list_del_init(&entry->root_extent_list); | 322 | list_del_init(&entry->root_extent_list); |
322 | 323 | ||
323 | /* | 324 | /* |
@@ -329,7 +330,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
329 | !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) { | 330 | !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) { |
330 | list_del_init(&BTRFS_I(inode)->ordered_operations); | 331 | list_del_init(&BTRFS_I(inode)->ordered_operations); |
331 | } | 332 | } |
332 | spin_unlock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock); | 333 | spin_unlock(&root->fs_info->ordered_extent_lock); |
333 | 334 | ||
334 | return 0; | 335 | return 0; |
335 | } | 336 | } |
diff --git a/fs/btrfs/ref-cache.c b/fs/btrfs/ref-cache.c index d0cc62bccb94..a97314cf6bd6 100644 --- a/fs/btrfs/ref-cache.c +++ b/fs/btrfs/ref-cache.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/sort.h> | 21 | #include <linux/sort.h> |
21 | #include "ctree.h" | 22 | #include "ctree.h" |
22 | #include "ref-cache.h" | 23 | #include "ref-cache.h" |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0b23942cbc0d..e558dd941ded 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/writeback.h> | 21 | #include <linux/writeback.h> |
22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
23 | #include <linux/rbtree.h> | 23 | #include <linux/rbtree.h> |
24 | #include <linux/slab.h> | ||
24 | #include "ctree.h" | 25 | #include "ctree.h" |
25 | #include "disk-io.h" | 26 | #include "disk-io.h" |
26 | #include "transaction.h" | 27 | #include "transaction.h" |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9ac612e6ca60..1866dff0538e 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/namei.h> | 38 | #include <linux/namei.h> |
39 | #include <linux/miscdevice.h> | 39 | #include <linux/miscdevice.h> |
40 | #include <linux/magic.h> | 40 | #include <linux/magic.h> |
41 | #include <linux/slab.h> | ||
41 | #include "compat.h" | 42 | #include "compat.h" |
42 | #include "ctree.h" | 43 | #include "ctree.h" |
43 | #include "disk-io.h" | 44 | #include "disk-io.h" |
@@ -64,10 +65,9 @@ static void btrfs_put_super(struct super_block *sb) | |||
64 | 65 | ||
65 | enum { | 66 | enum { |
66 | Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum, | 67 | Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum, |
67 | Opt_nodatacow, Opt_max_extent, Opt_max_inline, Opt_alloc_start, | 68 | Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd, |
68 | Opt_nobarrier, Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, | 69 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, |
69 | Opt_noacl, Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio, | 70 | Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit, |
70 | Opt_flushoncommit, | ||
71 | Opt_discard, Opt_err, | 71 | Opt_discard, Opt_err, |
72 | }; | 72 | }; |
73 | 73 | ||
@@ -79,7 +79,6 @@ static match_table_t tokens = { | |||
79 | {Opt_nodatasum, "nodatasum"}, | 79 | {Opt_nodatasum, "nodatasum"}, |
80 | {Opt_nodatacow, "nodatacow"}, | 80 | {Opt_nodatacow, "nodatacow"}, |
81 | {Opt_nobarrier, "nobarrier"}, | 81 | {Opt_nobarrier, "nobarrier"}, |
82 | {Opt_max_extent, "max_extent=%s"}, | ||
83 | {Opt_max_inline, "max_inline=%s"}, | 82 | {Opt_max_inline, "max_inline=%s"}, |
84 | {Opt_alloc_start, "alloc_start=%s"}, | 83 | {Opt_alloc_start, "alloc_start=%s"}, |
85 | {Opt_thread_pool, "thread_pool=%d"}, | 84 | {Opt_thread_pool, "thread_pool=%d"}, |
@@ -188,18 +187,6 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
188 | info->thread_pool_size); | 187 | info->thread_pool_size); |
189 | } | 188 | } |
190 | break; | 189 | break; |
191 | case Opt_max_extent: | ||
192 | num = match_strdup(&args[0]); | ||
193 | if (num) { | ||
194 | info->max_extent = memparse(num, NULL); | ||
195 | kfree(num); | ||
196 | |||
197 | info->max_extent = max_t(u64, | ||
198 | info->max_extent, root->sectorsize); | ||
199 | printk(KERN_INFO "btrfs: max_extent at %llu\n", | ||
200 | (unsigned long long)info->max_extent); | ||
201 | } | ||
202 | break; | ||
203 | case Opt_max_inline: | 190 | case Opt_max_inline: |
204 | num = match_strdup(&args[0]); | 191 | num = match_strdup(&args[0]); |
205 | if (num) { | 192 | if (num) { |
@@ -529,9 +516,6 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
529 | seq_puts(seq, ",nodatacow"); | 516 | seq_puts(seq, ",nodatacow"); |
530 | if (btrfs_test_opt(root, NOBARRIER)) | 517 | if (btrfs_test_opt(root, NOBARRIER)) |
531 | seq_puts(seq, ",nobarrier"); | 518 | seq_puts(seq, ",nobarrier"); |
532 | if (info->max_extent != (u64)-1) | ||
533 | seq_printf(seq, ",max_extent=%llu", | ||
534 | (unsigned long long)info->max_extent); | ||
535 | if (info->max_inline != 8192 * 1024) | 519 | if (info->max_inline != 8192 * 1024) |
536 | seq_printf(seq, ",max_inline=%llu", | 520 | seq_printf(seq, ",max_inline=%llu", |
537 | (unsigned long long)info->max_inline); | 521 | (unsigned long long)info->max_inline); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 2d654c1c794d..2cb116099b90 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
21 | #include <linux/writeback.h> | 22 | #include <linux/writeback.h> |
22 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
@@ -147,18 +148,13 @@ static void wait_current_trans(struct btrfs_root *root) | |||
147 | while (1) { | 148 | while (1) { |
148 | prepare_to_wait(&root->fs_info->transaction_wait, &wait, | 149 | prepare_to_wait(&root->fs_info->transaction_wait, &wait, |
149 | TASK_UNINTERRUPTIBLE); | 150 | TASK_UNINTERRUPTIBLE); |
150 | if (cur_trans->blocked) { | 151 | if (!cur_trans->blocked) |
151 | mutex_unlock(&root->fs_info->trans_mutex); | ||
152 | schedule(); | ||
153 | mutex_lock(&root->fs_info->trans_mutex); | ||
154 | finish_wait(&root->fs_info->transaction_wait, | ||
155 | &wait); | ||
156 | } else { | ||
157 | finish_wait(&root->fs_info->transaction_wait, | ||
158 | &wait); | ||
159 | break; | 152 | break; |
160 | } | 153 | mutex_unlock(&root->fs_info->trans_mutex); |
154 | schedule(); | ||
155 | mutex_lock(&root->fs_info->trans_mutex); | ||
161 | } | 156 | } |
157 | finish_wait(&root->fs_info->transaction_wait, &wait); | ||
162 | put_transaction(cur_trans); | 158 | put_transaction(cur_trans); |
163 | } | 159 | } |
164 | } | 160 | } |
@@ -760,10 +756,17 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
760 | struct btrfs_root_item *new_root_item; | 756 | struct btrfs_root_item *new_root_item; |
761 | struct btrfs_root *tree_root = fs_info->tree_root; | 757 | struct btrfs_root *tree_root = fs_info->tree_root; |
762 | struct btrfs_root *root = pending->root; | 758 | struct btrfs_root *root = pending->root; |
759 | struct btrfs_root *parent_root; | ||
760 | struct inode *parent_inode; | ||
763 | struct extent_buffer *tmp; | 761 | struct extent_buffer *tmp; |
764 | struct extent_buffer *old; | 762 | struct extent_buffer *old; |
765 | int ret; | 763 | int ret; |
766 | u64 objectid; | 764 | u64 objectid; |
765 | int namelen; | ||
766 | u64 index = 0; | ||
767 | |||
768 | parent_inode = pending->dentry->d_parent->d_inode; | ||
769 | parent_root = BTRFS_I(parent_inode)->root; | ||
767 | 770 | ||
768 | new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); | 771 | new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); |
769 | if (!new_root_item) { | 772 | if (!new_root_item) { |
@@ -774,79 +777,59 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
774 | if (ret) | 777 | if (ret) |
775 | goto fail; | 778 | goto fail; |
776 | 779 | ||
777 | record_root_in_trans(trans, root); | ||
778 | btrfs_set_root_last_snapshot(&root->root_item, trans->transid); | ||
779 | memcpy(new_root_item, &root->root_item, sizeof(*new_root_item)); | ||
780 | |||
781 | key.objectid = objectid; | 780 | key.objectid = objectid; |
782 | /* record when the snapshot was created in key.offset */ | 781 | /* record when the snapshot was created in key.offset */ |
783 | key.offset = trans->transid; | 782 | key.offset = trans->transid; |
784 | btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); | 783 | btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY); |
785 | 784 | ||
786 | old = btrfs_lock_root_node(root); | ||
787 | btrfs_cow_block(trans, root, old, NULL, 0, &old); | ||
788 | btrfs_set_lock_blocking(old); | ||
789 | |||
790 | btrfs_copy_root(trans, root, old, &tmp, objectid); | ||
791 | btrfs_tree_unlock(old); | ||
792 | free_extent_buffer(old); | ||
793 | |||
794 | btrfs_set_root_node(new_root_item, tmp); | ||
795 | ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, | ||
796 | new_root_item); | ||
797 | btrfs_tree_unlock(tmp); | ||
798 | free_extent_buffer(tmp); | ||
799 | if (ret) | ||
800 | goto fail; | ||
801 | |||
802 | key.offset = (u64)-1; | ||
803 | memcpy(&pending->root_key, &key, sizeof(key)); | 785 | memcpy(&pending->root_key, &key, sizeof(key)); |
804 | fail: | 786 | pending->root_key.offset = (u64)-1; |
805 | kfree(new_root_item); | ||
806 | return ret; | ||
807 | } | ||
808 | |||
809 | static noinline int finish_pending_snapshot(struct btrfs_fs_info *fs_info, | ||
810 | struct btrfs_pending_snapshot *pending) | ||
811 | { | ||
812 | int ret; | ||
813 | int namelen; | ||
814 | u64 index = 0; | ||
815 | struct btrfs_trans_handle *trans; | ||
816 | struct inode *parent_inode; | ||
817 | struct btrfs_root *parent_root; | ||
818 | |||
819 | parent_inode = pending->dentry->d_parent->d_inode; | ||
820 | parent_root = BTRFS_I(parent_inode)->root; | ||
821 | trans = btrfs_join_transaction(parent_root, 1); | ||
822 | 787 | ||
788 | record_root_in_trans(trans, parent_root); | ||
823 | /* | 789 | /* |
824 | * insert the directory item | 790 | * insert the directory item |
825 | */ | 791 | */ |
826 | namelen = strlen(pending->name); | 792 | namelen = strlen(pending->name); |
827 | ret = btrfs_set_inode_index(parent_inode, &index); | 793 | ret = btrfs_set_inode_index(parent_inode, &index); |
794 | BUG_ON(ret); | ||
828 | ret = btrfs_insert_dir_item(trans, parent_root, | 795 | ret = btrfs_insert_dir_item(trans, parent_root, |
829 | pending->name, namelen, | 796 | pending->name, namelen, |
830 | parent_inode->i_ino, | 797 | parent_inode->i_ino, |
831 | &pending->root_key, BTRFS_FT_DIR, index); | 798 | &pending->root_key, BTRFS_FT_DIR, index); |
832 | 799 | BUG_ON(ret); | |
833 | if (ret) | ||
834 | goto fail; | ||
835 | 800 | ||
836 | btrfs_i_size_write(parent_inode, parent_inode->i_size + namelen * 2); | 801 | btrfs_i_size_write(parent_inode, parent_inode->i_size + namelen * 2); |
837 | ret = btrfs_update_inode(trans, parent_root, parent_inode); | 802 | ret = btrfs_update_inode(trans, parent_root, parent_inode); |
838 | BUG_ON(ret); | 803 | BUG_ON(ret); |
839 | 804 | ||
805 | record_root_in_trans(trans, root); | ||
806 | btrfs_set_root_last_snapshot(&root->root_item, trans->transid); | ||
807 | memcpy(new_root_item, &root->root_item, sizeof(*new_root_item)); | ||
808 | |||
809 | old = btrfs_lock_root_node(root); | ||
810 | btrfs_cow_block(trans, root, old, NULL, 0, &old); | ||
811 | btrfs_set_lock_blocking(old); | ||
812 | |||
813 | btrfs_copy_root(trans, root, old, &tmp, objectid); | ||
814 | btrfs_tree_unlock(old); | ||
815 | free_extent_buffer(old); | ||
816 | |||
817 | btrfs_set_root_node(new_root_item, tmp); | ||
818 | ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key, | ||
819 | new_root_item); | ||
820 | BUG_ON(ret); | ||
821 | btrfs_tree_unlock(tmp); | ||
822 | free_extent_buffer(tmp); | ||
823 | |||
840 | ret = btrfs_add_root_ref(trans, parent_root->fs_info->tree_root, | 824 | ret = btrfs_add_root_ref(trans, parent_root->fs_info->tree_root, |
841 | pending->root_key.objectid, | 825 | pending->root_key.objectid, |
842 | parent_root->root_key.objectid, | 826 | parent_root->root_key.objectid, |
843 | parent_inode->i_ino, index, pending->name, | 827 | parent_inode->i_ino, index, pending->name, |
844 | namelen); | 828 | namelen); |
845 | |||
846 | BUG_ON(ret); | 829 | BUG_ON(ret); |
847 | 830 | ||
848 | fail: | 831 | fail: |
849 | btrfs_end_transaction(trans, fs_info->fs_root); | 832 | kfree(new_root_item); |
850 | return ret; | 833 | return ret; |
851 | } | 834 | } |
852 | 835 | ||
@@ -867,25 +850,6 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans, | |||
867 | return 0; | 850 | return 0; |
868 | } | 851 | } |
869 | 852 | ||
870 | static noinline int finish_pending_snapshots(struct btrfs_trans_handle *trans, | ||
871 | struct btrfs_fs_info *fs_info) | ||
872 | { | ||
873 | struct btrfs_pending_snapshot *pending; | ||
874 | struct list_head *head = &trans->transaction->pending_snapshots; | ||
875 | int ret; | ||
876 | |||
877 | while (!list_empty(head)) { | ||
878 | pending = list_entry(head->next, | ||
879 | struct btrfs_pending_snapshot, list); | ||
880 | ret = finish_pending_snapshot(fs_info, pending); | ||
881 | BUG_ON(ret); | ||
882 | list_del(&pending->list); | ||
883 | kfree(pending->name); | ||
884 | kfree(pending); | ||
885 | } | ||
886 | return 0; | ||
887 | } | ||
888 | |||
889 | static void update_super_roots(struct btrfs_root *root) | 853 | static void update_super_roots(struct btrfs_root *root) |
890 | { | 854 | { |
891 | struct btrfs_root_item *root_item; | 855 | struct btrfs_root_item *root_item; |
@@ -1097,9 +1061,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1097 | 1061 | ||
1098 | btrfs_finish_extent_commit(trans, root); | 1062 | btrfs_finish_extent_commit(trans, root); |
1099 | 1063 | ||
1100 | /* do the directory inserts of any pending snapshot creations */ | ||
1101 | finish_pending_snapshots(trans, root->fs_info); | ||
1102 | |||
1103 | mutex_lock(&root->fs_info->trans_mutex); | 1064 | mutex_lock(&root->fs_info->trans_mutex); |
1104 | 1065 | ||
1105 | cur_trans->commit_done = 1; | 1066 | cur_trans->commit_done = 1; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1255fcc8ade5..af57dd2b43d4 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/slab.h> | ||
20 | #include "ctree.h" | 21 | #include "ctree.h" |
21 | #include "transaction.h" | 22 | #include "transaction.h" |
22 | #include "disk-io.h" | 23 | #include "disk-io.h" |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9df8e3f1ccab..8db7b14bbae8 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
19 | #include <linux/bio.h> | 19 | #include <linux/bio.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/buffer_head.h> | 21 | #include <linux/buffer_head.h> |
21 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
22 | #include <linux/random.h> | 23 | #include <linux/random.h> |
@@ -2198,9 +2199,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
2198 | min_stripes = 2; | 2199 | min_stripes = 2; |
2199 | } | 2200 | } |
2200 | if (type & (BTRFS_BLOCK_GROUP_RAID1)) { | 2201 | if (type & (BTRFS_BLOCK_GROUP_RAID1)) { |
2201 | num_stripes = min_t(u64, 2, fs_devices->rw_devices); | 2202 | if (fs_devices->rw_devices < 2) |
2202 | if (num_stripes < 2) | ||
2203 | return -ENOSPC; | 2203 | return -ENOSPC; |
2204 | num_stripes = 2; | ||
2204 | min_stripes = 2; | 2205 | min_stripes = 2; |
2205 | } | 2206 | } |
2206 | if (type & (BTRFS_BLOCK_GROUP_RAID10)) { | 2207 | if (type & (BTRFS_BLOCK_GROUP_RAID10)) { |
@@ -2244,8 +2245,16 @@ again: | |||
2244 | do_div(calc_size, stripe_len); | 2245 | do_div(calc_size, stripe_len); |
2245 | calc_size *= stripe_len; | 2246 | calc_size *= stripe_len; |
2246 | } | 2247 | } |
2248 | |||
2247 | /* we don't want tiny stripes */ | 2249 | /* we don't want tiny stripes */ |
2248 | calc_size = max_t(u64, min_stripe_size, calc_size); | 2250 | if (!looped) |
2251 | calc_size = max_t(u64, min_stripe_size, calc_size); | ||
2252 | |||
2253 | /* | ||
2254 | * we're about to do_div by the stripe_len so lets make sure | ||
2255 | * we end up with something bigger than a stripe | ||
2256 | */ | ||
2257 | calc_size = max_t(u64, calc_size, stripe_len * 4); | ||
2249 | 2258 | ||
2250 | do_div(calc_size, stripe_len); | 2259 | do_div(calc_size, stripe_len); |
2251 | calc_size *= stripe_len; | 2260 | calc_size *= stripe_len; |
@@ -3389,6 +3398,8 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) | |||
3389 | key.type = 0; | 3398 | key.type = 0; |
3390 | again: | 3399 | again: |
3391 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 3400 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
3401 | if (ret < 0) | ||
3402 | goto error; | ||
3392 | while (1) { | 3403 | while (1) { |
3393 | leaf = path->nodes[0]; | 3404 | leaf = path->nodes[0]; |
3394 | slot = path->slots[0]; | 3405 | slot = path->slots[0]; |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 27089311fbea..37fe101a4e0d 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * 2 of the Licence, or (at your option) any later version. | 9 | * 2 of the Licence, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/slab.h> | ||
12 | #include <linux/mount.h> | 13 | #include <linux/mount.h> |
13 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
14 | #include "internal.h" | 15 | #include "internal.h" |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index eeb4986ea7db..d5db84a1ee0d 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
20 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
21 | #include <linux/security.h> | 21 | #include <linux/security.h> |
22 | #include <linux/slab.h> | ||
22 | #include "internal.h" | 23 | #include "internal.h" |
23 | 24 | ||
24 | #define CACHEFILES_KEYBUF_SIZE 512 | 25 | #define CACHEFILES_KEYBUF_SIZE 512 |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 1d8332563863..0f0d41fbb03f 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/mount.h> | 12 | #include <linux/mount.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/file.h> | 14 | #include <linux/file.h> |
14 | #include "internal.h" | 15 | #include "internal.h" |
15 | 16 | ||
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index f3e7a0bf068b..e18b183b47e1 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/fsnotify.h> | 16 | #include <linux/fsnotify.h> |
17 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
18 | #include <linux/xattr.h> | 18 | #include <linux/xattr.h> |
19 | #include <linux/slab.h> | ||
19 | #include "internal.h" | 20 | #include "internal.h" |
20 | 21 | ||
21 | static const char cachefiles_xattr_cache[] = | 22 | static const char cachefiles_xattr_cache[] = |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index ce8ef6107727..412593703d1e 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/pagemap.h> | 6 | #include <linux/pagemap.h> |
7 | #include <linux/writeback.h> /* generic_writepages */ | 7 | #include <linux/writeback.h> /* generic_writepages */ |
8 | #include <linux/slab.h> | ||
8 | #include <linux/pagevec.h> | 9 | #include <linux/pagevec.h> |
9 | #include <linux/task_io_accounting_ops.h> | 10 | #include <linux/task_io_accounting_ops.h> |
10 | 11 | ||
@@ -336,16 +337,15 @@ out: | |||
336 | /* | 337 | /* |
337 | * Get ref for the oldest snapc for an inode with dirty data... that is, the | 338 | * Get ref for the oldest snapc for an inode with dirty data... that is, the |
338 | * only snap context we are allowed to write back. | 339 | * only snap context we are allowed to write back. |
339 | * | ||
340 | * Caller holds i_lock. | ||
341 | */ | 340 | */ |
342 | static struct ceph_snap_context *__get_oldest_context(struct inode *inode, | 341 | static struct ceph_snap_context *get_oldest_context(struct inode *inode, |
343 | u64 *snap_size) | 342 | u64 *snap_size) |
344 | { | 343 | { |
345 | struct ceph_inode_info *ci = ceph_inode(inode); | 344 | struct ceph_inode_info *ci = ceph_inode(inode); |
346 | struct ceph_snap_context *snapc = NULL; | 345 | struct ceph_snap_context *snapc = NULL; |
347 | struct ceph_cap_snap *capsnap = NULL; | 346 | struct ceph_cap_snap *capsnap = NULL; |
348 | 347 | ||
348 | spin_lock(&inode->i_lock); | ||
349 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 349 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
350 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, | 350 | dout(" cap_snap %p snapc %p has %d dirty pages\n", capsnap, |
351 | capsnap->context, capsnap->dirty_pages); | 351 | capsnap->context, capsnap->dirty_pages); |
@@ -356,21 +356,11 @@ static struct ceph_snap_context *__get_oldest_context(struct inode *inode, | |||
356 | break; | 356 | break; |
357 | } | 357 | } |
358 | } | 358 | } |
359 | if (!snapc && ci->i_snap_realm) { | 359 | if (!snapc && ci->i_head_snapc) { |
360 | snapc = ceph_get_snap_context(ci->i_snap_realm->cached_context); | 360 | snapc = ceph_get_snap_context(ci->i_head_snapc); |
361 | dout(" head snapc %p has %d dirty pages\n", | 361 | dout(" head snapc %p has %d dirty pages\n", |
362 | snapc, ci->i_wrbuffer_ref_head); | 362 | snapc, ci->i_wrbuffer_ref_head); |
363 | } | 363 | } |
364 | return snapc; | ||
365 | } | ||
366 | |||
367 | static struct ceph_snap_context *get_oldest_context(struct inode *inode, | ||
368 | u64 *snap_size) | ||
369 | { | ||
370 | struct ceph_snap_context *snapc = NULL; | ||
371 | |||
372 | spin_lock(&inode->i_lock); | ||
373 | snapc = __get_oldest_context(inode, snap_size); | ||
374 | spin_unlock(&inode->i_lock); | 364 | spin_unlock(&inode->i_lock); |
375 | return snapc; | 365 | return snapc; |
376 | } | 366 | } |
@@ -391,7 +381,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) | |||
391 | int len = PAGE_CACHE_SIZE; | 381 | int len = PAGE_CACHE_SIZE; |
392 | loff_t i_size; | 382 | loff_t i_size; |
393 | int err = 0; | 383 | int err = 0; |
394 | struct ceph_snap_context *snapc; | 384 | struct ceph_snap_context *snapc, *oldest; |
395 | u64 snap_size = 0; | 385 | u64 snap_size = 0; |
396 | long writeback_stat; | 386 | long writeback_stat; |
397 | 387 | ||
@@ -412,13 +402,16 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) | |||
412 | dout("writepage %p page %p not dirty?\n", inode, page); | 402 | dout("writepage %p page %p not dirty?\n", inode, page); |
413 | goto out; | 403 | goto out; |
414 | } | 404 | } |
415 | if (snapc != get_oldest_context(inode, &snap_size)) { | 405 | oldest = get_oldest_context(inode, &snap_size); |
406 | if (snapc->seq > oldest->seq) { | ||
416 | dout("writepage %p page %p snapc %p not writeable - noop\n", | 407 | dout("writepage %p page %p snapc %p not writeable - noop\n", |
417 | inode, page, (void *)page->private); | 408 | inode, page, (void *)page->private); |
418 | /* we should only noop if called by kswapd */ | 409 | /* we should only noop if called by kswapd */ |
419 | WARN_ON((current->flags & PF_MEMALLOC) == 0); | 410 | WARN_ON((current->flags & PF_MEMALLOC) == 0); |
411 | ceph_put_snap_context(oldest); | ||
420 | goto out; | 412 | goto out; |
421 | } | 413 | } |
414 | ceph_put_snap_context(oldest); | ||
422 | 415 | ||
423 | /* is this a partial page at end of file? */ | 416 | /* is this a partial page at end of file? */ |
424 | if (snap_size) | 417 | if (snap_size) |
@@ -457,7 +450,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) | |||
457 | ClearPagePrivate(page); | 450 | ClearPagePrivate(page); |
458 | end_page_writeback(page); | 451 | end_page_writeback(page); |
459 | ceph_put_wrbuffer_cap_refs(ci, 1, snapc); | 452 | ceph_put_wrbuffer_cap_refs(ci, 1, snapc); |
460 | ceph_put_snap_context(snapc); | 453 | ceph_put_snap_context(snapc); /* page's reference */ |
461 | out: | 454 | out: |
462 | return err; | 455 | return err; |
463 | } | 456 | } |
@@ -557,9 +550,9 @@ static void writepages_finish(struct ceph_osd_request *req, | |||
557 | dout("inode %p skipping page %p\n", inode, page); | 550 | dout("inode %p skipping page %p\n", inode, page); |
558 | wbc->pages_skipped++; | 551 | wbc->pages_skipped++; |
559 | } | 552 | } |
553 | ceph_put_snap_context((void *)page->private); | ||
560 | page->private = 0; | 554 | page->private = 0; |
561 | ClearPagePrivate(page); | 555 | ClearPagePrivate(page); |
562 | ceph_put_snap_context(snapc); | ||
563 | dout("unlocking %d %p\n", i, page); | 556 | dout("unlocking %d %p\n", i, page); |
564 | end_page_writeback(page); | 557 | end_page_writeback(page); |
565 | 558 | ||
@@ -617,7 +610,7 @@ static int ceph_writepages_start(struct address_space *mapping, | |||
617 | int range_whole = 0; | 610 | int range_whole = 0; |
618 | int should_loop = 1; | 611 | int should_loop = 1; |
619 | pgoff_t max_pages = 0, max_pages_ever = 0; | 612 | pgoff_t max_pages = 0, max_pages_ever = 0; |
620 | struct ceph_snap_context *snapc = NULL, *last_snapc = NULL; | 613 | struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc; |
621 | struct pagevec pvec; | 614 | struct pagevec pvec; |
622 | int done = 0; | 615 | int done = 0; |
623 | int rc = 0; | 616 | int rc = 0; |
@@ -769,9 +762,10 @@ get_more_pages: | |||
769 | } | 762 | } |
770 | 763 | ||
771 | /* only if matching snap context */ | 764 | /* only if matching snap context */ |
772 | if (snapc != (void *)page->private) { | 765 | pgsnapc = (void *)page->private; |
773 | dout("page snapc %p != oldest %p\n", | 766 | if (pgsnapc->seq > snapc->seq) { |
774 | (void *)page->private, snapc); | 767 | dout("page snapc %p %lld > oldest %p %lld\n", |
768 | pgsnapc, pgsnapc->seq, snapc, snapc->seq); | ||
775 | unlock_page(page); | 769 | unlock_page(page); |
776 | if (!locked_pages) | 770 | if (!locked_pages) |
777 | continue; /* keep looking for snap */ | 771 | continue; /* keep looking for snap */ |
@@ -913,7 +907,10 @@ static int context_is_writeable_or_written(struct inode *inode, | |||
913 | struct ceph_snap_context *snapc) | 907 | struct ceph_snap_context *snapc) |
914 | { | 908 | { |
915 | struct ceph_snap_context *oldest = get_oldest_context(inode, NULL); | 909 | struct ceph_snap_context *oldest = get_oldest_context(inode, NULL); |
916 | return !oldest || snapc->seq <= oldest->seq; | 910 | int ret = !oldest || snapc->seq <= oldest->seq; |
911 | |||
912 | ceph_put_snap_context(oldest); | ||
913 | return ret; | ||
917 | } | 914 | } |
918 | 915 | ||
919 | /* | 916 | /* |
@@ -935,8 +932,8 @@ static int ceph_update_writeable_page(struct file *file, | |||
935 | int pos_in_page = pos & ~PAGE_CACHE_MASK; | 932 | int pos_in_page = pos & ~PAGE_CACHE_MASK; |
936 | int end_in_page = pos_in_page + len; | 933 | int end_in_page = pos_in_page + len; |
937 | loff_t i_size; | 934 | loff_t i_size; |
938 | struct ceph_snap_context *snapc; | ||
939 | int r; | 935 | int r; |
936 | struct ceph_snap_context *snapc, *oldest; | ||
940 | 937 | ||
941 | retry_locked: | 938 | retry_locked: |
942 | /* writepages currently holds page lock, but if we change that later, */ | 939 | /* writepages currently holds page lock, but if we change that later, */ |
@@ -946,23 +943,24 @@ retry_locked: | |||
946 | BUG_ON(!ci->i_snap_realm); | 943 | BUG_ON(!ci->i_snap_realm); |
947 | down_read(&mdsc->snap_rwsem); | 944 | down_read(&mdsc->snap_rwsem); |
948 | BUG_ON(!ci->i_snap_realm->cached_context); | 945 | BUG_ON(!ci->i_snap_realm->cached_context); |
949 | if (page->private && | 946 | snapc = (void *)page->private; |
950 | (void *)page->private != ci->i_snap_realm->cached_context) { | 947 | if (snapc && snapc != ci->i_head_snapc) { |
951 | /* | 948 | /* |
952 | * this page is already dirty in another (older) snap | 949 | * this page is already dirty in another (older) snap |
953 | * context! is it writeable now? | 950 | * context! is it writeable now? |
954 | */ | 951 | */ |
955 | snapc = get_oldest_context(inode, NULL); | 952 | oldest = get_oldest_context(inode, NULL); |
956 | up_read(&mdsc->snap_rwsem); | 953 | up_read(&mdsc->snap_rwsem); |
957 | 954 | ||
958 | if (snapc != (void *)page->private) { | 955 | if (snapc->seq > oldest->seq) { |
956 | ceph_put_snap_context(oldest); | ||
959 | dout(" page %p snapc %p not current or oldest\n", | 957 | dout(" page %p snapc %p not current or oldest\n", |
960 | page, (void *)page->private); | 958 | page, snapc); |
961 | /* | 959 | /* |
962 | * queue for writeback, and wait for snapc to | 960 | * queue for writeback, and wait for snapc to |
963 | * be writeable or written | 961 | * be writeable or written |
964 | */ | 962 | */ |
965 | snapc = ceph_get_snap_context((void *)page->private); | 963 | snapc = ceph_get_snap_context(snapc); |
966 | unlock_page(page); | 964 | unlock_page(page); |
967 | ceph_queue_writeback(inode); | 965 | ceph_queue_writeback(inode); |
968 | r = wait_event_interruptible(ci->i_cap_wq, | 966 | r = wait_event_interruptible(ci->i_cap_wq, |
@@ -972,6 +970,7 @@ retry_locked: | |||
972 | return r; | 970 | return r; |
973 | return -EAGAIN; | 971 | return -EAGAIN; |
974 | } | 972 | } |
973 | ceph_put_snap_context(oldest); | ||
975 | 974 | ||
976 | /* yay, writeable, do it now (without dropping page lock) */ | 975 | /* yay, writeable, do it now (without dropping page lock) */ |
977 | dout(" page %p snapc %p not current, but oldest\n", | 976 | dout(" page %p snapc %p not current, but oldest\n", |
diff --git a/fs/ceph/auth.c b/fs/ceph/auth.c index abb204fea6c7..f6394b94b866 100644 --- a/fs/ceph/auth.c +++ b/fs/ceph/auth.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/module.h> | 3 | #include <linux/module.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/err.h> | 5 | #include <linux/err.h> |
5 | 6 | ||
6 | #include "types.h" | 7 | #include "types.h" |
diff --git a/fs/ceph/auth_none.c b/fs/ceph/auth_none.c index b4ef6f0a6c85..8cd9e3af07f7 100644 --- a/fs/ceph/auth_none.c +++ b/fs/ceph/auth_none.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/err.h> | 4 | #include <linux/err.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/random.h> | 6 | #include <linux/random.h> |
7 | #include <linux/slab.h> | ||
7 | 8 | ||
8 | #include "auth_none.h" | 9 | #include "auth_none.h" |
9 | #include "auth.h" | 10 | #include "auth.h" |
diff --git a/fs/ceph/auth_x.c b/fs/ceph/auth_x.c index 8d8a84964763..d9001a4dc8cc 100644 --- a/fs/ceph/auth_x.c +++ b/fs/ceph/auth_x.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/err.h> | 4 | #include <linux/err.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
6 | #include <linux/random.h> | 6 | #include <linux/random.h> |
7 | #include <linux/slab.h> | ||
7 | 8 | ||
8 | #include "auth_x.h" | 9 | #include "auth_x.h" |
9 | #include "auth_x_protocol.h" | 10 | #include "auth_x_protocol.h" |
diff --git a/fs/ceph/buffer.c b/fs/ceph/buffer.c index b98086c7aeba..c67535d70aa6 100644 --- a/fs/ceph/buffer.c +++ b/fs/ceph/buffer.c | |||
@@ -1,5 +1,8 @@ | |||
1 | 1 | ||
2 | #include "ceph_debug.h" | 2 | #include "ceph_debug.h" |
3 | |||
4 | #include <linux/slab.h> | ||
5 | |||
3 | #include "buffer.h" | 6 | #include "buffer.h" |
4 | #include "decode.h" | 7 | #include "decode.h" |
5 | 8 | ||
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 7d0a0d0adc18..aa2239fa9a3b 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/vmalloc.h> | 7 | #include <linux/vmalloc.h> |
7 | #include <linux/wait.h> | 8 | #include <linux/wait.h> |
8 | #include <linux/writeback.h> | 9 | #include <linux/writeback.h> |
@@ -1204,6 +1205,12 @@ retry: | |||
1204 | if (capsnap->dirty_pages || capsnap->writing) | 1205 | if (capsnap->dirty_pages || capsnap->writing) |
1205 | continue; | 1206 | continue; |
1206 | 1207 | ||
1208 | /* | ||
1209 | * if cap writeback already occurred, we should have dropped | ||
1210 | * the capsnap in ceph_put_wrbuffer_cap_refs. | ||
1211 | */ | ||
1212 | BUG_ON(capsnap->dirty == 0); | ||
1213 | |||
1207 | /* pick mds, take s_mutex */ | 1214 | /* pick mds, take s_mutex */ |
1208 | mds = __ceph_get_cap_mds(ci, &mseq); | 1215 | mds = __ceph_get_cap_mds(ci, &mseq); |
1209 | if (session && session->s_mds != mds) { | 1216 | if (session && session->s_mds != mds) { |
@@ -2117,8 +2124,8 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) | |||
2117 | } | 2124 | } |
2118 | spin_unlock(&inode->i_lock); | 2125 | spin_unlock(&inode->i_lock); |
2119 | 2126 | ||
2120 | dout("put_cap_refs %p had %s %s\n", inode, ceph_cap_string(had), | 2127 | dout("put_cap_refs %p had %s%s%s\n", inode, ceph_cap_string(had), |
2121 | last ? "last" : ""); | 2128 | last ? " last" : "", put ? " put" : ""); |
2122 | 2129 | ||
2123 | if (last && !flushsnaps) | 2130 | if (last && !flushsnaps) |
2124 | ceph_check_caps(ci, 0, NULL); | 2131 | ceph_check_caps(ci, 0, NULL); |
@@ -2142,7 +2149,8 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2142 | { | 2149 | { |
2143 | struct inode *inode = &ci->vfs_inode; | 2150 | struct inode *inode = &ci->vfs_inode; |
2144 | int last = 0; | 2151 | int last = 0; |
2145 | int last_snap = 0; | 2152 | int complete_capsnap = 0; |
2153 | int drop_capsnap = 0; | ||
2146 | int found = 0; | 2154 | int found = 0; |
2147 | struct ceph_cap_snap *capsnap = NULL; | 2155 | struct ceph_cap_snap *capsnap = NULL; |
2148 | 2156 | ||
@@ -2165,19 +2173,32 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2165 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { | 2173 | list_for_each_entry(capsnap, &ci->i_cap_snaps, ci_item) { |
2166 | if (capsnap->context == snapc) { | 2174 | if (capsnap->context == snapc) { |
2167 | found = 1; | 2175 | found = 1; |
2168 | capsnap->dirty_pages -= nr; | ||
2169 | last_snap = !capsnap->dirty_pages; | ||
2170 | break; | 2176 | break; |
2171 | } | 2177 | } |
2172 | } | 2178 | } |
2173 | BUG_ON(!found); | 2179 | BUG_ON(!found); |
2180 | capsnap->dirty_pages -= nr; | ||
2181 | if (capsnap->dirty_pages == 0) { | ||
2182 | complete_capsnap = 1; | ||
2183 | if (capsnap->dirty == 0) | ||
2184 | /* cap writeback completed before we created | ||
2185 | * the cap_snap; no FLUSHSNAP is needed */ | ||
2186 | drop_capsnap = 1; | ||
2187 | } | ||
2174 | dout("put_wrbuffer_cap_refs on %p cap_snap %p " | 2188 | dout("put_wrbuffer_cap_refs on %p cap_snap %p " |
2175 | " snap %lld %d/%d -> %d/%d %s%s\n", | 2189 | " snap %lld %d/%d -> %d/%d %s%s%s\n", |
2176 | inode, capsnap, capsnap->context->seq, | 2190 | inode, capsnap, capsnap->context->seq, |
2177 | ci->i_wrbuffer_ref+nr, capsnap->dirty_pages + nr, | 2191 | ci->i_wrbuffer_ref+nr, capsnap->dirty_pages + nr, |
2178 | ci->i_wrbuffer_ref, capsnap->dirty_pages, | 2192 | ci->i_wrbuffer_ref, capsnap->dirty_pages, |
2179 | last ? " (wrbuffer last)" : "", | 2193 | last ? " (wrbuffer last)" : "", |
2180 | last_snap ? " (capsnap last)" : ""); | 2194 | complete_capsnap ? " (complete capsnap)" : "", |
2195 | drop_capsnap ? " (drop capsnap)" : ""); | ||
2196 | if (drop_capsnap) { | ||
2197 | ceph_put_snap_context(capsnap->context); | ||
2198 | list_del(&capsnap->ci_item); | ||
2199 | list_del(&capsnap->flushing_item); | ||
2200 | ceph_put_cap_snap(capsnap); | ||
2201 | } | ||
2181 | } | 2202 | } |
2182 | 2203 | ||
2183 | spin_unlock(&inode->i_lock); | 2204 | spin_unlock(&inode->i_lock); |
@@ -2185,10 +2206,12 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | |||
2185 | if (last) { | 2206 | if (last) { |
2186 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | 2207 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
2187 | iput(inode); | 2208 | iput(inode); |
2188 | } else if (last_snap) { | 2209 | } else if (complete_capsnap) { |
2189 | ceph_flush_snaps(ci); | 2210 | ceph_flush_snaps(ci); |
2190 | wake_up(&ci->i_cap_wq); | 2211 | wake_up(&ci->i_cap_wq); |
2191 | } | 2212 | } |
2213 | if (drop_capsnap) | ||
2214 | iput(inode); | ||
2192 | } | 2215 | } |
2193 | 2216 | ||
2194 | /* | 2217 | /* |
@@ -2464,8 +2487,8 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, | |||
2464 | break; | 2487 | break; |
2465 | } | 2488 | } |
2466 | WARN_ON(capsnap->dirty_pages || capsnap->writing); | 2489 | WARN_ON(capsnap->dirty_pages || capsnap->writing); |
2467 | dout(" removing cap_snap %p follows %lld\n", | 2490 | dout(" removing %p cap_snap %p follows %lld\n", |
2468 | capsnap, follows); | 2491 | inode, capsnap, follows); |
2469 | ceph_put_snap_context(capsnap->context); | 2492 | ceph_put_snap_context(capsnap->context); |
2470 | list_del(&capsnap->ci_item); | 2493 | list_del(&capsnap->ci_item); |
2471 | list_del(&capsnap->flushing_item); | 2494 | list_del(&capsnap->flushing_item); |
diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index 291ac288e791..f704b3b62424 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/err.h> | 4 | #include <linux/err.h> |
5 | #include <linux/scatterlist.h> | 5 | #include <linux/scatterlist.h> |
6 | #include <linux/slab.h> | ||
6 | #include <crypto/hash.h> | 7 | #include <crypto/hash.h> |
7 | 8 | ||
8 | #include "crypto.h" | 9 | #include "crypto.h" |
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index e159f1415110..f7048da92acc 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/device.h> | 3 | #include <linux/device.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/module.h> | 5 | #include <linux/module.h> |
5 | #include <linux/ctype.h> | 6 | #include <linux/ctype.h> |
6 | #include <linux/debugfs.h> | 7 | #include <linux/debugfs.h> |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 8a9116e15b70..ea8ee2e526aa 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/spinlock.h> | 3 | #include <linux/spinlock.h> |
4 | #include <linux/fs_struct.h> | 4 | #include <linux/fs_struct.h> |
5 | #include <linux/namei.h> | 5 | #include <linux/namei.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
7 | 8 | ||
8 | #include "super.h" | 9 | #include "super.h" |
@@ -170,11 +171,11 @@ more: | |||
170 | spin_lock(&inode->i_lock); | 171 | spin_lock(&inode->i_lock); |
171 | spin_lock(&dcache_lock); | 172 | spin_lock(&dcache_lock); |
172 | 173 | ||
174 | last = dentry; | ||
175 | |||
173 | if (err < 0) | 176 | if (err < 0) |
174 | goto out_unlock; | 177 | goto out_unlock; |
175 | 178 | ||
176 | last = dentry; | ||
177 | |||
178 | p = p->prev; | 179 | p = p->prev; |
179 | filp->f_pos++; | 180 | filp->f_pos++; |
180 | 181 | ||
@@ -311,7 +312,7 @@ more: | |||
311 | req->r_readdir_offset = fi->next_offset; | 312 | req->r_readdir_offset = fi->next_offset; |
312 | req->r_args.readdir.frag = cpu_to_le32(frag); | 313 | req->r_args.readdir.frag = cpu_to_le32(frag); |
313 | req->r_args.readdir.max_entries = cpu_to_le32(max_entries); | 314 | req->r_args.readdir.max_entries = cpu_to_le32(max_entries); |
314 | req->r_num_caps = max_entries; | 315 | req->r_num_caps = max_entries + 1; |
315 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 316 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
316 | if (err < 0) { | 317 | if (err < 0) { |
317 | ceph_mdsc_put_request(req); | 318 | ceph_mdsc_put_request(req); |
@@ -488,6 +489,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
488 | struct inode *inode = ceph_get_snapdir(parent); | 489 | struct inode *inode = ceph_get_snapdir(parent); |
489 | dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n", | 490 | dout("ENOENT on snapdir %p '%.*s', linking to snapdir %p\n", |
490 | dentry, dentry->d_name.len, dentry->d_name.name, inode); | 491 | dentry, dentry->d_name.len, dentry->d_name.name, inode); |
492 | BUG_ON(!d_unhashed(dentry)); | ||
491 | d_add(dentry, inode); | 493 | d_add(dentry, inode); |
492 | err = 0; | 494 | err = 0; |
493 | } | 495 | } |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index fc68e39cbad6..9d67572fb328 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/exportfs.h> | 3 | #include <linux/exportfs.h> |
4 | #include <linux/slab.h> | ||
4 | #include <asm/unaligned.h> | 5 | #include <asm/unaligned.h> |
5 | 6 | ||
6 | #include "super.h" | 7 | #include "super.h" |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 5d2af8464f6a..4add3d5da2c1 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/sched.h> | 3 | #include <linux/sched.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/file.h> | 5 | #include <linux/file.h> |
5 | #include <linux/namei.h> | 6 | #include <linux/namei.h> |
6 | #include <linux/writeback.h> | 7 | #include <linux/writeback.h> |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index aca82d55cc53..26f883c275e8 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -886,6 +886,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
886 | struct inode *in = NULL; | 886 | struct inode *in = NULL; |
887 | struct ceph_mds_reply_inode *ininfo; | 887 | struct ceph_mds_reply_inode *ininfo; |
888 | struct ceph_vino vino; | 888 | struct ceph_vino vino; |
889 | struct ceph_client *client = ceph_sb_to_client(sb); | ||
889 | int i = 0; | 890 | int i = 0; |
890 | int err = 0; | 891 | int err = 0; |
891 | 892 | ||
@@ -949,7 +950,14 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
949 | return err; | 950 | return err; |
950 | } | 951 | } |
951 | 952 | ||
952 | if (rinfo->head->is_dentry && !req->r_aborted) { | 953 | /* |
954 | * ignore null lease/binding on snapdir ENOENT, or else we | ||
955 | * will have trouble splicing in the virtual snapdir later | ||
956 | */ | ||
957 | if (rinfo->head->is_dentry && !req->r_aborted && | ||
958 | (rinfo->head->is_target || strncmp(req->r_dentry->d_name.name, | ||
959 | client->mount_args->snapdir_name, | ||
960 | req->r_dentry->d_name.len))) { | ||
953 | /* | 961 | /* |
954 | * lookup link rename : null -> possibly existing inode | 962 | * lookup link rename : null -> possibly existing inode |
955 | * mknod symlink mkdir : null -> new inode | 963 | * mknod symlink mkdir : null -> new inode |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 5c7920be6420..60a9a4ae47be 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/wait.h> | 3 | #include <linux/wait.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/sched.h> | 5 | #include <linux/sched.h> |
5 | 6 | ||
6 | #include "mds_client.h" | 7 | #include "mds_client.h" |
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index a32f0f896d9f..cdaaa131add3 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/inet.h> | 6 | #include <linux/inet.h> |
7 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
8 | #include <linux/net.h> | 8 | #include <linux/net.h> |
9 | #include <linux/slab.h> | ||
9 | #include <linux/socket.h> | 10 | #include <linux/socket.h> |
10 | #include <linux/string.h> | 11 | #include <linux/string.h> |
11 | #include <net/tcp.h> | 12 | #include <net/tcp.h> |
@@ -29,6 +30,10 @@ static char tag_msg = CEPH_MSGR_TAG_MSG; | |||
29 | static char tag_ack = CEPH_MSGR_TAG_ACK; | 30 | static char tag_ack = CEPH_MSGR_TAG_ACK; |
30 | static char tag_keepalive = CEPH_MSGR_TAG_KEEPALIVE; | 31 | static char tag_keepalive = CEPH_MSGR_TAG_KEEPALIVE; |
31 | 32 | ||
33 | #ifdef CONFIG_LOCKDEP | ||
34 | static struct lock_class_key socket_class; | ||
35 | #endif | ||
36 | |||
32 | 37 | ||
33 | static void queue_con(struct ceph_connection *con); | 38 | static void queue_con(struct ceph_connection *con); |
34 | static void con_work(struct work_struct *); | 39 | static void con_work(struct work_struct *); |
@@ -227,6 +232,10 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con) | |||
227 | con->sock = sock; | 232 | con->sock = sock; |
228 | sock->sk->sk_allocation = GFP_NOFS; | 233 | sock->sk->sk_allocation = GFP_NOFS; |
229 | 234 | ||
235 | #ifdef CONFIG_LOCKDEP | ||
236 | lockdep_set_class(&sock->sk->sk_lock, &socket_class); | ||
237 | #endif | ||
238 | |||
230 | set_sock_callbacks(sock, con); | 239 | set_sock_callbacks(sock, con); |
231 | 240 | ||
232 | dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); | 241 | dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); |
@@ -332,6 +341,7 @@ static void reset_connection(struct ceph_connection *con) | |||
332 | con->out_msg = NULL; | 341 | con->out_msg = NULL; |
333 | } | 342 | } |
334 | con->in_seq = 0; | 343 | con->in_seq = 0; |
344 | con->in_seq_acked = 0; | ||
335 | } | 345 | } |
336 | 346 | ||
337 | /* | 347 | /* |
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index 890597c09d43..8fdc011ca956 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/random.h> | 5 | #include <linux/random.h> |
5 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
6 | 7 | ||
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index d82fe87c2a6e..2e2c15eed82a 100644 --- a/fs/ceph/osdmap.c +++ b/fs/ceph/osdmap.c | |||
@@ -1,4 +1,7 @@ | |||
1 | 1 | ||
2 | #include "ceph_debug.h" | ||
3 | |||
4 | #include <linux/slab.h> | ||
2 | #include <asm/div64.h> | 5 | #include <asm/div64.h> |
3 | 6 | ||
4 | #include "super.h" | 7 | #include "super.h" |
@@ -6,7 +9,6 @@ | |||
6 | #include "crush/hash.h" | 9 | #include "crush/hash.h" |
7 | #include "crush/mapper.h" | 10 | #include "crush/mapper.h" |
8 | #include "decode.h" | 11 | #include "decode.h" |
9 | #include "ceph_debug.h" | ||
10 | 12 | ||
11 | char *ceph_osdmap_state_str(char *str, int len, int state) | 13 | char *ceph_osdmap_state_str(char *str, int len, int state) |
12 | { | 14 | { |
@@ -312,71 +314,6 @@ bad: | |||
312 | return ERR_PTR(err); | 314 | return ERR_PTR(err); |
313 | } | 315 | } |
314 | 316 | ||
315 | |||
316 | /* | ||
317 | * osd map | ||
318 | */ | ||
319 | void ceph_osdmap_destroy(struct ceph_osdmap *map) | ||
320 | { | ||
321 | dout("osdmap_destroy %p\n", map); | ||
322 | if (map->crush) | ||
323 | crush_destroy(map->crush); | ||
324 | while (!RB_EMPTY_ROOT(&map->pg_temp)) { | ||
325 | struct ceph_pg_mapping *pg = | ||
326 | rb_entry(rb_first(&map->pg_temp), | ||
327 | struct ceph_pg_mapping, node); | ||
328 | rb_erase(&pg->node, &map->pg_temp); | ||
329 | kfree(pg); | ||
330 | } | ||
331 | while (!RB_EMPTY_ROOT(&map->pg_pools)) { | ||
332 | struct ceph_pg_pool_info *pi = | ||
333 | rb_entry(rb_first(&map->pg_pools), | ||
334 | struct ceph_pg_pool_info, node); | ||
335 | rb_erase(&pi->node, &map->pg_pools); | ||
336 | kfree(pi); | ||
337 | } | ||
338 | kfree(map->osd_state); | ||
339 | kfree(map->osd_weight); | ||
340 | kfree(map->osd_addr); | ||
341 | kfree(map); | ||
342 | } | ||
343 | |||
344 | /* | ||
345 | * adjust max osd value. reallocate arrays. | ||
346 | */ | ||
347 | static int osdmap_set_max_osd(struct ceph_osdmap *map, int max) | ||
348 | { | ||
349 | u8 *state; | ||
350 | struct ceph_entity_addr *addr; | ||
351 | u32 *weight; | ||
352 | |||
353 | state = kcalloc(max, sizeof(*state), GFP_NOFS); | ||
354 | addr = kcalloc(max, sizeof(*addr), GFP_NOFS); | ||
355 | weight = kcalloc(max, sizeof(*weight), GFP_NOFS); | ||
356 | if (state == NULL || addr == NULL || weight == NULL) { | ||
357 | kfree(state); | ||
358 | kfree(addr); | ||
359 | kfree(weight); | ||
360 | return -ENOMEM; | ||
361 | } | ||
362 | |||
363 | /* copy old? */ | ||
364 | if (map->osd_state) { | ||
365 | memcpy(state, map->osd_state, map->max_osd*sizeof(*state)); | ||
366 | memcpy(addr, map->osd_addr, map->max_osd*sizeof(*addr)); | ||
367 | memcpy(weight, map->osd_weight, map->max_osd*sizeof(*weight)); | ||
368 | kfree(map->osd_state); | ||
369 | kfree(map->osd_addr); | ||
370 | kfree(map->osd_weight); | ||
371 | } | ||
372 | |||
373 | map->osd_state = state; | ||
374 | map->osd_weight = weight; | ||
375 | map->osd_addr = addr; | ||
376 | map->max_osd = max; | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | /* | 317 | /* |
381 | * rbtree of pg_mapping for handling pg_temp (explicit mapping of pgid | 318 | * rbtree of pg_mapping for handling pg_temp (explicit mapping of pgid |
382 | * to a set of osds) | 319 | * to a set of osds) |
@@ -480,6 +417,13 @@ static struct ceph_pg_pool_info *__lookup_pg_pool(struct rb_root *root, int id) | |||
480 | return NULL; | 417 | return NULL; |
481 | } | 418 | } |
482 | 419 | ||
420 | static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) | ||
421 | { | ||
422 | rb_erase(&pi->node, root); | ||
423 | kfree(pi->name); | ||
424 | kfree(pi); | ||
425 | } | ||
426 | |||
483 | void __decode_pool(void **p, struct ceph_pg_pool_info *pi) | 427 | void __decode_pool(void **p, struct ceph_pg_pool_info *pi) |
484 | { | 428 | { |
485 | ceph_decode_copy(p, &pi->v, sizeof(pi->v)); | 429 | ceph_decode_copy(p, &pi->v, sizeof(pi->v)); |
@@ -488,6 +432,98 @@ void __decode_pool(void **p, struct ceph_pg_pool_info *pi) | |||
488 | *p += le32_to_cpu(pi->v.num_removed_snap_intervals) * sizeof(u64) * 2; | 432 | *p += le32_to_cpu(pi->v.num_removed_snap_intervals) * sizeof(u64) * 2; |
489 | } | 433 | } |
490 | 434 | ||
435 | static int __decode_pool_names(void **p, void *end, struct ceph_osdmap *map) | ||
436 | { | ||
437 | struct ceph_pg_pool_info *pi; | ||
438 | u32 num, len, pool; | ||
439 | |||
440 | ceph_decode_32_safe(p, end, num, bad); | ||
441 | dout(" %d pool names\n", num); | ||
442 | while (num--) { | ||
443 | ceph_decode_32_safe(p, end, pool, bad); | ||
444 | ceph_decode_32_safe(p, end, len, bad); | ||
445 | dout(" pool %d len %d\n", pool, len); | ||
446 | pi = __lookup_pg_pool(&map->pg_pools, pool); | ||
447 | if (pi) { | ||
448 | kfree(pi->name); | ||
449 | pi->name = kmalloc(len + 1, GFP_NOFS); | ||
450 | if (pi->name) { | ||
451 | memcpy(pi->name, *p, len); | ||
452 | pi->name[len] = '\0'; | ||
453 | dout(" name is %s\n", pi->name); | ||
454 | } | ||
455 | } | ||
456 | *p += len; | ||
457 | } | ||
458 | return 0; | ||
459 | |||
460 | bad: | ||
461 | return -EINVAL; | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | * osd map | ||
466 | */ | ||
467 | void ceph_osdmap_destroy(struct ceph_osdmap *map) | ||
468 | { | ||
469 | dout("osdmap_destroy %p\n", map); | ||
470 | if (map->crush) | ||
471 | crush_destroy(map->crush); | ||
472 | while (!RB_EMPTY_ROOT(&map->pg_temp)) { | ||
473 | struct ceph_pg_mapping *pg = | ||
474 | rb_entry(rb_first(&map->pg_temp), | ||
475 | struct ceph_pg_mapping, node); | ||
476 | rb_erase(&pg->node, &map->pg_temp); | ||
477 | kfree(pg); | ||
478 | } | ||
479 | while (!RB_EMPTY_ROOT(&map->pg_pools)) { | ||
480 | struct ceph_pg_pool_info *pi = | ||
481 | rb_entry(rb_first(&map->pg_pools), | ||
482 | struct ceph_pg_pool_info, node); | ||
483 | __remove_pg_pool(&map->pg_pools, pi); | ||
484 | } | ||
485 | kfree(map->osd_state); | ||
486 | kfree(map->osd_weight); | ||
487 | kfree(map->osd_addr); | ||
488 | kfree(map); | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * adjust max osd value. reallocate arrays. | ||
493 | */ | ||
494 | static int osdmap_set_max_osd(struct ceph_osdmap *map, int max) | ||
495 | { | ||
496 | u8 *state; | ||
497 | struct ceph_entity_addr *addr; | ||
498 | u32 *weight; | ||
499 | |||
500 | state = kcalloc(max, sizeof(*state), GFP_NOFS); | ||
501 | addr = kcalloc(max, sizeof(*addr), GFP_NOFS); | ||
502 | weight = kcalloc(max, sizeof(*weight), GFP_NOFS); | ||
503 | if (state == NULL || addr == NULL || weight == NULL) { | ||
504 | kfree(state); | ||
505 | kfree(addr); | ||
506 | kfree(weight); | ||
507 | return -ENOMEM; | ||
508 | } | ||
509 | |||
510 | /* copy old? */ | ||
511 | if (map->osd_state) { | ||
512 | memcpy(state, map->osd_state, map->max_osd*sizeof(*state)); | ||
513 | memcpy(addr, map->osd_addr, map->max_osd*sizeof(*addr)); | ||
514 | memcpy(weight, map->osd_weight, map->max_osd*sizeof(*weight)); | ||
515 | kfree(map->osd_state); | ||
516 | kfree(map->osd_addr); | ||
517 | kfree(map->osd_weight); | ||
518 | } | ||
519 | |||
520 | map->osd_state = state; | ||
521 | map->osd_weight = weight; | ||
522 | map->osd_addr = addr; | ||
523 | map->max_osd = max; | ||
524 | return 0; | ||
525 | } | ||
526 | |||
491 | /* | 527 | /* |
492 | * decode a full map. | 528 | * decode a full map. |
493 | */ | 529 | */ |
@@ -524,7 +560,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
524 | ceph_decode_32_safe(p, end, max, bad); | 560 | ceph_decode_32_safe(p, end, max, bad); |
525 | while (max--) { | 561 | while (max--) { |
526 | ceph_decode_need(p, end, 4 + 1 + sizeof(pi->v), bad); | 562 | ceph_decode_need(p, end, 4 + 1 + sizeof(pi->v), bad); |
527 | pi = kmalloc(sizeof(*pi), GFP_NOFS); | 563 | pi = kzalloc(sizeof(*pi), GFP_NOFS); |
528 | if (!pi) | 564 | if (!pi) |
529 | goto bad; | 565 | goto bad; |
530 | pi->id = ceph_decode_32(p); | 566 | pi->id = ceph_decode_32(p); |
@@ -537,6 +573,10 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | |||
537 | __decode_pool(p, pi); | 573 | __decode_pool(p, pi); |
538 | __insert_pg_pool(&map->pg_pools, pi); | 574 | __insert_pg_pool(&map->pg_pools, pi); |
539 | } | 575 | } |
576 | |||
577 | if (version >= 5 && __decode_pool_names(p, end, map) < 0) | ||
578 | goto bad; | ||
579 | |||
540 | ceph_decode_32_safe(p, end, map->pool_max, bad); | 580 | ceph_decode_32_safe(p, end, map->pool_max, bad); |
541 | 581 | ||
542 | ceph_decode_32_safe(p, end, map->flags, bad); | 582 | ceph_decode_32_safe(p, end, map->flags, bad); |
@@ -710,7 +750,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
710 | } | 750 | } |
711 | pi = __lookup_pg_pool(&map->pg_pools, pool); | 751 | pi = __lookup_pg_pool(&map->pg_pools, pool); |
712 | if (!pi) { | 752 | if (!pi) { |
713 | pi = kmalloc(sizeof(*pi), GFP_NOFS); | 753 | pi = kzalloc(sizeof(*pi), GFP_NOFS); |
714 | if (!pi) { | 754 | if (!pi) { |
715 | err = -ENOMEM; | 755 | err = -ENOMEM; |
716 | goto bad; | 756 | goto bad; |
@@ -720,6 +760,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
720 | } | 760 | } |
721 | __decode_pool(p, pi); | 761 | __decode_pool(p, pi); |
722 | } | 762 | } |
763 | if (version >= 5 && __decode_pool_names(p, end, map) < 0) | ||
764 | goto bad; | ||
723 | 765 | ||
724 | /* old_pool */ | 766 | /* old_pool */ |
725 | ceph_decode_32_safe(p, end, len, bad); | 767 | ceph_decode_32_safe(p, end, len, bad); |
@@ -728,10 +770,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | |||
728 | 770 | ||
729 | ceph_decode_32_safe(p, end, pool, bad); | 771 | ceph_decode_32_safe(p, end, pool, bad); |
730 | pi = __lookup_pg_pool(&map->pg_pools, pool); | 772 | pi = __lookup_pg_pool(&map->pg_pools, pool); |
731 | if (pi) { | 773 | if (pi) |
732 | rb_erase(&pi->node, &map->pg_pools); | 774 | __remove_pg_pool(&map->pg_pools, pi); |
733 | kfree(pi); | ||
734 | } | ||
735 | } | 775 | } |
736 | 776 | ||
737 | /* new_up */ | 777 | /* new_up */ |
diff --git a/fs/ceph/osdmap.h b/fs/ceph/osdmap.h index 1fb55afb2642..8bc9f1e4f562 100644 --- a/fs/ceph/osdmap.h +++ b/fs/ceph/osdmap.h | |||
@@ -23,6 +23,7 @@ struct ceph_pg_pool_info { | |||
23 | int id; | 23 | int id; |
24 | struct ceph_pg_pool v; | 24 | struct ceph_pg_pool v; |
25 | int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask; | 25 | int pg_num_mask, pgp_num_mask, lpg_num_mask, lpgp_num_mask; |
26 | char *name; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | struct ceph_pg_mapping { | 29 | struct ceph_pg_mapping { |
diff --git a/fs/ceph/pagelist.c b/fs/ceph/pagelist.c index 370e93695474..5f8dbf7c745a 100644 --- a/fs/ceph/pagelist.c +++ b/fs/ceph/pagelist.c | |||
@@ -1,4 +1,5 @@ | |||
1 | 1 | ||
2 | #include <linux/gfp.h> | ||
2 | #include <linux/pagemap.h> | 3 | #include <linux/pagemap.h> |
3 | #include <linux/highmem.h> | 4 | #include <linux/highmem.h> |
4 | 5 | ||
diff --git a/fs/ceph/rados.h b/fs/ceph/rados.h index 26ac8b89a676..a1fc1d017b58 100644 --- a/fs/ceph/rados.h +++ b/fs/ceph/rados.h | |||
@@ -11,8 +11,10 @@ | |||
11 | /* | 11 | /* |
12 | * osdmap encoding versions | 12 | * osdmap encoding versions |
13 | */ | 13 | */ |
14 | #define CEPH_OSDMAP_INC_VERSION 4 | 14 | #define CEPH_OSDMAP_INC_VERSION 5 |
15 | #define CEPH_OSDMAP_VERSION 4 | 15 | #define CEPH_OSDMAP_INC_VERSION_EXT 5 |
16 | #define CEPH_OSDMAP_VERSION 5 | ||
17 | #define CEPH_OSDMAP_VERSION_EXT 5 | ||
16 | 18 | ||
17 | /* | 19 | /* |
18 | * fs id | 20 | * fs id |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index df04e210a055..2b881262ef67 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "ceph_debug.h" | 1 | #include "ceph_debug.h" |
2 | 2 | ||
3 | #include <linux/sort.h> | 3 | #include <linux/sort.h> |
4 | #include <linux/slab.h> | ||
4 | 5 | ||
5 | #include "super.h" | 6 | #include "super.h" |
6 | #include "decode.h" | 7 | #include "decode.h" |
@@ -430,8 +431,7 @@ static int dup_array(u64 **dst, __le64 *src, int num) | |||
430 | * Caller must hold snap_rwsem for read (i.e., the realm topology won't | 431 | * Caller must hold snap_rwsem for read (i.e., the realm topology won't |
431 | * change). | 432 | * change). |
432 | */ | 433 | */ |
433 | void ceph_queue_cap_snap(struct ceph_inode_info *ci, | 434 | void ceph_queue_cap_snap(struct ceph_inode_info *ci) |
434 | struct ceph_snap_context *snapc) | ||
435 | { | 435 | { |
436 | struct inode *inode = &ci->vfs_inode; | 436 | struct inode *inode = &ci->vfs_inode; |
437 | struct ceph_cap_snap *capsnap; | 437 | struct ceph_cap_snap *capsnap; |
@@ -450,10 +450,11 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci, | |||
450 | as no new writes are allowed to start when pending, so any | 450 | as no new writes are allowed to start when pending, so any |
451 | writes in progress now were started before the previous | 451 | writes in progress now were started before the previous |
452 | cap_snap. lucky us. */ | 452 | cap_snap. lucky us. */ |
453 | dout("queue_cap_snap %p snapc %p seq %llu used %d" | 453 | dout("queue_cap_snap %p already pending\n", inode); |
454 | " already pending\n", inode, snapc, snapc->seq, used); | ||
455 | kfree(capsnap); | 454 | kfree(capsnap); |
456 | } else if (ci->i_wrbuffer_ref_head || (used & CEPH_CAP_FILE_WR)) { | 455 | } else if (ci->i_wrbuffer_ref_head || (used & CEPH_CAP_FILE_WR)) { |
456 | struct ceph_snap_context *snapc = ci->i_head_snapc; | ||
457 | |||
457 | igrab(inode); | 458 | igrab(inode); |
458 | 459 | ||
459 | atomic_set(&capsnap->nref, 1); | 460 | atomic_set(&capsnap->nref, 1); |
@@ -462,7 +463,6 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci, | |||
462 | INIT_LIST_HEAD(&capsnap->flushing_item); | 463 | INIT_LIST_HEAD(&capsnap->flushing_item); |
463 | 464 | ||
464 | capsnap->follows = snapc->seq - 1; | 465 | capsnap->follows = snapc->seq - 1; |
465 | capsnap->context = ceph_get_snap_context(snapc); | ||
466 | capsnap->issued = __ceph_caps_issued(ci, NULL); | 466 | capsnap->issued = __ceph_caps_issued(ci, NULL); |
467 | capsnap->dirty = __ceph_caps_dirty(ci); | 467 | capsnap->dirty = __ceph_caps_dirty(ci); |
468 | 468 | ||
@@ -479,7 +479,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci, | |||
479 | snapshot. */ | 479 | snapshot. */ |
480 | capsnap->dirty_pages = ci->i_wrbuffer_ref_head; | 480 | capsnap->dirty_pages = ci->i_wrbuffer_ref_head; |
481 | ci->i_wrbuffer_ref_head = 0; | 481 | ci->i_wrbuffer_ref_head = 0; |
482 | ceph_put_snap_context(ci->i_head_snapc); | 482 | capsnap->context = snapc; |
483 | ci->i_head_snapc = NULL; | 483 | ci->i_head_snapc = NULL; |
484 | list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps); | 484 | list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps); |
485 | 485 | ||
@@ -521,15 +521,17 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci, | |||
521 | capsnap->ctime = inode->i_ctime; | 521 | capsnap->ctime = inode->i_ctime; |
522 | capsnap->time_warp_seq = ci->i_time_warp_seq; | 522 | capsnap->time_warp_seq = ci->i_time_warp_seq; |
523 | if (capsnap->dirty_pages) { | 523 | if (capsnap->dirty_pages) { |
524 | dout("finish_cap_snap %p cap_snap %p snapc %p %llu s=%llu " | 524 | dout("finish_cap_snap %p cap_snap %p snapc %p %llu %s s=%llu " |
525 | "still has %d dirty pages\n", inode, capsnap, | 525 | "still has %d dirty pages\n", inode, capsnap, |
526 | capsnap->context, capsnap->context->seq, | 526 | capsnap->context, capsnap->context->seq, |
527 | capsnap->size, capsnap->dirty_pages); | 527 | ceph_cap_string(capsnap->dirty), capsnap->size, |
528 | capsnap->dirty_pages); | ||
528 | return 0; | 529 | return 0; |
529 | } | 530 | } |
530 | dout("finish_cap_snap %p cap_snap %p snapc %p %llu s=%llu clean\n", | 531 | dout("finish_cap_snap %p cap_snap %p snapc %p %llu %s s=%llu\n", |
531 | inode, capsnap, capsnap->context, | 532 | inode, capsnap, capsnap->context, |
532 | capsnap->context->seq, capsnap->size); | 533 | capsnap->context->seq, ceph_cap_string(capsnap->dirty), |
534 | capsnap->size); | ||
533 | 535 | ||
534 | spin_lock(&mdsc->snap_flush_lock); | 536 | spin_lock(&mdsc->snap_flush_lock); |
535 | list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); | 537 | list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); |
@@ -601,7 +603,7 @@ more: | |||
601 | if (lastinode) | 603 | if (lastinode) |
602 | iput(lastinode); | 604 | iput(lastinode); |
603 | lastinode = inode; | 605 | lastinode = inode; |
604 | ceph_queue_cap_snap(ci, realm->cached_context); | 606 | ceph_queue_cap_snap(ci); |
605 | spin_lock(&realm->inodes_with_caps_lock); | 607 | spin_lock(&realm->inodes_with_caps_lock); |
606 | } | 608 | } |
607 | spin_unlock(&realm->inodes_with_caps_lock); | 609 | spin_unlock(&realm->inodes_with_caps_lock); |
@@ -823,8 +825,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
823 | spin_unlock(&realm->inodes_with_caps_lock); | 825 | spin_unlock(&realm->inodes_with_caps_lock); |
824 | spin_unlock(&inode->i_lock); | 826 | spin_unlock(&inode->i_lock); |
825 | 827 | ||
826 | ceph_queue_cap_snap(ci, | 828 | ceph_queue_cap_snap(ci); |
827 | ci->i_snap_realm->cached_context); | ||
828 | 829 | ||
829 | iput(inode); | 830 | iput(inode); |
830 | continue; | 831 | continue; |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 4290a6e860b0..75d02eaa1279 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/rwsem.h> | 11 | #include <linux/rwsem.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/seq_file.h> | 13 | #include <linux/seq_file.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/statfs.h> | 15 | #include <linux/statfs.h> |
15 | #include <linux/string.h> | 16 | #include <linux/string.h> |
16 | #include <linux/version.h> | 17 | #include <linux/version.h> |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 65d12036b670..e30dfbb056c3 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/wait.h> | 13 | #include <linux/wait.h> |
14 | #include <linux/writeback.h> | 14 | #include <linux/writeback.h> |
15 | #include <linux/slab.h> | ||
15 | 16 | ||
16 | #include "types.h" | 17 | #include "types.h" |
17 | #include "messenger.h" | 18 | #include "messenger.h" |
@@ -714,8 +715,7 @@ extern int ceph_update_snap_trace(struct ceph_mds_client *m, | |||
714 | extern void ceph_handle_snap(struct ceph_mds_client *mdsc, | 715 | extern void ceph_handle_snap(struct ceph_mds_client *mdsc, |
715 | struct ceph_mds_session *session, | 716 | struct ceph_mds_session *session, |
716 | struct ceph_msg *msg); | 717 | struct ceph_msg *msg); |
717 | extern void ceph_queue_cap_snap(struct ceph_inode_info *ci, | 718 | extern void ceph_queue_cap_snap(struct ceph_inode_info *ci); |
718 | struct ceph_snap_context *snapc); | ||
719 | extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci, | 719 | extern int __ceph_finish_cap_snap(struct ceph_inode_info *ci, |
720 | struct ceph_cap_snap *capsnap); | 720 | struct ceph_cap_snap *capsnap); |
721 | extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc); | 721 | extern void ceph_cleanup_empty_realms(struct ceph_mds_client *mdsc); |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 37d6ce645691..2845422907fc 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "decode.h" | 3 | #include "decode.h" |
4 | 4 | ||
5 | #include <linux/xattr.h> | 5 | #include <linux/xattr.h> |
6 | #include <linux/slab.h> | ||
6 | 7 | ||
7 | static bool ceph_is_valid_xattr(const char *name) | 8 | static bool ceph_is_valid_xattr(const char *name) |
8 | { | 9 | { |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index b1d61d0bdfc7..78e4d2a3a68b 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/dcache.h> | 15 | #include <linux/dcache.h> |
16 | #include <linux/mount.h> | 16 | #include <linux/mount.h> |
17 | #include <linux/namei.h> | 17 | #include <linux/namei.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/vfs.h> | 19 | #include <linux/vfs.h> |
19 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
20 | #include "cifsglob.h" | 21 | #include "cifsglob.h" |
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 8ec7736ce954..310d12f69a92 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/string.h> | 24 | #include <linux/string.h> |
24 | #include <keys/user-type.h> | 25 | #include <keys/user-type.h> |
25 | #include <linux/key-type.h> | 26 | #include <linux/key-type.h> |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 714a542cbafc..d07676bd76d2 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/slab.h> | ||
22 | #include "cifs_unicode.h" | 23 | #include "cifs_unicode.h" |
23 | #include "cifs_uniupr.h" | 24 | #include "cifs_uniupr.h" |
24 | #include "cifspdu.h" | 25 | #include "cifspdu.h" |
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 7dfe0842a6f6..9b716d044bbd 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/slab.h> | ||
25 | #include "cifspdu.h" | 26 | #include "cifspdu.h" |
26 | #include "cifsglob.h" | 27 | #include "cifsglob.h" |
27 | #include "cifsacl.h" | 28 | #include "cifsacl.h" |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 7efe1745494d..fbe986430d0c 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
23 | #include <linux/slab.h> | ||
23 | #include "cifspdu.h" | 24 | #include "cifspdu.h" |
24 | #include "cifsglob.h" | 25 | #include "cifsglob.h" |
25 | #include "cifs_debug.h" | 26 | #include "cifs_debug.h" |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 5183bc2a1916..ded66be6597c 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -808,6 +808,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = { | |||
808 | .release = cifs_close, | 808 | .release = cifs_close, |
809 | .fsync = cifs_fsync, | 809 | .fsync = cifs_fsync, |
810 | .flush = cifs_flush, | 810 | .flush = cifs_flush, |
811 | .mmap = cifs_file_mmap, | ||
811 | .splice_read = generic_file_splice_read, | 812 | .splice_read = generic_file_splice_read, |
812 | #ifdef CONFIG_CIFS_POSIX | 813 | #ifdef CONFIG_CIFS_POSIX |
813 | .unlocked_ioctl = cifs_ioctl, | 814 | .unlocked_ioctl = cifs_ioctl, |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 63c89d1d70b5..ecf0ffbe2b64 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #include <linux/in.h> | 19 | #include <linux/in.h> |
20 | #include <linux/in6.h> | 20 | #include <linux/in6.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/slow-work.h> | 22 | #include <linux/slow-work.h> |
22 | #include "cifs_fs_sb.h" | 23 | #include "cifs_fs_sb.h" |
23 | #include "cifsacl.h" | 24 | #include "cifsacl.h" |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 7cc7f83e9314..5d3f29fef532 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/vfs.h> | 32 | #include <linux/vfs.h> |
33 | #include <linux/slab.h> | ||
33 | #include <linux/posix_acl_xattr.h> | 34 | #include <linux/posix_acl_xattr.h> |
34 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
35 | #include "cifspdu.h" | 36 | #include "cifspdu.h" |
@@ -1430,6 +1431,8 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
1430 | __u32 bytes_sent; | 1431 | __u32 bytes_sent; |
1431 | __u16 byte_count; | 1432 | __u16 byte_count; |
1432 | 1433 | ||
1434 | *nbytes = 0; | ||
1435 | |||
1433 | /* cFYI(1, ("write at %lld %d bytes", offset, count));*/ | 1436 | /* cFYI(1, ("write at %lld %d bytes", offset, count));*/ |
1434 | if (tcon->ses == NULL) | 1437 | if (tcon->ses == NULL) |
1435 | return -ECONNABORTED; | 1438 | return -ECONNABORTED; |
@@ -1512,11 +1515,18 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
1512 | cifs_stats_inc(&tcon->num_writes); | 1515 | cifs_stats_inc(&tcon->num_writes); |
1513 | if (rc) { | 1516 | if (rc) { |
1514 | cFYI(1, ("Send error in write = %d", rc)); | 1517 | cFYI(1, ("Send error in write = %d", rc)); |
1515 | *nbytes = 0; | ||
1516 | } else { | 1518 | } else { |
1517 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | 1519 | *nbytes = le16_to_cpu(pSMBr->CountHigh); |
1518 | *nbytes = (*nbytes) << 16; | 1520 | *nbytes = (*nbytes) << 16; |
1519 | *nbytes += le16_to_cpu(pSMBr->Count); | 1521 | *nbytes += le16_to_cpu(pSMBr->Count); |
1522 | |||
1523 | /* | ||
1524 | * Mask off high 16 bits when bytes written as returned by the | ||
1525 | * server is greater than bytes requested by the client. Some | ||
1526 | * OS/2 servers are known to set incorrect CountHigh values. | ||
1527 | */ | ||
1528 | if (*nbytes > count) | ||
1529 | *nbytes &= 0xFFFF; | ||
1520 | } | 1530 | } |
1521 | 1531 | ||
1522 | cifs_buf_release(pSMB); | 1532 | cifs_buf_release(pSMB); |
@@ -1605,6 +1615,14 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1605 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | 1615 | *nbytes = le16_to_cpu(pSMBr->CountHigh); |
1606 | *nbytes = (*nbytes) << 16; | 1616 | *nbytes = (*nbytes) << 16; |
1607 | *nbytes += le16_to_cpu(pSMBr->Count); | 1617 | *nbytes += le16_to_cpu(pSMBr->Count); |
1618 | |||
1619 | /* | ||
1620 | * Mask off high 16 bits when bytes written as returned by the | ||
1621 | * server is greater than bytes requested by the client. OS/2 | ||
1622 | * servers are known to set incorrect CountHigh values. | ||
1623 | */ | ||
1624 | if (*nbytes > count) | ||
1625 | *nbytes &= 0xFFFF; | ||
1608 | } | 1626 | } |
1609 | 1627 | ||
1610 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ | 1628 | /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ |
@@ -1793,8 +1811,21 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1793 | } | 1811 | } |
1794 | parm_data = (struct cifs_posix_lock *) | 1812 | parm_data = (struct cifs_posix_lock *) |
1795 | ((char *)&pSMBr->hdr.Protocol + data_offset); | 1813 | ((char *)&pSMBr->hdr.Protocol + data_offset); |
1796 | if (parm_data->lock_type == cpu_to_le16(CIFS_UNLCK)) | 1814 | if (parm_data->lock_type == __constant_cpu_to_le16(CIFS_UNLCK)) |
1797 | pLockData->fl_type = F_UNLCK; | 1815 | pLockData->fl_type = F_UNLCK; |
1816 | else { | ||
1817 | if (parm_data->lock_type == | ||
1818 | __constant_cpu_to_le16(CIFS_RDLCK)) | ||
1819 | pLockData->fl_type = F_RDLCK; | ||
1820 | else if (parm_data->lock_type == | ||
1821 | __constant_cpu_to_le16(CIFS_WRLCK)) | ||
1822 | pLockData->fl_type = F_WRLCK; | ||
1823 | |||
1824 | pLockData->fl_start = parm_data->start; | ||
1825 | pLockData->fl_end = parm_data->start + | ||
1826 | parm_data->length - 1; | ||
1827 | pLockData->fl_pid = parm_data->pid; | ||
1828 | } | ||
1798 | } | 1829 | } |
1799 | 1830 | ||
1800 | plk_err_exit: | 1831 | plk_err_exit: |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 45eb6cba793f..d9566bf8f917 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/slab.h> | ||
26 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
27 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
28 | #include <linux/utsname.h> | 29 | #include <linux/utsname.h> |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 87948147d7ec..6f8a0e3fb25b 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/slab.h> | ||
26 | #include <keys/user-type.h> | 27 | #include <keys/user-type.h> |
27 | #include "dns_resolve.h" | 28 | #include "dns_resolve.h" |
28 | #include "cifsglob.h" | 29 | #include "cifsglob.h" |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ca2ba7a0193c..9b11a8f56f3a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/task_io_accounting_ops.h> | 31 | #include <linux/task_io_accounting_ops.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/mount.h> | 33 | #include <linux/mount.h> |
34 | #include <linux/slab.h> | ||
34 | #include <asm/div64.h> | 35 | #include <asm/div64.h> |
35 | #include "cifsfs.h" | 36 | #include "cifsfs.h" |
36 | #include "cifspdu.h" | 37 | #include "cifspdu.h" |
@@ -838,8 +839,32 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
838 | 839 | ||
839 | } else { | 840 | } else { |
840 | /* if rc == ERR_SHARING_VIOLATION ? */ | 841 | /* if rc == ERR_SHARING_VIOLATION ? */ |
841 | rc = 0; /* do not change lock type to unlock | 842 | rc = 0; |
842 | since range in use */ | 843 | |
844 | if (lockType & LOCKING_ANDX_SHARED_LOCK) { | ||
845 | pfLock->fl_type = F_WRLCK; | ||
846 | } else { | ||
847 | rc = CIFSSMBLock(xid, tcon, netfid, length, | ||
848 | pfLock->fl_start, 0, 1, | ||
849 | lockType | LOCKING_ANDX_SHARED_LOCK, | ||
850 | 0 /* wait flag */); | ||
851 | if (rc == 0) { | ||
852 | rc = CIFSSMBLock(xid, tcon, netfid, | ||
853 | length, pfLock->fl_start, 1, 0, | ||
854 | lockType | | ||
855 | LOCKING_ANDX_SHARED_LOCK, | ||
856 | 0 /* wait flag */); | ||
857 | pfLock->fl_type = F_RDLCK; | ||
858 | if (rc != 0) | ||
859 | cERROR(1, ("Error unlocking " | ||
860 | "previously locked range %d " | ||
861 | "during test of lock", rc)); | ||
862 | rc = 0; | ||
863 | } else { | ||
864 | pfLock->fl_type = F_WRLCK; | ||
865 | rc = 0; | ||
866 | } | ||
867 | } | ||
843 | } | 868 | } |
844 | 869 | ||
845 | FreeXid(xid); | 870 | FreeXid(xid); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 723daaccbd0e..35ec11716213 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/stat.h> | 22 | #include <linux/stat.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
24 | #include <asm/div64.h> | 25 | #include <asm/div64.h> |
25 | #include "cifsfs.h" | 26 | #include "cifsfs.h" |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index fc1e0487eaee..c1a9d4236a8c 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/stat.h> | 22 | #include <linux/stat.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/namei.h> | 24 | #include <linux/namei.h> |
24 | #include "cifsfs.h" | 25 | #include "cifsfs.h" |
25 | #include "cifspdu.h" | 26 | #include "cifspdu.h" |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index c343b14ba2d3..18e0bc1fb593 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
24 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/stat.h> | 26 | #include <linux/stat.h> |
26 | #include "cifspdu.h" | 27 | #include "cifspdu.h" |
27 | #include "cifsglob.h" | 28 | #include "cifsglob.h" |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index aaa9c1c5a5bd..7c3fd7463f44 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "ntlmssp.h" | 29 | #include "ntlmssp.h" |
30 | #include "nterr.h" | 30 | #include "nterr.h" |
31 | #include <linux/utsname.h> | 31 | #include <linux/utsname.h> |
32 | #include <linux/slab.h> | ||
32 | #include "cifs_spnego.h" | 33 | #include "cifs_spnego.h" |
33 | 34 | ||
34 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 35 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 93fb09a99c69..192ea51af20f 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
28 | #include <linux/string.h> | 29 | #include <linux/string.h> |
29 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 07b8e71544ee..ad081fe7eb18 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/gfp.h> | ||
25 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
26 | #include <linux/net.h> | 27 | #include <linux/net.h> |
27 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 3e2ef0de1209..f555ce077d4f 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
23 | #include <linux/posix_acl_xattr.h> | 23 | #include <linux/posix_acl_xattr.h> |
24 | #include <linux/slab.h> | ||
24 | #include "cifsfs.h" | 25 | #include "cifsfs.h" |
25 | #include "cifspdu.h" | 26 | #include "cifspdu.h" |
26 | #include "cifsglob.h" | 27 | #include "cifsglob.h" |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 4bb9d0a5decc..ccd98b0f2b0b 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/file.h> | 16 | #include <linux/file.h> |
16 | #include <linux/stat.h> | 17 | #include <linux/stat.h> |
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
diff --git a/fs/coda/file.c b/fs/coda/file.c index ffd42815fda1..4c813f2cdc52 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/smp_lock.h> | 18 | #include <linux/smp_lock.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | #include <linux/slab.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | 22 | ||
22 | #include <linux/coda.h> | 23 | #include <linux/coda.h> |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 830f51abb971..a1695dcadd99 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/smp_lock.h> | 18 | #include <linux/smp_lock.h> |
19 | #include <linux/file.h> | 19 | #include <linux/file.h> |
20 | #include <linux/vfs.h> | 20 | #include <linux/vfs.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index c274d949179d..f09c5ed76f6c 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/stat.h> | 26 | #include <linux/stat.h> |
27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/slab.h> | ||
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
31 | #include <linux/vfs.h> | 32 | #include <linux/vfs.h> |
diff --git a/fs/compat.c b/fs/compat.c index 030602d453b7..4b6ed03cc478 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/mm.h> | 49 | #include <linux/mm.h> |
50 | #include <linux/eventpoll.h> | 50 | #include <linux/eventpoll.h> |
51 | #include <linux/fs_struct.h> | 51 | #include <linux/fs_struct.h> |
52 | #include <linux/slab.h> | ||
52 | 53 | ||
53 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
54 | #include <asm/mmu_context.h> | 55 | #include <asm/mmu_context.h> |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 6d55b61bfa79..c32a1b6a856b 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/ioctl.h> | 23 | #include <linux/ioctl.h> |
24 | #include <linux/if.h> | 24 | #include <linux/if.h> |
25 | #include <linux/if_bridge.h> | 25 | #include <linux/if_bridge.h> |
26 | #include <linux/slab.h> | ||
27 | #include <linux/raid/md_u.h> | 26 | #include <linux/raid/md_u.h> |
28 | #include <linux/kd.h> | 27 | #include <linux/kd.h> |
29 | #include <linux/route.h> | 28 | #include <linux/route.h> |
@@ -60,6 +59,7 @@ | |||
60 | #include <linux/i2c.h> | 59 | #include <linux/i2c.h> |
61 | #include <linux/i2c-dev.h> | 60 | #include <linux/i2c-dev.h> |
62 | #include <linux/atalk.h> | 61 | #include <linux/atalk.h> |
62 | #include <linux/gfp.h> | ||
63 | 63 | ||
64 | #include <net/bluetooth/bluetooth.h> | 64 | #include <net/bluetooth/bluetooth.h> |
65 | #include <net/bluetooth/hci.h> | 65 | #include <net/bluetooth/hci.h> |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index a2f746066c5d..c8af2d91174b 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/capability.h> | 34 | #include <linux/capability.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/lockdep.h> | 36 | #include <linux/lockdep.h> |
37 | #include <linux/slab.h> | ||
37 | 38 | ||
38 | #include <linux/configfs.h> | 39 | #include <linux/configfs.h> |
39 | #include "configfs_internal.h" | 40 | #include "configfs_internal.h" |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 8421cea7d8c7..8c8d64230c2d 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mount.h> | 29 | #include <linux/mount.h> |
30 | #include <linux/pagemap.h> | 30 | #include <linux/pagemap.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | #include <linux/configfs.h> | 34 | #include <linux/configfs.h> |
34 | #include "configfs_internal.h" | 35 | #include "configfs_internal.h" |
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index 32a5f46b1157..0f3eb41d9201 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include <linux/configfs.h> | 32 | #include <linux/configfs.h> |
32 | #include "configfs_internal.h" | 33 | #include "configfs_internal.h" |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 049d6c36da09..30a87b3dbcac 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fsnotify.h> | 27 | #include <linux/fsnotify.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/magic.h> | 29 | #include <linux/magic.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | static struct vfsmount *debugfs_mount; | 32 | static struct vfsmount *debugfs_mount; |
32 | static int debugfs_mount_count; | 33 | static int debugfs_mount_count; |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 8882ecc0f1bf..0120247b41c0 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/namei.h> | 17 | #include <linux/namei.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
19 | #include <linux/tty.h> | 20 | #include <linux/tty.h> |
20 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 0df243850818..b54bca03d92f 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/configfs.h> | 16 | #include <linux/configfs.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/in.h> | 18 | #include <linux/in.h> |
18 | #include <linux/in6.h> | 19 | #include <linux/in6.h> |
19 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 29d6139c35fc..c6cf25158746 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/debugfs.h> | 17 | #include <linux/debugfs.h> |
18 | #include <linux/slab.h> | ||
18 | 19 | ||
19 | #include "dlm_internal.h" | 20 | #include "dlm_internal.h" |
20 | #include "lock.h" | 21 | #include "lock.h" |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 46ffd3eeaaf7..17903b491298 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -56,6 +56,7 @@ | |||
56 | L: receive_xxxx_reply() <- R: send_xxxx_reply() | 56 | L: receive_xxxx_reply() <- R: send_xxxx_reply() |
57 | */ | 57 | */ |
58 | #include <linux/types.h> | 58 | #include <linux/types.h> |
59 | #include <linux/slab.h> | ||
59 | #include "dlm_internal.h" | 60 | #include "dlm_internal.h" |
60 | #include <linux/dlm_device.h> | 61 | #include <linux/dlm_device.h> |
61 | #include "memory.h" | 62 | #include "memory.h" |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 52cab160893c..c0d35c620526 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/file.h> | 51 | #include <linux/file.h> |
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | #include <linux/sctp.h> | 53 | #include <linux/sctp.h> |
54 | #include <linux/slab.h> | ||
54 | #include <net/sctp/user.h> | 55 | #include <net/sctp/user.h> |
55 | #include <net/ipv6.h> | 56 | #include <net/ipv6.h> |
56 | 57 | ||
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 052095cd592f..2c6ad518100d 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <net/genetlink.h> | 9 | #include <net/genetlink.h> |
10 | #include <linux/dlm.h> | 10 | #include <linux/dlm.h> |
11 | #include <linux/dlm_netlink.h> | 11 | #include <linux/dlm_netlink.h> |
12 | #include <linux/gfp.h> | ||
12 | 13 | ||
13 | #include "dlm_internal.h" | 14 | #include "dlm_internal.h" |
14 | 15 | ||
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index b5f89aef3b29..d45c02db6943 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/poll.h> | 11 | #include <linux/poll.h> |
12 | #include <linux/dlm.h> | 12 | #include <linux/dlm.h> |
13 | #include <linux/dlm_plock.h> | 13 | #include <linux/dlm_plock.h> |
14 | #include <linux/slab.h> | ||
14 | 15 | ||
15 | #include "dlm_internal.h" | 16 | #include "dlm_internal.h" |
16 | #include "lockspace.h" | 17 | #include "lockspace.h" |
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index a4bfd31ac45b..8b6e73c47435 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <linux/dlm.h> | 18 | #include <linux/dlm.h> |
19 | #include <linux/dlm_device.h> | 19 | #include <linux/dlm_device.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #include "dlm_internal.h" | 22 | #include "dlm_internal.h" |
22 | #include "lockspace.h" | 23 | #include "lockspace.h" |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 7cb0a59f4b9d..1cc087635a5e 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/crypto.h> | 33 | #include <linux/crypto.h> |
34 | #include <linux/file.h> | 34 | #include <linux/file.h> |
35 | #include <linux/scatterlist.h> | 35 | #include <linux/scatterlist.h> |
36 | #include <linux/slab.h> | ||
36 | #include <asm/unaligned.h> | 37 | #include <asm/unaligned.h> |
37 | #include "ecryptfs_kernel.h" | 38 | #include "ecryptfs_kernel.h" |
38 | 39 | ||
@@ -381,8 +382,8 @@ out: | |||
381 | static void ecryptfs_lower_offset_for_extent(loff_t *offset, loff_t extent_num, | 382 | static void ecryptfs_lower_offset_for_extent(loff_t *offset, loff_t extent_num, |
382 | struct ecryptfs_crypt_stat *crypt_stat) | 383 | struct ecryptfs_crypt_stat *crypt_stat) |
383 | { | 384 | { |
384 | (*offset) = (crypt_stat->num_header_bytes_at_front | 385 | (*offset) = ecryptfs_lower_header_size(crypt_stat) |
385 | + (crypt_stat->extent_size * extent_num)); | 386 | + (crypt_stat->extent_size * extent_num); |
386 | } | 387 | } |
387 | 388 | ||
388 | /** | 389 | /** |
@@ -834,13 +835,13 @@ void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat) | |||
834 | set_extent_mask_and_shift(crypt_stat); | 835 | set_extent_mask_and_shift(crypt_stat); |
835 | crypt_stat->iv_bytes = ECRYPTFS_DEFAULT_IV_BYTES; | 836 | crypt_stat->iv_bytes = ECRYPTFS_DEFAULT_IV_BYTES; |
836 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | 837 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) |
837 | crypt_stat->num_header_bytes_at_front = 0; | 838 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
838 | else { | 839 | else { |
839 | if (PAGE_CACHE_SIZE <= ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) | 840 | if (PAGE_CACHE_SIZE <= ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE) |
840 | crypt_stat->num_header_bytes_at_front = | 841 | crypt_stat->metadata_size = |
841 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | 842 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
842 | else | 843 | else |
843 | crypt_stat->num_header_bytes_at_front = PAGE_CACHE_SIZE; | 844 | crypt_stat->metadata_size = PAGE_CACHE_SIZE; |
844 | } | 845 | } |
845 | } | 846 | } |
846 | 847 | ||
@@ -1107,9 +1108,9 @@ static void write_ecryptfs_marker(char *page_virt, size_t *written) | |||
1107 | (*written) = MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; | 1108 | (*written) = MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; |
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | static void | 1111 | void ecryptfs_write_crypt_stat_flags(char *page_virt, |
1111 | write_ecryptfs_flags(char *page_virt, struct ecryptfs_crypt_stat *crypt_stat, | 1112 | struct ecryptfs_crypt_stat *crypt_stat, |
1112 | size_t *written) | 1113 | size_t *written) |
1113 | { | 1114 | { |
1114 | u32 flags = 0; | 1115 | u32 flags = 0; |
1115 | int i; | 1116 | int i; |
@@ -1237,8 +1238,7 @@ ecryptfs_write_header_metadata(char *virt, | |||
1237 | 1238 | ||
1238 | header_extent_size = (u32)crypt_stat->extent_size; | 1239 | header_extent_size = (u32)crypt_stat->extent_size; |
1239 | num_header_extents_at_front = | 1240 | num_header_extents_at_front = |
1240 | (u16)(crypt_stat->num_header_bytes_at_front | 1241 | (u16)(crypt_stat->metadata_size / crypt_stat->extent_size); |
1241 | / crypt_stat->extent_size); | ||
1242 | put_unaligned_be32(header_extent_size, virt); | 1242 | put_unaligned_be32(header_extent_size, virt); |
1243 | virt += 4; | 1243 | virt += 4; |
1244 | put_unaligned_be16(num_header_extents_at_front, virt); | 1244 | put_unaligned_be16(num_header_extents_at_front, virt); |
@@ -1291,7 +1291,8 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t max, | |||
1291 | offset = ECRYPTFS_FILE_SIZE_BYTES; | 1291 | offset = ECRYPTFS_FILE_SIZE_BYTES; |
1292 | write_ecryptfs_marker((page_virt + offset), &written); | 1292 | write_ecryptfs_marker((page_virt + offset), &written); |
1293 | offset += written; | 1293 | offset += written; |
1294 | write_ecryptfs_flags((page_virt + offset), crypt_stat, &written); | 1294 | ecryptfs_write_crypt_stat_flags((page_virt + offset), crypt_stat, |
1295 | &written); | ||
1295 | offset += written; | 1296 | offset += written; |
1296 | ecryptfs_write_header_metadata((page_virt + offset), crypt_stat, | 1297 | ecryptfs_write_header_metadata((page_virt + offset), crypt_stat, |
1297 | &written); | 1298 | &written); |
@@ -1381,7 +1382,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | |||
1381 | rc = -EINVAL; | 1382 | rc = -EINVAL; |
1382 | goto out; | 1383 | goto out; |
1383 | } | 1384 | } |
1384 | virt_len = crypt_stat->num_header_bytes_at_front; | 1385 | virt_len = crypt_stat->metadata_size; |
1385 | order = get_order(virt_len); | 1386 | order = get_order(virt_len); |
1386 | /* Released in this function */ | 1387 | /* Released in this function */ |
1387 | virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order); | 1388 | virt = (char *)ecryptfs_get_zeroed_pages(GFP_KERNEL, order); |
@@ -1427,16 +1428,15 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat, | |||
1427 | header_extent_size = get_unaligned_be32(virt); | 1428 | header_extent_size = get_unaligned_be32(virt); |
1428 | virt += sizeof(__be32); | 1429 | virt += sizeof(__be32); |
1429 | num_header_extents_at_front = get_unaligned_be16(virt); | 1430 | num_header_extents_at_front = get_unaligned_be16(virt); |
1430 | crypt_stat->num_header_bytes_at_front = | 1431 | crypt_stat->metadata_size = (((size_t)num_header_extents_at_front |
1431 | (((size_t)num_header_extents_at_front | 1432 | * (size_t)header_extent_size)); |
1432 | * (size_t)header_extent_size)); | ||
1433 | (*bytes_read) = (sizeof(__be32) + sizeof(__be16)); | 1433 | (*bytes_read) = (sizeof(__be32) + sizeof(__be16)); |
1434 | if ((validate_header_size == ECRYPTFS_VALIDATE_HEADER_SIZE) | 1434 | if ((validate_header_size == ECRYPTFS_VALIDATE_HEADER_SIZE) |
1435 | && (crypt_stat->num_header_bytes_at_front | 1435 | && (crypt_stat->metadata_size |
1436 | < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) { | 1436 | < ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE)) { |
1437 | rc = -EINVAL; | 1437 | rc = -EINVAL; |
1438 | printk(KERN_WARNING "Invalid header size: [%zd]\n", | 1438 | printk(KERN_WARNING "Invalid header size: [%zd]\n", |
1439 | crypt_stat->num_header_bytes_at_front); | 1439 | crypt_stat->metadata_size); |
1440 | } | 1440 | } |
1441 | return rc; | 1441 | return rc; |
1442 | } | 1442 | } |
@@ -1451,8 +1451,7 @@ static int parse_header_metadata(struct ecryptfs_crypt_stat *crypt_stat, | |||
1451 | */ | 1451 | */ |
1452 | static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) | 1452 | static void set_default_header_data(struct ecryptfs_crypt_stat *crypt_stat) |
1453 | { | 1453 | { |
1454 | crypt_stat->num_header_bytes_at_front = | 1454 | crypt_stat->metadata_size = ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; |
1455 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | ||
1456 | } | 1455 | } |
1457 | 1456 | ||
1458 | /** | 1457 | /** |
@@ -1606,6 +1605,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry) | |||
1606 | ecryptfs_dentry, | 1605 | ecryptfs_dentry, |
1607 | ECRYPTFS_VALIDATE_HEADER_SIZE); | 1606 | ECRYPTFS_VALIDATE_HEADER_SIZE); |
1608 | if (rc) { | 1607 | if (rc) { |
1608 | memset(page_virt, 0, PAGE_CACHE_SIZE); | ||
1609 | rc = ecryptfs_read_xattr_region(page_virt, ecryptfs_inode); | 1609 | rc = ecryptfs_read_xattr_region(page_virt, ecryptfs_inode); |
1610 | if (rc) { | 1610 | if (rc) { |
1611 | printk(KERN_DEBUG "Valid eCryptfs headers not found in " | 1611 | printk(KERN_DEBUG "Valid eCryptfs headers not found in " |
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 8f006a0d6076..906e803f7f79 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/namei.h> | 26 | #include <linux/namei.h> |
27 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
28 | #include <linux/fs_stack.h> | 28 | #include <linux/fs_stack.h> |
29 | #include <linux/slab.h> | ||
29 | #include "ecryptfs_kernel.h" | 30 | #include "ecryptfs_kernel.h" |
30 | 31 | ||
31 | /** | 32 | /** |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 542f625312f3..bc7115403f38 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -273,7 +273,7 @@ struct ecryptfs_crypt_stat { | |||
273 | u32 flags; | 273 | u32 flags; |
274 | unsigned int file_version; | 274 | unsigned int file_version; |
275 | size_t iv_bytes; | 275 | size_t iv_bytes; |
276 | size_t num_header_bytes_at_front; | 276 | size_t metadata_size; |
277 | size_t extent_size; /* Data extent size; default is 4096 */ | 277 | size_t extent_size; /* Data extent size; default is 4096 */ |
278 | size_t key_size; | 278 | size_t key_size; |
279 | size_t extent_shift; | 279 | size_t extent_shift; |
@@ -464,6 +464,14 @@ struct ecryptfs_daemon { | |||
464 | 464 | ||
465 | extern struct mutex ecryptfs_daemon_hash_mux; | 465 | extern struct mutex ecryptfs_daemon_hash_mux; |
466 | 466 | ||
467 | static inline size_t | ||
468 | ecryptfs_lower_header_size(struct ecryptfs_crypt_stat *crypt_stat) | ||
469 | { | ||
470 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | ||
471 | return 0; | ||
472 | return crypt_stat->metadata_size; | ||
473 | } | ||
474 | |||
467 | static inline struct ecryptfs_file_info * | 475 | static inline struct ecryptfs_file_info * |
468 | ecryptfs_file_to_private(struct file *file) | 476 | ecryptfs_file_to_private(struct file *file) |
469 | { | 477 | { |
@@ -651,6 +659,9 @@ int ecryptfs_decrypt_page(struct page *page); | |||
651 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry); | 659 | int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry); |
652 | int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry); | 660 | int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry); |
653 | int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry); | 661 | int ecryptfs_new_file_context(struct dentry *ecryptfs_dentry); |
662 | void ecryptfs_write_crypt_stat_flags(char *page_virt, | ||
663 | struct ecryptfs_crypt_stat *crypt_stat, | ||
664 | size_t *written); | ||
654 | int ecryptfs_read_and_validate_header_region(char *data, | 665 | int ecryptfs_read_and_validate_header_region(char *data, |
655 | struct inode *ecryptfs_inode); | 666 | struct inode *ecryptfs_inode); |
656 | int ecryptfs_read_and_validate_xattr_region(char *page_virt, | 667 | int ecryptfs_read_and_validate_xattr_region(char *page_virt, |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 678172b61be2..e7440a6f5ebf 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/file.h> | 26 | #include <linux/file.h> |
27 | #include <linux/poll.h> | 27 | #include <linux/poll.h> |
28 | #include <linux/slab.h> | ||
28 | #include <linux/mount.h> | 29 | #include <linux/mount.h> |
29 | #include <linux/pagemap.h> | 30 | #include <linux/pagemap.h> |
30 | #include <linux/security.h> | 31 | #include <linux/security.h> |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 4a430ab4115c..e2d4418affac 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/mount.h> | 31 | #include <linux/mount.h> |
32 | #include <linux/crypto.h> | 32 | #include <linux/crypto.h> |
33 | #include <linux/fs_stack.h> | 33 | #include <linux/fs_stack.h> |
34 | #include <linux/slab.h> | ||
34 | #include <asm/unaligned.h> | 35 | #include <asm/unaligned.h> |
35 | #include "ecryptfs_kernel.h" | 36 | #include "ecryptfs_kernel.h" |
36 | 37 | ||
@@ -323,6 +324,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
323 | rc = ecryptfs_read_and_validate_header_region(page_virt, | 324 | rc = ecryptfs_read_and_validate_header_region(page_virt, |
324 | ecryptfs_dentry->d_inode); | 325 | ecryptfs_dentry->d_inode); |
325 | if (rc) { | 326 | if (rc) { |
327 | memset(page_virt, 0, PAGE_CACHE_SIZE); | ||
326 | rc = ecryptfs_read_and_validate_xattr_region(page_virt, | 328 | rc = ecryptfs_read_and_validate_xattr_region(page_virt, |
327 | ecryptfs_dentry); | 329 | ecryptfs_dentry); |
328 | if (rc) { | 330 | if (rc) { |
@@ -335,7 +337,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
335 | ecryptfs_dentry->d_sb)->mount_crypt_stat; | 337 | ecryptfs_dentry->d_sb)->mount_crypt_stat; |
336 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { | 338 | if (mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED) { |
337 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) | 339 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) |
338 | file_size = (crypt_stat->num_header_bytes_at_front | 340 | file_size = (crypt_stat->metadata_size |
339 | + i_size_read(lower_dentry->d_inode)); | 341 | + i_size_read(lower_dentry->d_inode)); |
340 | else | 342 | else |
341 | file_size = i_size_read(lower_dentry->d_inode); | 343 | file_size = i_size_read(lower_dentry->d_inode); |
@@ -387,9 +389,9 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
387 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | 389 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); |
388 | if (IS_ERR(lower_dentry)) { | 390 | if (IS_ERR(lower_dentry)) { |
389 | rc = PTR_ERR(lower_dentry); | 391 | rc = PTR_ERR(lower_dentry); |
390 | printk(KERN_ERR "%s: lookup_one_len() returned [%d] on " | 392 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
391 | "lower_dentry = [%s]\n", __func__, rc, | 393 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
392 | ecryptfs_dentry->d_name.name); | 394 | encrypted_and_encoded_name); |
393 | goto out_d_drop; | 395 | goto out_d_drop; |
394 | } | 396 | } |
395 | if (lower_dentry->d_inode) | 397 | if (lower_dentry->d_inode) |
@@ -416,9 +418,9 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
416 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); | 418 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); |
417 | if (IS_ERR(lower_dentry)) { | 419 | if (IS_ERR(lower_dentry)) { |
418 | rc = PTR_ERR(lower_dentry); | 420 | rc = PTR_ERR(lower_dentry); |
419 | printk(KERN_ERR "%s: lookup_one_len() returned [%d] on " | 421 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
420 | "lower_dentry = [%s]\n", __func__, rc, | 422 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
421 | encrypted_and_encoded_name); | 423 | encrypted_and_encoded_name); |
422 | goto out_d_drop; | 424 | goto out_d_drop; |
423 | } | 425 | } |
424 | lookup_and_interpose: | 426 | lookup_and_interpose: |
@@ -455,8 +457,8 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, | |||
455 | rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0); | 457 | rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0); |
456 | if (rc) | 458 | if (rc) |
457 | goto out_lock; | 459 | goto out_lock; |
458 | fsstack_copy_attr_times(dir, lower_new_dentry->d_inode); | 460 | fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode); |
459 | fsstack_copy_inode_size(dir, lower_new_dentry->d_inode); | 461 | fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode); |
460 | old_dentry->d_inode->i_nlink = | 462 | old_dentry->d_inode->i_nlink = |
461 | ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink; | 463 | ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink; |
462 | i_size_write(new_dentry->d_inode, file_size_save); | 464 | i_size_write(new_dentry->d_inode, file_size_save); |
@@ -647,38 +649,17 @@ out_lock: | |||
647 | return rc; | 649 | return rc; |
648 | } | 650 | } |
649 | 651 | ||
650 | static int | 652 | static int ecryptfs_readlink_lower(struct dentry *dentry, char **buf, |
651 | ecryptfs_readlink(struct dentry *dentry, char __user *buf, int bufsiz) | 653 | size_t *bufsiz) |
652 | { | 654 | { |
655 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
653 | char *lower_buf; | 656 | char *lower_buf; |
654 | size_t lower_bufsiz; | 657 | size_t lower_bufsiz = PATH_MAX; |
655 | struct dentry *lower_dentry; | ||
656 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
657 | char *plaintext_name; | ||
658 | size_t plaintext_name_size; | ||
659 | mm_segment_t old_fs; | 658 | mm_segment_t old_fs; |
660 | int rc; | 659 | int rc; |
661 | 660 | ||
662 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
663 | if (!lower_dentry->d_inode->i_op->readlink) { | ||
664 | rc = -EINVAL; | ||
665 | goto out; | ||
666 | } | ||
667 | mount_crypt_stat = &ecryptfs_superblock_to_private( | ||
668 | dentry->d_sb)->mount_crypt_stat; | ||
669 | /* | ||
670 | * If the lower filename is encrypted, it will result in a significantly | ||
671 | * longer name. If needed, truncate the name after decode and decrypt. | ||
672 | */ | ||
673 | if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) | ||
674 | lower_bufsiz = PATH_MAX; | ||
675 | else | ||
676 | lower_bufsiz = bufsiz; | ||
677 | /* Released in this function */ | ||
678 | lower_buf = kmalloc(lower_bufsiz, GFP_KERNEL); | 661 | lower_buf = kmalloc(lower_bufsiz, GFP_KERNEL); |
679 | if (lower_buf == NULL) { | 662 | if (!lower_buf) { |
680 | printk(KERN_ERR "%s: Out of memory whilst attempting to " | ||
681 | "kmalloc [%zd] bytes\n", __func__, lower_bufsiz); | ||
682 | rc = -ENOMEM; | 663 | rc = -ENOMEM; |
683 | goto out; | 664 | goto out; |
684 | } | 665 | } |
@@ -688,29 +669,31 @@ ecryptfs_readlink(struct dentry *dentry, char __user *buf, int bufsiz) | |||
688 | (char __user *)lower_buf, | 669 | (char __user *)lower_buf, |
689 | lower_bufsiz); | 670 | lower_bufsiz); |
690 | set_fs(old_fs); | 671 | set_fs(old_fs); |
691 | if (rc >= 0) { | 672 | if (rc < 0) |
692 | rc = ecryptfs_decode_and_decrypt_filename(&plaintext_name, | 673 | goto out; |
693 | &plaintext_name_size, | 674 | lower_bufsiz = rc; |
694 | dentry, lower_buf, | 675 | rc = ecryptfs_decode_and_decrypt_filename(buf, bufsiz, dentry, |
695 | rc); | 676 | lower_buf, lower_bufsiz); |
696 | if (rc) { | 677 | out: |
697 | printk(KERN_ERR "%s: Error attempting to decode and " | ||
698 | "decrypt filename; rc = [%d]\n", __func__, | ||
699 | rc); | ||
700 | goto out_free_lower_buf; | ||
701 | } | ||
702 | /* Check for bufsiz <= 0 done in sys_readlinkat() */ | ||
703 | rc = copy_to_user(buf, plaintext_name, | ||
704 | min((size_t) bufsiz, plaintext_name_size)); | ||
705 | if (rc) | ||
706 | rc = -EFAULT; | ||
707 | else | ||
708 | rc = plaintext_name_size; | ||
709 | kfree(plaintext_name); | ||
710 | fsstack_copy_attr_atime(dentry->d_inode, lower_dentry->d_inode); | ||
711 | } | ||
712 | out_free_lower_buf: | ||
713 | kfree(lower_buf); | 678 | kfree(lower_buf); |
679 | return rc; | ||
680 | } | ||
681 | |||
682 | static int | ||
683 | ecryptfs_readlink(struct dentry *dentry, char __user *buf, int bufsiz) | ||
684 | { | ||
685 | char *kbuf; | ||
686 | size_t kbufsiz, copied; | ||
687 | int rc; | ||
688 | |||
689 | rc = ecryptfs_readlink_lower(dentry, &kbuf, &kbufsiz); | ||
690 | if (rc) | ||
691 | goto out; | ||
692 | copied = min_t(size_t, bufsiz, kbufsiz); | ||
693 | rc = copy_to_user(buf, kbuf, copied) ? -EFAULT : copied; | ||
694 | kfree(kbuf); | ||
695 | fsstack_copy_attr_atime(dentry->d_inode, | ||
696 | ecryptfs_dentry_to_lower(dentry)->d_inode); | ||
714 | out: | 697 | out: |
715 | return rc; | 698 | return rc; |
716 | } | 699 | } |
@@ -768,7 +751,7 @@ upper_size_to_lower_size(struct ecryptfs_crypt_stat *crypt_stat, | |||
768 | { | 751 | { |
769 | loff_t lower_size; | 752 | loff_t lower_size; |
770 | 753 | ||
771 | lower_size = crypt_stat->num_header_bytes_at_front; | 754 | lower_size = ecryptfs_lower_header_size(crypt_stat); |
772 | if (upper_size != 0) { | 755 | if (upper_size != 0) { |
773 | loff_t num_extents; | 756 | loff_t num_extents; |
774 | 757 | ||
@@ -1015,6 +998,28 @@ out: | |||
1015 | return rc; | 998 | return rc; |
1016 | } | 999 | } |
1017 | 1000 | ||
1001 | int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry, | ||
1002 | struct kstat *stat) | ||
1003 | { | ||
1004 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat; | ||
1005 | int rc = 0; | ||
1006 | |||
1007 | mount_crypt_stat = &ecryptfs_superblock_to_private( | ||
1008 | dentry->d_sb)->mount_crypt_stat; | ||
1009 | generic_fillattr(dentry->d_inode, stat); | ||
1010 | if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { | ||
1011 | char *target; | ||
1012 | size_t targetsiz; | ||
1013 | |||
1014 | rc = ecryptfs_readlink_lower(dentry, &target, &targetsiz); | ||
1015 | if (!rc) { | ||
1016 | kfree(target); | ||
1017 | stat->size = targetsiz; | ||
1018 | } | ||
1019 | } | ||
1020 | return rc; | ||
1021 | } | ||
1022 | |||
1018 | int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | 1023 | int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, |
1019 | struct kstat *stat) | 1024 | struct kstat *stat) |
1020 | { | 1025 | { |
@@ -1039,7 +1044,7 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
1039 | 1044 | ||
1040 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1045 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
1041 | if (!lower_dentry->d_inode->i_op->setxattr) { | 1046 | if (!lower_dentry->d_inode->i_op->setxattr) { |
1042 | rc = -ENOSYS; | 1047 | rc = -EOPNOTSUPP; |
1043 | goto out; | 1048 | goto out; |
1044 | } | 1049 | } |
1045 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1050 | mutex_lock(&lower_dentry->d_inode->i_mutex); |
@@ -1057,7 +1062,7 @@ ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, | |||
1057 | int rc = 0; | 1062 | int rc = 0; |
1058 | 1063 | ||
1059 | if (!lower_dentry->d_inode->i_op->getxattr) { | 1064 | if (!lower_dentry->d_inode->i_op->getxattr) { |
1060 | rc = -ENOSYS; | 1065 | rc = -EOPNOTSUPP; |
1061 | goto out; | 1066 | goto out; |
1062 | } | 1067 | } |
1063 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1068 | mutex_lock(&lower_dentry->d_inode->i_mutex); |
@@ -1084,7 +1089,7 @@ ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) | |||
1084 | 1089 | ||
1085 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1090 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
1086 | if (!lower_dentry->d_inode->i_op->listxattr) { | 1091 | if (!lower_dentry->d_inode->i_op->listxattr) { |
1087 | rc = -ENOSYS; | 1092 | rc = -EOPNOTSUPP; |
1088 | goto out; | 1093 | goto out; |
1089 | } | 1094 | } |
1090 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1095 | mutex_lock(&lower_dentry->d_inode->i_mutex); |
@@ -1101,7 +1106,7 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name) | |||
1101 | 1106 | ||
1102 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 1107 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
1103 | if (!lower_dentry->d_inode->i_op->removexattr) { | 1108 | if (!lower_dentry->d_inode->i_op->removexattr) { |
1104 | rc = -ENOSYS; | 1109 | rc = -EOPNOTSUPP; |
1105 | goto out; | 1110 | goto out; |
1106 | } | 1111 | } |
1107 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1112 | mutex_lock(&lower_dentry->d_inode->i_mutex); |
@@ -1132,6 +1137,7 @@ const struct inode_operations ecryptfs_symlink_iops = { | |||
1132 | .put_link = ecryptfs_put_link, | 1137 | .put_link = ecryptfs_put_link, |
1133 | .permission = ecryptfs_permission, | 1138 | .permission = ecryptfs_permission, |
1134 | .setattr = ecryptfs_setattr, | 1139 | .setattr = ecryptfs_setattr, |
1140 | .getattr = ecryptfs_getattr_link, | ||
1135 | .setxattr = ecryptfs_setxattr, | 1141 | .setxattr = ecryptfs_setxattr, |
1136 | .getxattr = ecryptfs_getxattr, | 1142 | .getxattr = ecryptfs_getxattr, |
1137 | .listxattr = ecryptfs_listxattr, | 1143 | .listxattr = ecryptfs_listxattr, |
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index a0a7847567e9..89c5476506ef 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/random.h> | 32 | #include <linux/random.h> |
33 | #include <linux/crypto.h> | 33 | #include <linux/crypto.h> |
34 | #include <linux/scatterlist.h> | 34 | #include <linux/scatterlist.h> |
35 | #include <linux/slab.h> | ||
35 | #include "ecryptfs_kernel.h" | 36 | #include "ecryptfs_kernel.h" |
36 | 37 | ||
37 | /** | 38 | /** |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index e14cf7e588db..d8c3a373aafa 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
24 | #include <linux/freezer.h> | 24 | #include <linux/freezer.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
26 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
27 | #include "ecryptfs_kernel.h" | 28 | #include "ecryptfs_kernel.h" |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index ea2f92101dfe..af1a8f01ebac 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/key.h> | 35 | #include <linux/key.h> |
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/fs_stack.h> | 37 | #include <linux/fs_stack.h> |
38 | #include <linux/slab.h> | ||
38 | #include "ecryptfs_kernel.h" | 39 | #include "ecryptfs_kernel.h" |
39 | 40 | ||
40 | /** | 41 | /** |
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c index f1c17e87c5fb..2d8dbce9d485 100644 --- a/fs/ecryptfs/messaging.c +++ b/fs/ecryptfs/messaging.c | |||
@@ -20,6 +20,7 @@ | |||
20 | * 02111-1307, USA. | 20 | * 02111-1307, USA. |
21 | */ | 21 | */ |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/slab.h> | ||
23 | #include <linux/user_namespace.h> | 24 | #include <linux/user_namespace.h> |
24 | #include <linux/nsproxy.h> | 25 | #include <linux/nsproxy.h> |
25 | #include "ecryptfs_kernel.h" | 26 | #include "ecryptfs_kernel.h" |
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 4ec8f61ccf5a..3745f612bcd4 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/random.h> | 24 | #include <linux/random.h> |
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
28 | #include <linux/module.h> | 29 | #include <linux/module.h> |
29 | #include "ecryptfs_kernel.h" | 30 | #include "ecryptfs_kernel.h" |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index df4ce99d0597..2ee9a3a7b68c 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/file.h> | 32 | #include <linux/file.h> |
33 | #include <linux/crypto.h> | 33 | #include <linux/crypto.h> |
34 | #include <linux/scatterlist.h> | 34 | #include <linux/scatterlist.h> |
35 | #include <linux/slab.h> | ||
35 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
36 | #include "ecryptfs_kernel.h" | 37 | #include "ecryptfs_kernel.h" |
37 | 38 | ||
@@ -82,6 +83,19 @@ out: | |||
82 | return rc; | 83 | return rc; |
83 | } | 84 | } |
84 | 85 | ||
86 | static void strip_xattr_flag(char *page_virt, | ||
87 | struct ecryptfs_crypt_stat *crypt_stat) | ||
88 | { | ||
89 | if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) { | ||
90 | size_t written; | ||
91 | |||
92 | crypt_stat->flags &= ~ECRYPTFS_METADATA_IN_XATTR; | ||
93 | ecryptfs_write_crypt_stat_flags(page_virt, crypt_stat, | ||
94 | &written); | ||
95 | crypt_stat->flags |= ECRYPTFS_METADATA_IN_XATTR; | ||
96 | } | ||
97 | } | ||
98 | |||
85 | /** | 99 | /** |
86 | * Header Extent: | 100 | * Header Extent: |
87 | * Octets 0-7: Unencrypted file size (big-endian) | 101 | * Octets 0-7: Unencrypted file size (big-endian) |
@@ -97,19 +111,6 @@ out: | |||
97 | * (big-endian) | 111 | * (big-endian) |
98 | * Octet 26: Begin RFC 2440 authentication token packet set | 112 | * Octet 26: Begin RFC 2440 authentication token packet set |
99 | */ | 113 | */ |
100 | static void set_header_info(char *page_virt, | ||
101 | struct ecryptfs_crypt_stat *crypt_stat) | ||
102 | { | ||
103 | size_t written; | ||
104 | size_t save_num_header_bytes_at_front = | ||
105 | crypt_stat->num_header_bytes_at_front; | ||
106 | |||
107 | crypt_stat->num_header_bytes_at_front = | ||
108 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | ||
109 | ecryptfs_write_header_metadata(page_virt + 20, crypt_stat, &written); | ||
110 | crypt_stat->num_header_bytes_at_front = | ||
111 | save_num_header_bytes_at_front; | ||
112 | } | ||
113 | 114 | ||
114 | /** | 115 | /** |
115 | * ecryptfs_copy_up_encrypted_with_header | 116 | * ecryptfs_copy_up_encrypted_with_header |
@@ -135,8 +136,7 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page, | |||
135 | * num_extents_per_page) | 136 | * num_extents_per_page) |
136 | + extent_num_in_page); | 137 | + extent_num_in_page); |
137 | size_t num_header_extents_at_front = | 138 | size_t num_header_extents_at_front = |
138 | (crypt_stat->num_header_bytes_at_front | 139 | (crypt_stat->metadata_size / crypt_stat->extent_size); |
139 | / crypt_stat->extent_size); | ||
140 | 140 | ||
141 | if (view_extent_num < num_header_extents_at_front) { | 141 | if (view_extent_num < num_header_extents_at_front) { |
142 | /* This is a header extent */ | 142 | /* This is a header extent */ |
@@ -146,9 +146,14 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page, | |||
146 | memset(page_virt, 0, PAGE_CACHE_SIZE); | 146 | memset(page_virt, 0, PAGE_CACHE_SIZE); |
147 | /* TODO: Support more than one header extent */ | 147 | /* TODO: Support more than one header extent */ |
148 | if (view_extent_num == 0) { | 148 | if (view_extent_num == 0) { |
149 | size_t written; | ||
150 | |||
149 | rc = ecryptfs_read_xattr_region( | 151 | rc = ecryptfs_read_xattr_region( |
150 | page_virt, page->mapping->host); | 152 | page_virt, page->mapping->host); |
151 | set_header_info(page_virt, crypt_stat); | 153 | strip_xattr_flag(page_virt + 16, crypt_stat); |
154 | ecryptfs_write_header_metadata(page_virt + 20, | ||
155 | crypt_stat, | ||
156 | &written); | ||
152 | } | 157 | } |
153 | kunmap_atomic(page_virt, KM_USER0); | 158 | kunmap_atomic(page_virt, KM_USER0); |
154 | flush_dcache_page(page); | 159 | flush_dcache_page(page); |
@@ -161,7 +166,7 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page, | |||
161 | /* This is an encrypted data extent */ | 166 | /* This is an encrypted data extent */ |
162 | loff_t lower_offset = | 167 | loff_t lower_offset = |
163 | ((view_extent_num * crypt_stat->extent_size) | 168 | ((view_extent_num * crypt_stat->extent_size) |
164 | - crypt_stat->num_header_bytes_at_front); | 169 | - crypt_stat->metadata_size); |
165 | 170 | ||
166 | rc = ecryptfs_read_lower_page_segment( | 171 | rc = ecryptfs_read_lower_page_segment( |
167 | page, (lower_offset >> PAGE_CACHE_SHIFT), | 172 | page, (lower_offset >> PAGE_CACHE_SHIFT), |
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index b15a43a80ab7..278743c7716a 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
28 | #include <linux/key.h> | 28 | #include <linux/key.h> |
29 | #include <linux/slab.h> | ||
29 | #include <linux/seq_file.h> | 30 | #include <linux/seq_file.h> |
30 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
31 | #include <linux/file.h> | 32 | #include <linux/file.h> |
@@ -85,7 +86,6 @@ static void ecryptfs_destroy_inode(struct inode *inode) | |||
85 | if (lower_dentry->d_inode) { | 86 | if (lower_dentry->d_inode) { |
86 | fput(inode_info->lower_file); | 87 | fput(inode_info->lower_file); |
87 | inode_info->lower_file = NULL; | 88 | inode_info->lower_file = NULL; |
88 | d_drop(lower_dentry); | ||
89 | } | 89 | } |
90 | } | 90 | } |
91 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); | 91 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); |
diff --git a/fs/eventfd.c b/fs/eventfd.c index 7758cc382ef0..6bd3f76fdf88 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/list.h> | 15 | #include <linux/list.h> |
15 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
16 | #include <linux/anon_inodes.h> | 17 | #include <linux/anon_inodes.h> |
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index a17e4b733e35..76d2a79ef93e 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/slab.h> | ||
34 | #include <linux/writeback.h> | 35 | #include <linux/writeback.h> |
35 | #include <linux/buffer_head.h> | 36 | #include <linux/buffer_head.h> |
36 | #include <scsi/scsi_device.h> | 37 | #include <scsi/scsi_device.h> |
diff --git a/fs/exofs/ios.c b/fs/exofs/ios.c index 5293bc411d17..4337cad7777b 100644 --- a/fs/exofs/ios.c +++ b/fs/exofs/ios.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 22 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/slab.h> | ||
25 | #include <scsi/scsi_device.h> | 26 | #include <scsi/scsi_device.h> |
26 | #include <asm/div64.h> | 27 | #include <asm/div64.h> |
27 | 28 | ||
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 6cf5e4e84d61..18e57ea1e5b4 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/vfs.h> | 37 | #include <linux/vfs.h> |
38 | #include <linux/random.h> | 38 | #include <linux/random.h> |
39 | #include <linux/exportfs.h> | 39 | #include <linux/exportfs.h> |
40 | #include <linux/slab.h> | ||
40 | 41 | ||
41 | #include "exofs.h" | 42 | #include "exofs.h" |
42 | 43 | ||
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 1d081f0cfec2..3cf038c055d7 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include "ext2.h" | 14 | #include "ext2.h" |
15 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/buffer_head.h> | 18 | #include <linux/buffer_head.h> |
18 | #include <linux/capability.h> | 19 | #include <linux/capability.h> |
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c index 4e2426e22bbe..565cf817bbf1 100644 --- a/fs/ext2/symlink.c +++ b/fs/ext2/symlink.c | |||
@@ -32,6 +32,7 @@ const struct inode_operations ext2_symlink_inode_operations = { | |||
32 | .readlink = generic_readlink, | 32 | .readlink = generic_readlink, |
33 | .follow_link = page_follow_link_light, | 33 | .follow_link = page_follow_link_light, |
34 | .put_link = page_put_link, | 34 | .put_link = page_put_link, |
35 | .setattr = ext2_setattr, | ||
35 | #ifdef CONFIG_EXT2_FS_XATTR | 36 | #ifdef CONFIG_EXT2_FS_XATTR |
36 | .setxattr = generic_setxattr, | 37 | .setxattr = generic_setxattr, |
37 | .getxattr = generic_getxattr, | 38 | .getxattr = generic_getxattr, |
@@ -43,6 +44,7 @@ const struct inode_operations ext2_symlink_inode_operations = { | |||
43 | const struct inode_operations ext2_fast_symlink_inode_operations = { | 44 | const struct inode_operations ext2_fast_symlink_inode_operations = { |
44 | .readlink = generic_readlink, | 45 | .readlink = generic_readlink, |
45 | .follow_link = ext2_follow_link, | 46 | .follow_link = ext2_follow_link, |
47 | .setattr = ext2_setattr, | ||
46 | #ifdef CONFIG_EXT2_FS_XATTR | 48 | #ifdef CONFIG_EXT2_FS_XATTR |
47 | .setxattr = generic_setxattr, | 49 | .setxattr = generic_setxattr, |
48 | .getxattr = generic_getxattr, | 50 | .getxattr = generic_getxattr, |
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c index c8155845ac05..b118c6383c6d 100644 --- a/fs/ext2/xattr_security.c +++ b/fs/ext2/xattr_security.c | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/slab.h> | ||
7 | #include <linux/string.h> | 8 | #include <linux/string.h> |
8 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
9 | #include <linux/ext2_fs.h> | 10 | #include <linux/ext2_fs.h> |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 161da2d3f890..a177122a1b25 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/time.h> | 14 | #include <linux/time.h> |
15 | #include <linux/capability.h> | 15 | #include <linux/capability.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/jbd.h> | 18 | #include <linux/jbd.h> |
18 | #include <linux/ext3_fs.h> | 19 | #include <linux/ext3_fs.h> |
19 | #include <linux/ext3_jbd.h> | 20 | #include <linux/ext3_jbd.h> |
diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c index ff7b4ccd8983..7c4898207776 100644 --- a/fs/ext3/symlink.c +++ b/fs/ext3/symlink.c | |||
@@ -34,6 +34,7 @@ const struct inode_operations ext3_symlink_inode_operations = { | |||
34 | .readlink = generic_readlink, | 34 | .readlink = generic_readlink, |
35 | .follow_link = page_follow_link_light, | 35 | .follow_link = page_follow_link_light, |
36 | .put_link = page_put_link, | 36 | .put_link = page_put_link, |
37 | .setattr = ext3_setattr, | ||
37 | #ifdef CONFIG_EXT3_FS_XATTR | 38 | #ifdef CONFIG_EXT3_FS_XATTR |
38 | .setxattr = generic_setxattr, | 39 | .setxattr = generic_setxattr, |
39 | .getxattr = generic_getxattr, | 40 | .getxattr = generic_getxattr, |
@@ -45,6 +46,7 @@ const struct inode_operations ext3_symlink_inode_operations = { | |||
45 | const struct inode_operations ext3_fast_symlink_inode_operations = { | 46 | const struct inode_operations ext3_fast_symlink_inode_operations = { |
46 | .readlink = generic_readlink, | 47 | .readlink = generic_readlink, |
47 | .follow_link = ext3_follow_link, | 48 | .follow_link = ext3_follow_link, |
49 | .setattr = ext3_setattr, | ||
48 | #ifdef CONFIG_EXT3_FS_XATTR | 50 | #ifdef CONFIG_EXT3_FS_XATTR |
49 | .setxattr = generic_setxattr, | 51 | .setxattr = generic_setxattr, |
50 | .getxattr = generic_getxattr, | 52 | .getxattr = generic_getxattr, |
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index 474348788dd9..3af91f476dff 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/slab.h> | ||
7 | #include <linux/string.h> | 8 | #include <linux/string.h> |
8 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
9 | #include <linux/ext3_jbd.h> | 10 | #include <linux/ext3_jbd.h> |
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 983f0e127493..538c48655084 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/blkdev.h> | 19 | #include <linux/blkdev.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <linux/slab.h> | ||
21 | #include "ext4.h" | 22 | #include "ext4.h" |
22 | 23 | ||
23 | struct ext4_system_zone { | 24 | struct ext4_system_zone { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 11119e07233b..5381802d6052 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/bio.h> | 39 | #include <linux/bio.h> |
40 | #include <linux/workqueue.h> | 40 | #include <linux/workqueue.h> |
41 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
42 | #include <linux/slab.h> | ||
42 | 43 | ||
43 | #include "ext4_jbd2.h" | 44 | #include "ext4_jbd2.h" |
44 | #include "xattr.h" | 45 | #include "xattr.h" |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 54df209d2eed..bde9d0b170c2 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include "mballoc.h" | 24 | #include "mballoc.h" |
25 | #include <linux/debugfs.h> | 25 | #include <linux/debugfs.h> |
26 | #include <linux/slab.h> | ||
26 | #include <trace/events/ext4.h> | 27 | #include <trace/events/ext4.h> |
27 | 28 | ||
28 | /* | 29 | /* |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 8b87bd0eac95..34dcfc52ef44 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
16 | #include "ext4_jbd2.h" | 17 | #include "ext4_jbd2.h" |
17 | #include "ext4_extents.h" | 18 | #include "ext4_extents.h" |
18 | 19 | ||
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index aa5fe28d180f..d1fc662cc311 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
18 | #include <linux/slab.h> | ||
18 | #include "ext4_jbd2.h" | 19 | #include "ext4_jbd2.h" |
19 | #include "ext4_extents.h" | 20 | #include "ext4_extents.h" |
20 | #include "ext4.h" | 21 | #include "ext4.h" |
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c index 983c253999a7..8b145e98df07 100644 --- a/fs/ext4/xattr_security.c +++ b/fs/ext4/xattr_security.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/security.h> | 9 | #include <linux/security.h> |
10 | #include <linux/slab.h> | ||
10 | #include "ext4_jbd2.h" | 11 | #include "ext4_jbd2.h" |
11 | #include "ext4.h" | 12 | #include "ext4.h" |
12 | #include "xattr.h" | 13 | #include "xattr.h" |
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index 923990e4f16e..113f0a1e565d 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
13 | #include "fat.h" | 14 | #include "fat.h" |
14 | 15 | ||
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index c1ef50154868..6fcc7e71fbaa 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -309,7 +309,7 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls, | |||
309 | { | 309 | { |
310 | struct fat_mount_options *opts = &MSDOS_SB(dir->i_sb)->options; | 310 | struct fat_mount_options *opts = &MSDOS_SB(dir->i_sb)->options; |
311 | wchar_t *ip, *ext_start, *end, *name_start; | 311 | wchar_t *ip, *ext_start, *end, *name_start; |
312 | unsigned char base[9], ext[4], buf[8], *p; | 312 | unsigned char base[9], ext[4], buf[5], *p; |
313 | unsigned char charbuf[NLS_MAX_CHARSET_SIZE]; | 313 | unsigned char charbuf[NLS_MAX_CHARSET_SIZE]; |
314 | int chl, chi; | 314 | int chl, chi; |
315 | int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen; | 315 | int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen; |
@@ -467,7 +467,7 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls, | |||
467 | return 0; | 467 | return 0; |
468 | } | 468 | } |
469 | 469 | ||
470 | i = jiffies & 0xffff; | 470 | i = jiffies; |
471 | sz = (jiffies >> 16) & 0x7; | 471 | sz = (jiffies >> 16) & 0x7; |
472 | if (baselen > 2) { | 472 | if (baselen > 2) { |
473 | baselen = numtail2_baselen; | 473 | baselen = numtail2_baselen; |
@@ -476,7 +476,7 @@ static int vfat_create_shortname(struct inode *dir, struct nls_table *nls, | |||
476 | name_res[baselen + 4] = '~'; | 476 | name_res[baselen + 4] = '~'; |
477 | name_res[baselen + 5] = '1' + sz; | 477 | name_res[baselen + 5] = '1' + sz; |
478 | while (1) { | 478 | while (1) { |
479 | sprintf(buf, "%04X", i); | 479 | snprintf(buf, sizeof(buf), "%04X", i & 0xffff); |
480 | memcpy(&name_res[baselen], buf, 4); | 480 | memcpy(&name_res[baselen], buf, 4); |
481 | if (vfat_find_form(dir, name_res) < 0) | 481 | if (vfat_find_form(dir, name_res) < 0) |
482 | break; | 482 | break; |
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
16 | #include <linux/pipe_fs_i.h> | 15 | #include <linux/pipe_fs_i.h> |
diff --git a/fs/filesystems.c b/fs/filesystems.c index a24c58e181db..68ba492d8eef 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -10,10 +10,10 @@ | |||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/proc_fs.h> | 11 | #include <linux/proc_fs.h> |
12 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/kmod.h> | 13 | #include <linux/kmod.h> |
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | 18 | ||
19 | /* | 19 | /* |
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c index ed8f0b0dd880..1429f3ae1e86 100644 --- a/fs/freevxfs/vxfs_subr.c +++ b/fs/freevxfs/vxfs_subr.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/buffer_head.h> | 34 | #include <linux/buffer_head.h> |
35 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
36 | #include <linux/slab.h> | ||
37 | #include <linux/pagemap.h> | 36 | #include <linux/pagemap.h> |
38 | 37 | ||
39 | #include "vxfs_extern.h" | 38 | #include "vxfs_extern.h" |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 76fc4d594acb..4b37f7cea4dd 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | #include <linux/slab.h> | ||
19 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
@@ -553,108 +554,85 @@ select_queue: | |||
553 | return ret; | 554 | return ret; |
554 | } | 555 | } |
555 | 556 | ||
556 | static void unpin_sb_for_writeback(struct super_block **psb) | 557 | static void unpin_sb_for_writeback(struct super_block *sb) |
557 | { | 558 | { |
558 | struct super_block *sb = *psb; | 559 | up_read(&sb->s_umount); |
559 | 560 | put_super(sb); | |
560 | if (sb) { | ||
561 | up_read(&sb->s_umount); | ||
562 | put_super(sb); | ||
563 | *psb = NULL; | ||
564 | } | ||
565 | } | 561 | } |
566 | 562 | ||
563 | enum sb_pin_state { | ||
564 | SB_PINNED, | ||
565 | SB_NOT_PINNED, | ||
566 | SB_PIN_FAILED | ||
567 | }; | ||
568 | |||
567 | /* | 569 | /* |
568 | * For WB_SYNC_NONE writeback, the caller does not have the sb pinned | 570 | * For WB_SYNC_NONE writeback, the caller does not have the sb pinned |
569 | * before calling writeback. So make sure that we do pin it, so it doesn't | 571 | * before calling writeback. So make sure that we do pin it, so it doesn't |
570 | * go away while we are writing inodes from it. | 572 | * go away while we are writing inodes from it. |
571 | * | ||
572 | * Returns 0 if the super was successfully pinned (or pinning wasn't needed), | ||
573 | * 1 if we failed. | ||
574 | */ | 573 | */ |
575 | static int pin_sb_for_writeback(struct writeback_control *wbc, | 574 | static enum sb_pin_state pin_sb_for_writeback(struct writeback_control *wbc, |
576 | struct inode *inode, struct super_block **psb) | 575 | struct super_block *sb) |
577 | { | 576 | { |
578 | struct super_block *sb = inode->i_sb; | ||
579 | |||
580 | /* | ||
581 | * If this sb is already pinned, nothing more to do. If not and | ||
582 | * *psb is non-NULL, unpin the old one first | ||
583 | */ | ||
584 | if (sb == *psb) | ||
585 | return 0; | ||
586 | else if (*psb) | ||
587 | unpin_sb_for_writeback(psb); | ||
588 | |||
589 | /* | 577 | /* |
590 | * Caller must already hold the ref for this | 578 | * Caller must already hold the ref for this |
591 | */ | 579 | */ |
592 | if (wbc->sync_mode == WB_SYNC_ALL) { | 580 | if (wbc->sync_mode == WB_SYNC_ALL) { |
593 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | 581 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); |
594 | return 0; | 582 | return SB_NOT_PINNED; |
595 | } | 583 | } |
596 | |||
597 | spin_lock(&sb_lock); | 584 | spin_lock(&sb_lock); |
598 | sb->s_count++; | 585 | sb->s_count++; |
599 | if (down_read_trylock(&sb->s_umount)) { | 586 | if (down_read_trylock(&sb->s_umount)) { |
600 | if (sb->s_root) { | 587 | if (sb->s_root) { |
601 | spin_unlock(&sb_lock); | 588 | spin_unlock(&sb_lock); |
602 | goto pinned; | 589 | return SB_PINNED; |
603 | } | 590 | } |
604 | /* | 591 | /* |
605 | * umounted, drop rwsem again and fall through to failure | 592 | * umounted, drop rwsem again and fall through to failure |
606 | */ | 593 | */ |
607 | up_read(&sb->s_umount); | 594 | up_read(&sb->s_umount); |
608 | } | 595 | } |
609 | |||
610 | sb->s_count--; | 596 | sb->s_count--; |
611 | spin_unlock(&sb_lock); | 597 | spin_unlock(&sb_lock); |
612 | return 1; | 598 | return SB_PIN_FAILED; |
613 | pinned: | ||
614 | *psb = sb; | ||
615 | return 0; | ||
616 | } | 599 | } |
617 | 600 | ||
618 | static void writeback_inodes_wb(struct bdi_writeback *wb, | 601 | /* |
619 | struct writeback_control *wbc) | 602 | * Write a portion of b_io inodes which belong to @sb. |
603 | * If @wbc->sb != NULL, then find and write all such | ||
604 | * inodes. Otherwise write only ones which go sequentially | ||
605 | * in reverse order. | ||
606 | * Return 1, if the caller writeback routine should be | ||
607 | * interrupted. Otherwise return 0. | ||
608 | */ | ||
609 | static int writeback_sb_inodes(struct super_block *sb, | ||
610 | struct bdi_writeback *wb, | ||
611 | struct writeback_control *wbc) | ||
620 | { | 612 | { |
621 | struct super_block *sb = wbc->sb, *pin_sb = NULL; | ||
622 | const unsigned long start = jiffies; /* livelock avoidance */ | ||
623 | |||
624 | spin_lock(&inode_lock); | ||
625 | |||
626 | if (!wbc->for_kupdate || list_empty(&wb->b_io)) | ||
627 | queue_io(wb, wbc->older_than_this); | ||
628 | |||
629 | while (!list_empty(&wb->b_io)) { | 613 | while (!list_empty(&wb->b_io)) { |
630 | struct inode *inode = list_entry(wb->b_io.prev, | ||
631 | struct inode, i_list); | ||
632 | long pages_skipped; | 614 | long pages_skipped; |
633 | 615 | struct inode *inode = list_entry(wb->b_io.prev, | |
634 | /* | 616 | struct inode, i_list); |
635 | * super block given and doesn't match, skip this inode | 617 | if (wbc->sb && sb != inode->i_sb) { |
636 | */ | 618 | /* super block given and doesn't |
637 | if (sb && sb != inode->i_sb) { | 619 | match, skip this inode */ |
638 | redirty_tail(inode); | 620 | redirty_tail(inode); |
639 | continue; | 621 | continue; |
640 | } | 622 | } |
641 | 623 | if (sb != inode->i_sb) | |
624 | /* finish with this superblock */ | ||
625 | return 0; | ||
642 | if (inode->i_state & (I_NEW | I_WILL_FREE)) { | 626 | if (inode->i_state & (I_NEW | I_WILL_FREE)) { |
643 | requeue_io(inode); | 627 | requeue_io(inode); |
644 | continue; | 628 | continue; |
645 | } | 629 | } |
646 | |||
647 | /* | 630 | /* |
648 | * Was this inode dirtied after sync_sb_inodes was called? | 631 | * Was this inode dirtied after sync_sb_inodes was called? |
649 | * This keeps sync from extra jobs and livelock. | 632 | * This keeps sync from extra jobs and livelock. |
650 | */ | 633 | */ |
651 | if (inode_dirtied_after(inode, start)) | 634 | if (inode_dirtied_after(inode, wbc->wb_start)) |
652 | break; | 635 | return 1; |
653 | |||
654 | if (pin_sb_for_writeback(wbc, inode, &pin_sb)) { | ||
655 | requeue_io(inode); | ||
656 | continue; | ||
657 | } | ||
658 | 636 | ||
659 | BUG_ON(inode->i_state & (I_FREEING | I_CLEAR)); | 637 | BUG_ON(inode->i_state & (I_FREEING | I_CLEAR)); |
660 | __iget(inode); | 638 | __iget(inode); |
@@ -673,14 +651,50 @@ static void writeback_inodes_wb(struct bdi_writeback *wb, | |||
673 | spin_lock(&inode_lock); | 651 | spin_lock(&inode_lock); |
674 | if (wbc->nr_to_write <= 0) { | 652 | if (wbc->nr_to_write <= 0) { |
675 | wbc->more_io = 1; | 653 | wbc->more_io = 1; |
676 | break; | 654 | return 1; |
677 | } | 655 | } |
678 | if (!list_empty(&wb->b_more_io)) | 656 | if (!list_empty(&wb->b_more_io)) |
679 | wbc->more_io = 1; | 657 | wbc->more_io = 1; |
680 | } | 658 | } |
659 | /* b_io is empty */ | ||
660 | return 1; | ||
661 | } | ||
662 | |||
663 | static void writeback_inodes_wb(struct bdi_writeback *wb, | ||
664 | struct writeback_control *wbc) | ||
665 | { | ||
666 | int ret = 0; | ||
681 | 667 | ||
682 | unpin_sb_for_writeback(&pin_sb); | 668 | wbc->wb_start = jiffies; /* livelock avoidance */ |
669 | spin_lock(&inode_lock); | ||
670 | if (!wbc->for_kupdate || list_empty(&wb->b_io)) | ||
671 | queue_io(wb, wbc->older_than_this); | ||
672 | |||
673 | while (!list_empty(&wb->b_io)) { | ||
674 | struct inode *inode = list_entry(wb->b_io.prev, | ||
675 | struct inode, i_list); | ||
676 | struct super_block *sb = inode->i_sb; | ||
677 | enum sb_pin_state state; | ||
678 | |||
679 | if (wbc->sb && sb != wbc->sb) { | ||
680 | /* super block given and doesn't | ||
681 | match, skip this inode */ | ||
682 | redirty_tail(inode); | ||
683 | continue; | ||
684 | } | ||
685 | state = pin_sb_for_writeback(wbc, sb); | ||
686 | |||
687 | if (state == SB_PIN_FAILED) { | ||
688 | requeue_io(inode); | ||
689 | continue; | ||
690 | } | ||
691 | ret = writeback_sb_inodes(sb, wb, wbc); | ||
683 | 692 | ||
693 | if (state == SB_PINNED) | ||
694 | unpin_sb_for_writeback(sb); | ||
695 | if (ret) | ||
696 | break; | ||
697 | } | ||
684 | spin_unlock(&inode_lock); | 698 | spin_unlock(&inode_lock); |
685 | /* Leave any unwritten inodes on b_io */ | 699 | /* Leave any unwritten inodes on b_io */ |
686 | } | 700 | } |
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c index 3221a0c7944e..1e1f286dd70e 100644 --- a/fs/fscache/object-list.c +++ b/fs/fscache/object-list.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #define FSCACHE_DEBUG_LEVEL COOKIE | 12 | #define FSCACHE_DEBUG_LEVEL COOKIE |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/seq_file.h> | 14 | #include <linux/seq_file.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/key.h> | 16 | #include <linux/key.h> |
16 | #include <keys/user-type.h> | 17 | #include <keys/user-type.h> |
17 | #include "internal.h" | 18 | #include "internal.h" |
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index 9f6c928d4586..f17cecafae44 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #define FSCACHE_DEBUG_LEVEL OPERATION | 14 | #define FSCACHE_DEBUG_LEVEL OPERATION |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
17 | #include <linux/slab.h> | ||
17 | #include "internal.h" | 18 | #include "internal.h" |
18 | 19 | ||
19 | atomic_t fscache_op_debug_id; | 20 | atomic_t fscache_op_debug_id; |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 69809024d71d..47aefd376e54 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/fscache-cache.h> | 14 | #include <linux/fscache-cache.h> |
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
16 | #include <linux/pagevec.h> | 16 | #include <linux/pagevec.h> |
17 | #include <linux/slab.h> | ||
17 | #include "internal.h" | 18 | #include "internal.h" |
18 | 19 | ||
19 | /* | 20 | /* |
diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c index 46435f3aae68..4765190d537f 100644 --- a/fs/fscache/stats.c +++ b/fs/fscache/stats.c | |||
@@ -165,8 +165,8 @@ static int fscache_stats_show(struct seq_file *m, void *v) | |||
165 | atomic_read(&fscache_n_object_lookups), | 165 | atomic_read(&fscache_n_object_lookups), |
166 | atomic_read(&fscache_n_object_lookups_negative), | 166 | atomic_read(&fscache_n_object_lookups_negative), |
167 | atomic_read(&fscache_n_object_lookups_positive), | 167 | atomic_read(&fscache_n_object_lookups_positive), |
168 | atomic_read(&fscache_n_object_lookups_timed_out), | 168 | atomic_read(&fscache_n_object_created), |
169 | atomic_read(&fscache_n_object_created)); | 169 | atomic_read(&fscache_n_object_lookups_timed_out)); |
170 | 170 | ||
171 | seq_printf(m, "Updates: n=%u nul=%u run=%u\n", | 171 | seq_printf(m, "Updates: n=%u nul=%u run=%u\n", |
172 | atomic_read(&fscache_n_updates), | 172 | atomic_read(&fscache_n_updates), |
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c index de792dcf3274..e1f8171278bd 100644 --- a/fs/fuse/cuse.c +++ b/fs/fuse/cuse.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/magic.h> | 44 | #include <linux/magic.h> |
45 | #include <linux/miscdevice.h> | 45 | #include <linux/miscdevice.h> |
46 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
47 | #include <linux/slab.h> | ||
47 | #include <linux/spinlock.h> | 48 | #include <linux/spinlock.h> |
48 | #include <linux/stat.h> | 49 | #include <linux/stat.h> |
49 | 50 | ||
diff --git a/fs/generic_acl.c b/fs/generic_acl.c index 55458031e501..fe5df5457656 100644 --- a/fs/generic_acl.c +++ b/fs/generic_acl.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/gfp.h> | ||
10 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
11 | #include <linux/generic_acl.h> | 12 | #include <linux/generic_acl.h> |
12 | #include <linux/posix_acl.h> | 13 | #include <linux/posix_acl.h> |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 583e823307ae..5e411d5f4697 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c index 91beddadd388..bb7907bde3d8 100644 --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index d15876e9aa26..c22c21174833 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 38e3749d476c..49f97d3bb690 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 569b46240f61..0e0470ed34c2 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/dlm.h> | 11 | #include <linux/dlm.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | #include <linux/gfs2_ondisk.h> | 14 | #include <linux/gfs2_ondisk.h> |
14 | 15 | ||
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index b4106ddaaa98..f07119d89557 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #ifndef __RGRP_DOT_H__ | 10 | #ifndef __RGRP_DOT_H__ |
11 | #define __RGRP_DOT_H__ | 11 | #define __RGRP_DOT_H__ |
12 | 12 | ||
13 | #include <linux/slab.h> | ||
14 | |||
13 | struct gfs2_rgrpd; | 15 | struct gfs2_rgrpd; |
14 | struct gfs2_sbd; | 16 | struct gfs2_sbd; |
15 | struct gfs2_holder; | 17 | struct gfs2_holder; |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 419042f7f0b6..54fd98425991 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/slab.h> | ||
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 226f2bfbf16a..53511291fe36 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/slab.h> | ||
11 | #include <linux/spinlock.h> | 10 | #include <linux/spinlock.h> |
12 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
13 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c index 0d200068d0af..cdb41a1f6a64 100644 --- a/fs/hfs/bnode.c +++ b/fs/hfs/bnode.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/swap.h> | 13 | #include <linux/swap.h> |
13 | 14 | ||
14 | #include "btree.h" | 15 | #include "btree.h" |
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 052f214ea6f0..38a0a9917d7f 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/log2.h> | 13 | #include <linux/log2.h> |
13 | 14 | ||
14 | #include "btree.h" | 15 | #include "btree.h" |
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 8bbe03c3f6d5..86428f5ac991 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/cdrom.h> | 11 | #include <linux/cdrom.h> |
12 | #include <linux/genhd.h> | 12 | #include <linux/genhd.h> |
13 | #include <linux/nls.h> | 13 | #include <linux/nls.h> |
14 | #include <linux/slab.h> | ||
14 | 15 | ||
15 | #include "hfs_fs.h" | 16 | #include "hfs_fs.h" |
16 | #include "btree.h" | 17 | #include "btree.h" |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 5ed7252b7b23..0a81eb7111f3 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nls.h> | 19 | #include <linux/nls.h> |
20 | #include <linux/parser.h> | 20 | #include <linux/parser.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/smp_lock.h> | 23 | #include <linux/smp_lock.h> |
23 | #include <linux/vfs.h> | 24 | #include <linux/vfs.h> |
24 | 25 | ||
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c index 3fcbb0e1f6fc..572628b4b07d 100644 --- a/fs/hfsplus/options.c +++ b/fs/hfsplus/options.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/nls.h> | 15 | #include <linux/nls.h> |
16 | #include <linux/mount.h> | 16 | #include <linux/mount.h> |
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | #include <linux/slab.h> | ||
18 | #include "hfsplus_fs.h" | 19 | #include "hfsplus_fs.h" |
19 | 20 | ||
20 | enum { | 21 | enum { |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 032604e5ef2c..3a029d8f4cf1 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/statfs.h> | 13 | #include <linux/statfs.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
15 | #include <linux/mount.h> | 16 | #include <linux/mount.h> |
16 | #include "hostfs.h" | 17 | #include "hostfs.h" |
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index b6fca543544c..eac5f96323e3 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * general buffer i/o | 6 | * general buffer i/o |
7 | */ | 7 | */ |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | ||
9 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
10 | 11 | ||
11 | void hpfs_lock_creation(struct super_block *s) | 12 | void hpfs_lock_creation(struct super_block *s) |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 26e3964a4b8c..2338130cceba 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | 9 | #include <linux/smp_lock.h> |
10 | #include <linux/slab.h> | ||
10 | #include "hpfs_fn.h" | 11 | #include "hpfs_fn.h" |
11 | 12 | ||
12 | static int hpfs_dir_release(struct inode *inode, struct file *filp) | 13 | static int hpfs_dir_release(struct inode *inode, struct file *filp) |
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index ff90affb94e1..1042a9bc97f3 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | 9 | #include <linux/smp_lock.h> |
10 | #include <linux/slab.h> | ||
10 | #include "hpfs_fn.h" | 11 | #include "hpfs_fn.h" |
11 | 12 | ||
12 | void hpfs_init_inode(struct inode *i) | 13 | void hpfs_init_inode(struct inode *i) |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index cadc4ce48656..aa53842c599c 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp_lock.h> | 16 | #include <linux/smp_lock.h> |
17 | #include <linux/bitmap.h> | 17 | #include <linux/bitmap.h> |
18 | #include <linux/slab.h> | ||
18 | 19 | ||
19 | /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ | 20 | /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */ |
20 | 21 | ||
diff --git a/fs/ioprio.c b/fs/ioprio.c index c7c0b28d7d21..748cfb92dcc6 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * See also Documentation/block/ioprio.txt | 19 | * See also Documentation/block/ioprio.txt |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | #include <linux/gfp.h> | ||
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/ioprio.h> | 24 | #include <linux/ioprio.h> |
24 | #include <linux/blkdev.h> | 25 | #include <linux/blkdev.h> |
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 8ba5441063be..b9ab69b3a482 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * isofs directory handling functions | 11 | * isofs directory handling functions |
12 | */ | 12 | */ |
13 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
14 | #include <linux/gfp.h> | ||
14 | #include "isofs.h" | 15 | #include "isofs.h" |
15 | 16 | ||
16 | int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode) | 17 | int isofs_name_translate(struct iso_directory_record *de, char *new, struct inode *inode) |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index eaa831311c9c..ab438beb867c 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | 9 | #include <linux/smp_lock.h> |
10 | #include <linux/gfp.h> | ||
10 | #include "isofs.h" | 11 | #include "isofs.h" |
11 | 12 | ||
12 | /* | 13 | /* |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 2c90e3ef625f..ecb44c94ba8d 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/jbd.h> | 18 | #include <linux/jbd.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/slab.h> | ||
21 | #include <linux/mm.h> | 20 | #include <linux/mm.h> |
22 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
23 | #include <linux/bio.h> | 22 | #include <linux/bio.h> |
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index cb1a49ae605e..54c9bc9e1b17 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/jbd.h> | 21 | #include <linux/jbd.h> |
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/slab.h> | ||
24 | #endif | 23 | #endif |
25 | 24 | ||
26 | /* | 25 | /* |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 73063285b13f..049281b7cb89 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/jbd2.h> | 21 | #include <linux/jbd2.h> |
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/crc32.h> | 23 | #include <linux/crc32.h> |
25 | #endif | 24 | #endif |
26 | 25 | ||
diff --git a/fs/jffs2/compr_lzo.c b/fs/jffs2/compr_lzo.c index 90cb60d09787..cd02acafde8a 100644 --- a/fs/jffs2/compr_lzo.c +++ b/fs/jffs2/compr_lzo.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/slab.h> | ||
15 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/lzo.h> | 16 | #include <linux/lzo.h> |
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index cfd301a5edfc..b46661a42758 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/slab.h> | ||
18 | #include <linux/zlib.h> | 17 | #include <linux/zlib.h> |
19 | #include <linux/zutil.h> | 18 | #include <linux/zutil.h> |
20 | #include "nodelist.h" | 19 | #include "nodelist.h" |
diff --git a/fs/jffs2/debug.c b/fs/jffs2/debug.c index 5544d31c066b..ec3538413926 100644 --- a/fs/jffs2/debug.c +++ b/fs/jffs2/debug.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/crc32.h> | 15 | #include <linux/crc32.h> |
16 | #include <linux/jffs2.h> | 16 | #include <linux/jffs2.h> |
17 | #include <linux/mtd/mtd.h> | 17 | #include <linux/mtd/mtd.h> |
18 | #include <linux/slab.h> | ||
18 | #include "nodelist.h" | 19 | #include "nodelist.h" |
19 | #include "debug.h" | 20 | #include "debug.h" |
20 | 21 | ||
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index b7b74e299142..e7291c161a19 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/time.h> | 14 | #include <linux/time.h> |
16 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c index 87c6f555e1a0..af02bd138469 100644 --- a/fs/jffs2/nodelist.c +++ b/fs/jffs2/nodelist.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/mtd/mtd.h> | 15 | #include <linux/mtd/mtd.h> |
16 | #include <linux/rbtree.h> | 16 | #include <linux/rbtree.h> |
17 | #include <linux/crc32.h> | 17 | #include <linux/crc32.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
20 | #include "nodelist.h" | 19 | #include "nodelist.h" |
21 | 20 | ||
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 21a052915aa9..191359dde4e1 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/mtd/mtd.h> | 13 | #include <linux/mtd/mtd.h> |
15 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
16 | #include <linux/sched.h> /* For cond_resched() */ | 15 | #include <linux/sched.h> /* For cond_resched() */ |
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index 4ec11e8bda8c..b955626071c2 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/namei.h> | 14 | #include <linux/namei.h> |
16 | #include "nodelist.h" | 15 | #include "nodelist.h" |
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c index ca29440e9435..c819eb0e982d 100644 --- a/fs/jffs2/write.c +++ b/fs/jffs2/write.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/crc32.h> | 14 | #include <linux/crc32.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
17 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
18 | #include "nodelist.h" | 17 | #include "nodelist.h" |
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 213169780b6c..1057a4998e4e 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
23 | #include <linux/posix_acl_xattr.h> | 24 | #include <linux/posix_acl_xattr.h> |
24 | #include "jfs_incore.h" | 25 | #include "jfs_incore.h" |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 9dd126276c9f..ed9ba6fe04f5 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -61,7 +61,7 @@ struct inode *jfs_iget(struct super_block *sb, unsigned long ino) | |||
61 | inode->i_op = &page_symlink_inode_operations; | 61 | inode->i_op = &page_symlink_inode_operations; |
62 | inode->i_mapping->a_ops = &jfs_aops; | 62 | inode->i_mapping->a_ops = &jfs_aops; |
63 | } else { | 63 | } else { |
64 | inode->i_op = &jfs_symlink_inode_operations; | 64 | inode->i_op = &jfs_fast_symlink_inode_operations; |
65 | /* | 65 | /* |
66 | * The inline data should be null-terminated, but | 66 | * The inline data should be null-terminated, but |
67 | * don't let on-disk corruption crash the kernel | 67 | * don't let on-disk corruption crash the kernel |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index d9b031cf69f5..9e2f6a721668 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/slab.h> | ||
20 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
21 | #include "jfs_superblock.h" | 22 | #include "jfs_superblock.h" |
22 | #include "jfs_dmap.h" | 23 | #include "jfs_dmap.h" |
@@ -195,7 +196,7 @@ int dbMount(struct inode *ipbmap) | |||
195 | bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); | 196 | bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag); |
196 | bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); | 197 | bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref); |
197 | bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel); | 198 | bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel); |
198 | bmp->db_agheigth = le32_to_cpu(dbmp_le->dn_agheigth); | 199 | bmp->db_agheight = le32_to_cpu(dbmp_le->dn_agheight); |
199 | bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); | 200 | bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth); |
200 | bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart); | 201 | bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart); |
201 | bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size); | 202 | bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size); |
@@ -287,7 +288,7 @@ int dbSync(struct inode *ipbmap) | |||
287 | dbmp_le->dn_maxag = cpu_to_le32(bmp->db_maxag); | 288 | dbmp_le->dn_maxag = cpu_to_le32(bmp->db_maxag); |
288 | dbmp_le->dn_agpref = cpu_to_le32(bmp->db_agpref); | 289 | dbmp_le->dn_agpref = cpu_to_le32(bmp->db_agpref); |
289 | dbmp_le->dn_aglevel = cpu_to_le32(bmp->db_aglevel); | 290 | dbmp_le->dn_aglevel = cpu_to_le32(bmp->db_aglevel); |
290 | dbmp_le->dn_agheigth = cpu_to_le32(bmp->db_agheigth); | 291 | dbmp_le->dn_agheight = cpu_to_le32(bmp->db_agheight); |
291 | dbmp_le->dn_agwidth = cpu_to_le32(bmp->db_agwidth); | 292 | dbmp_le->dn_agwidth = cpu_to_le32(bmp->db_agwidth); |
292 | dbmp_le->dn_agstart = cpu_to_le32(bmp->db_agstart); | 293 | dbmp_le->dn_agstart = cpu_to_le32(bmp->db_agstart); |
293 | dbmp_le->dn_agl2size = cpu_to_le32(bmp->db_agl2size); | 294 | dbmp_le->dn_agl2size = cpu_to_le32(bmp->db_agl2size); |
@@ -1440,7 +1441,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) | |||
1440 | * tree index of this allocation group within the control page. | 1441 | * tree index of this allocation group within the control page. |
1441 | */ | 1442 | */ |
1442 | agperlev = | 1443 | agperlev = |
1443 | (1 << (L2LPERCTL - (bmp->db_agheigth << 1))) / bmp->db_agwidth; | 1444 | (1 << (L2LPERCTL - (bmp->db_agheight << 1))) / bmp->db_agwidth; |
1444 | ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev - 1)); | 1445 | ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev - 1)); |
1445 | 1446 | ||
1446 | /* dmap control page trees fan-out by 4 and a single allocation | 1447 | /* dmap control page trees fan-out by 4 and a single allocation |
@@ -1459,7 +1460,7 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results) | |||
1459 | * the subtree to find the leftmost leaf that describes this | 1460 | * the subtree to find the leftmost leaf that describes this |
1460 | * free space. | 1461 | * free space. |
1461 | */ | 1462 | */ |
1462 | for (k = bmp->db_agheigth; k > 0; k--) { | 1463 | for (k = bmp->db_agheight; k > 0; k--) { |
1463 | for (n = 0, m = (ti << 2) + 1; n < 4; n++) { | 1464 | for (n = 0, m = (ti << 2) + 1; n < 4; n++) { |
1464 | if (l2nb <= dcp->stree[m + n]) { | 1465 | if (l2nb <= dcp->stree[m + n]) { |
1465 | ti = m + n; | 1466 | ti = m + n; |
@@ -3606,7 +3607,7 @@ void dbFinalizeBmap(struct inode *ipbmap) | |||
3606 | } | 3607 | } |
3607 | 3608 | ||
3608 | /* | 3609 | /* |
3609 | * compute db_aglevel, db_agheigth, db_width, db_agstart: | 3610 | * compute db_aglevel, db_agheight, db_width, db_agstart: |
3610 | * an ag is covered in aglevel dmapctl summary tree, | 3611 | * an ag is covered in aglevel dmapctl summary tree, |
3611 | * at agheight level height (from leaf) with agwidth number of nodes | 3612 | * at agheight level height (from leaf) with agwidth number of nodes |
3612 | * each, which starts at agstart index node of the smmary tree node | 3613 | * each, which starts at agstart index node of the smmary tree node |
@@ -3615,9 +3616,9 @@ void dbFinalizeBmap(struct inode *ipbmap) | |||
3615 | bmp->db_aglevel = BMAPSZTOLEV(bmp->db_agsize); | 3616 | bmp->db_aglevel = BMAPSZTOLEV(bmp->db_agsize); |
3616 | l2nl = | 3617 | l2nl = |
3617 | bmp->db_agl2size - (L2BPERDMAP + bmp->db_aglevel * L2LPERCTL); | 3618 | bmp->db_agl2size - (L2BPERDMAP + bmp->db_aglevel * L2LPERCTL); |
3618 | bmp->db_agheigth = l2nl >> 1; | 3619 | bmp->db_agheight = l2nl >> 1; |
3619 | bmp->db_agwidth = 1 << (l2nl - (bmp->db_agheigth << 1)); | 3620 | bmp->db_agwidth = 1 << (l2nl - (bmp->db_agheight << 1)); |
3620 | for (i = 5 - bmp->db_agheigth, bmp->db_agstart = 0, n = 1; i > 0; | 3621 | for (i = 5 - bmp->db_agheight, bmp->db_agstart = 0, n = 1; i > 0; |
3621 | i--) { | 3622 | i--) { |
3622 | bmp->db_agstart += n; | 3623 | bmp->db_agstart += n; |
3623 | n <<= 2; | 3624 | n <<= 2; |
diff --git a/fs/jfs/jfs_dmap.h b/fs/jfs/jfs_dmap.h index 1a6eb41569bc..6dcb906c55d8 100644 --- a/fs/jfs/jfs_dmap.h +++ b/fs/jfs/jfs_dmap.h | |||
@@ -210,7 +210,7 @@ struct dbmap_disk { | |||
210 | __le32 dn_maxag; /* 4: max active alloc group number */ | 210 | __le32 dn_maxag; /* 4: max active alloc group number */ |
211 | __le32 dn_agpref; /* 4: preferred alloc group (hint) */ | 211 | __le32 dn_agpref; /* 4: preferred alloc group (hint) */ |
212 | __le32 dn_aglevel; /* 4: dmapctl level holding the AG */ | 212 | __le32 dn_aglevel; /* 4: dmapctl level holding the AG */ |
213 | __le32 dn_agheigth; /* 4: height in dmapctl of the AG */ | 213 | __le32 dn_agheight; /* 4: height in dmapctl of the AG */ |
214 | __le32 dn_agwidth; /* 4: width in dmapctl of the AG */ | 214 | __le32 dn_agwidth; /* 4: width in dmapctl of the AG */ |
215 | __le32 dn_agstart; /* 4: start tree index at AG height */ | 215 | __le32 dn_agstart; /* 4: start tree index at AG height */ |
216 | __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */ | 216 | __le32 dn_agl2size; /* 4: l2 num of blks per alloc group */ |
@@ -229,7 +229,7 @@ struct dbmap { | |||
229 | int dn_maxag; /* max active alloc group number */ | 229 | int dn_maxag; /* max active alloc group number */ |
230 | int dn_agpref; /* preferred alloc group (hint) */ | 230 | int dn_agpref; /* preferred alloc group (hint) */ |
231 | int dn_aglevel; /* dmapctl level holding the AG */ | 231 | int dn_aglevel; /* dmapctl level holding the AG */ |
232 | int dn_agheigth; /* height in dmapctl of the AG */ | 232 | int dn_agheight; /* height in dmapctl of the AG */ |
233 | int dn_agwidth; /* width in dmapctl of the AG */ | 233 | int dn_agwidth; /* width in dmapctl of the AG */ |
234 | int dn_agstart; /* start tree index at AG height */ | 234 | int dn_agstart; /* start tree index at AG height */ |
235 | int dn_agl2size; /* l2 num of blks per alloc group */ | 235 | int dn_agl2size; /* l2 num of blks per alloc group */ |
@@ -255,7 +255,7 @@ struct bmap { | |||
255 | #define db_agsize db_bmap.dn_agsize | 255 | #define db_agsize db_bmap.dn_agsize |
256 | #define db_agl2size db_bmap.dn_agl2size | 256 | #define db_agl2size db_bmap.dn_agl2size |
257 | #define db_agwidth db_bmap.dn_agwidth | 257 | #define db_agwidth db_bmap.dn_agwidth |
258 | #define db_agheigth db_bmap.dn_agheigth | 258 | #define db_agheight db_bmap.dn_agheight |
259 | #define db_agstart db_bmap.dn_agstart | 259 | #define db_agstart db_bmap.dn_agstart |
260 | #define db_numag db_bmap.dn_numag | 260 | #define db_numag db_bmap.dn_numag |
261 | #define db_maxlevel db_bmap.dn_maxlevel | 261 | #define db_maxlevel db_bmap.dn_maxlevel |
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 0e4623be70ce..9197a1b0d02d 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -102,6 +102,7 @@ | |||
102 | 102 | ||
103 | #include <linux/fs.h> | 103 | #include <linux/fs.h> |
104 | #include <linux/quotaops.h> | 104 | #include <linux/quotaops.h> |
105 | #include <linux/slab.h> | ||
105 | #include "jfs_incore.h" | 106 | #include "jfs_incore.h" |
106 | #include "jfs_superblock.h" | 107 | #include "jfs_superblock.h" |
107 | #include "jfs_filsys.h" | 108 | #include "jfs_filsys.h" |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 0fc30407f039..f8332dc8eeb2 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/buffer_head.h> | 45 | #include <linux/buffer_head.h> |
46 | #include <linux/pagemap.h> | 46 | #include <linux/pagemap.h> |
47 | #include <linux/quotaops.h> | 47 | #include <linux/quotaops.h> |
48 | #include <linux/slab.h> | ||
48 | 49 | ||
49 | #include "jfs_incore.h" | 50 | #include "jfs_incore.h" |
50 | #include "jfs_inode.h" | 51 | #include "jfs_inode.h" |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 79e2c79661df..9e6bda30a6e8 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -48,5 +48,6 @@ extern const struct file_operations jfs_dir_operations; | |||
48 | extern const struct inode_operations jfs_file_inode_operations; | 48 | extern const struct inode_operations jfs_file_inode_operations; |
49 | extern const struct file_operations jfs_file_operations; | 49 | extern const struct file_operations jfs_file_operations; |
50 | extern const struct inode_operations jfs_symlink_inode_operations; | 50 | extern const struct inode_operations jfs_symlink_inode_operations; |
51 | extern const struct inode_operations jfs_fast_symlink_inode_operations; | ||
51 | extern const struct dentry_operations jfs_ci_dentry_operations; | 52 | extern const struct dentry_operations jfs_ci_dentry_operations; |
52 | #endif /* _H_JFS_INODE */ | 53 | #endif /* _H_JFS_INODE */ |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 335c4de6552d..c51af2a14516 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <linux/delay.h> | 70 | #include <linux/delay.h> |
71 | #include <linux/mutex.h> | 71 | #include <linux/mutex.h> |
72 | #include <linux/seq_file.h> | 72 | #include <linux/seq_file.h> |
73 | #include <linux/slab.h> | ||
73 | #include "jfs_incore.h" | 74 | #include "jfs_incore.h" |
74 | #include "jfs_filsys.h" | 75 | #include "jfs_filsys.h" |
75 | #include "jfs_metapage.h" | 76 | #include "jfs_metapage.h" |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 07b6c5dfb4b6..48b44bd8267b 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/bio.h> | 23 | #include <linux/bio.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/init.h> | 25 | #include <linux/init.h> |
25 | #include <linux/buffer_head.h> | 26 | #include <linux/buffer_head.h> |
26 | #include <linux/mempool.h> | 27 | #include <linux/mempool.h> |
diff --git a/fs/jfs/jfs_unicode.h b/fs/jfs/jfs_unicode.h index 3fbb3a225590..8f0f02cb6ca6 100644 --- a/fs/jfs/jfs_unicode.h +++ b/fs/jfs/jfs_unicode.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef _H_JFS_UNICODE | 19 | #ifndef _H_JFS_UNICODE |
20 | #define _H_JFS_UNICODE | 20 | #define _H_JFS_UNICODE |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include <asm/byteorder.h> | 23 | #include <asm/byteorder.h> |
23 | #include "jfs_types.h" | 24 | #include "jfs_types.h" |
24 | 25 | ||
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 4a3e9f39c21d..a9cf8e8675be 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -956,7 +956,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
956 | */ | 956 | */ |
957 | 957 | ||
958 | if (ssize <= IDATASIZE) { | 958 | if (ssize <= IDATASIZE) { |
959 | ip->i_op = &jfs_symlink_inode_operations; | 959 | ip->i_op = &jfs_fast_symlink_inode_operations; |
960 | 960 | ||
961 | i_fastsymlink = JFS_IP(ip)->i_inline; | 961 | i_fastsymlink = JFS_IP(ip)->i_inline; |
962 | memcpy(i_fastsymlink, name, ssize); | 962 | memcpy(i_fastsymlink, name, ssize); |
@@ -978,7 +978,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
978 | else { | 978 | else { |
979 | jfs_info("jfs_symlink: allocate extent ip:0x%p", ip); | 979 | jfs_info("jfs_symlink: allocate extent ip:0x%p", ip); |
980 | 980 | ||
981 | ip->i_op = &page_symlink_inode_operations; | 981 | ip->i_op = &jfs_symlink_inode_operations; |
982 | ip->i_mapping->a_ops = &jfs_aops; | 982 | ip->i_mapping->a_ops = &jfs_aops; |
983 | 983 | ||
984 | /* | 984 | /* |
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c index 7f24a0bb08ca..1aba0039f1c9 100644 --- a/fs/jfs/resize.c +++ b/fs/jfs/resize.c | |||
@@ -81,6 +81,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
81 | struct inode *iplist[1]; | 81 | struct inode *iplist[1]; |
82 | struct jfs_superblock *j_sb, *j_sb2; | 82 | struct jfs_superblock *j_sb, *j_sb2; |
83 | uint old_agsize; | 83 | uint old_agsize; |
84 | int agsizechanged = 0; | ||
84 | struct buffer_head *bh, *bh2; | 85 | struct buffer_head *bh, *bh2; |
85 | 86 | ||
86 | /* If the volume hasn't grown, get out now */ | 87 | /* If the volume hasn't grown, get out now */ |
@@ -333,6 +334,9 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
333 | */ | 334 | */ |
334 | if ((rc = dbExtendFS(ipbmap, XAddress, nblocks))) | 335 | if ((rc = dbExtendFS(ipbmap, XAddress, nblocks))) |
335 | goto error_out; | 336 | goto error_out; |
337 | |||
338 | agsizechanged |= (bmp->db_agsize != old_agsize); | ||
339 | |||
336 | /* | 340 | /* |
337 | * the map now has extended to cover additional nblocks: | 341 | * the map now has extended to cover additional nblocks: |
338 | * dn_mapsize = oldMapsize + nblocks; | 342 | * dn_mapsize = oldMapsize + nblocks; |
@@ -432,7 +436,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) | |||
432 | * will correctly identify the new ag); | 436 | * will correctly identify the new ag); |
433 | */ | 437 | */ |
434 | /* if new AG size the same as old AG size, done! */ | 438 | /* if new AG size the same as old AG size, done! */ |
435 | if (bmp->db_agsize != old_agsize) { | 439 | if (agsizechanged) { |
436 | if ((rc = diExtendFS(ipimap, ipbmap))) | 440 | if ((rc = diExtendFS(ipimap, ipbmap))) |
437 | goto error_out; | 441 | goto error_out; |
438 | 442 | ||
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 266699deb1c6..157382fa6256 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
31 | #include <linux/exportfs.h> | 31 | #include <linux/exportfs.h> |
32 | #include <linux/crc32.h> | 32 | #include <linux/crc32.h> |
33 | #include <linux/slab.h> | ||
33 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
34 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
35 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index 4af1a05aad0a..205b946d8e0d 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c | |||
@@ -29,9 +29,21 @@ static void *jfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
29 | return NULL; | 29 | return NULL; |
30 | } | 30 | } |
31 | 31 | ||
32 | const struct inode_operations jfs_symlink_inode_operations = { | 32 | const struct inode_operations jfs_fast_symlink_inode_operations = { |
33 | .readlink = generic_readlink, | 33 | .readlink = generic_readlink, |
34 | .follow_link = jfs_follow_link, | 34 | .follow_link = jfs_follow_link, |
35 | .setattr = jfs_setattr, | ||
36 | .setxattr = jfs_setxattr, | ||
37 | .getxattr = jfs_getxattr, | ||
38 | .listxattr = jfs_listxattr, | ||
39 | .removexattr = jfs_removexattr, | ||
40 | }; | ||
41 | |||
42 | const struct inode_operations jfs_symlink_inode_operations = { | ||
43 | .readlink = generic_readlink, | ||
44 | .follow_link = page_follow_link_light, | ||
45 | .put_link = page_put_link, | ||
46 | .setattr = jfs_setattr, | ||
35 | .setxattr = jfs_setxattr, | 47 | .setxattr = jfs_setxattr, |
36 | .getxattr = jfs_getxattr, | 48 | .getxattr = jfs_getxattr, |
37 | .listxattr = jfs_listxattr, | 49 | .listxattr = jfs_listxattr, |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 1f594ab21895..fa96bbb26343 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/xattr.h> | 22 | #include <linux/xattr.h> |
23 | #include <linux/posix_acl_xattr.h> | 23 | #include <linux/posix_acl_xattr.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/quotaops.h> | 25 | #include <linux/quotaops.h> |
25 | #include <linux/security.h> | 26 | #include <linux/security.h> |
26 | #include "jfs_incore.h" | 27 | #include "jfs_incore.h" |
diff --git a/fs/libfs.c b/fs/libfs.c index 9e50bcf55857..ea9a6cc9b35c 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/pagemap.h> | 7 | #include <linux/pagemap.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/mount.h> | 9 | #include <linux/mount.h> |
9 | #include <linux/vfs.h> | 10 | #include <linux/vfs.h> |
10 | #include <linux/mutex.h> | 11 | #include <linux/mutex.h> |
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index fc9032dc8862..64fd427c993c 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/slab.h> | ||
11 | #include <linux/time.h> | 12 | #include <linux/time.h> |
12 | #include <linux/nfs_fs.h> | 13 | #include <linux/nfs_fs.h> |
13 | #include <linux/sunrpc/clnt.h> | 14 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index c81249fef11f..7932c399fab4 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/smp_lock.h> | 10 | #include <linux/smp_lock.h> |
11 | #include <linux/slab.h> | ||
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
13 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index fefa4df3f005..e3015464fbab 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/utsname.h> | 10 | #include <linux/utsname.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/ktime.h> | 12 | #include <linux/ktime.h> |
13 | #include <linux/slab.h> | ||
13 | 14 | ||
14 | #include <linux/sunrpc/clnt.h> | 15 | #include <linux/sunrpc/clnt.h> |
15 | #include <linux/sunrpc/xprtsock.h> | 16 | #include <linux/sunrpc/xprtsock.h> |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 7d150517ddf0..f1bacf1a0391 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/in.h> | 22 | #include <linux/in.h> |
23 | #include <linux/uio.h> | 23 | #include <linux/uio.h> |
24 | #include <linux/slab.h> | ||
25 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
26 | #include <linux/smp_lock.h> | 25 | #include <linux/smp_lock.h> |
27 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index a7966eed3c17..031c6569a134 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | ||
13 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
14 | #include <linux/lockd/lockd.h> | 13 | #include <linux/lockd/lockd.h> |
15 | #include <linux/lockd/share.h> | 14 | #include <linux/lockd/share.h> |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index d1001790fa9a..84055d31bfc5 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
26 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 56c9519d900a..0f2ab741ae7c 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | ||
13 | #include <linux/smp_lock.h> | 12 | #include <linux/smp_lock.h> |
14 | #include <linux/lockd/lockd.h> | 13 | #include <linux/lockd/lockd.h> |
15 | #include <linux/lockd/share.h> | 14 | #include <linux/lockd/share.h> |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index ad478da7ca63..d0ef94cfb3da 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/in.h> | 12 | #include <linux/in.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
14 | #include <linux/sunrpc/svc.h> | 15 | #include <linux/sunrpc/svc.h> |
15 | #include <linux/sunrpc/clnt.h> | 16 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c index 9718c22f186d..243c00071f76 100644 --- a/fs/logfs/dev_bdev.c +++ b/fs/logfs/dev_bdev.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/bio.h> | 9 | #include <linux/bio.h> |
10 | #include <linux/blkdev.h> | 10 | #include <linux/blkdev.h> |
11 | #include <linux/buffer_head.h> | 11 | #include <linux/buffer_head.h> |
12 | #include <linux/gfp.h> | ||
12 | 13 | ||
13 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) | 14 | #define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1)) |
14 | 15 | ||
@@ -80,6 +81,7 @@ static void writeseg_end_io(struct bio *bio, int err) | |||
80 | prefetchw(&bvec->bv_page->flags); | 81 | prefetchw(&bvec->bv_page->flags); |
81 | 82 | ||
82 | end_page_writeback(page); | 83 | end_page_writeback(page); |
84 | page_cache_release(page); | ||
83 | } while (bvec >= bio->bi_io_vec); | 85 | } while (bvec >= bio->bi_io_vec); |
84 | bio_put(bio); | 86 | bio_put(bio); |
85 | if (atomic_dec_and_test(&super->s_pending_writes)) | 87 | if (atomic_dec_and_test(&super->s_pending_writes)) |
@@ -97,8 +99,10 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index, | |||
97 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); | 99 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
98 | int i; | 100 | int i; |
99 | 101 | ||
102 | if (max_pages > BIO_MAX_PAGES) | ||
103 | max_pages = BIO_MAX_PAGES; | ||
100 | bio = bio_alloc(GFP_NOFS, max_pages); | 104 | bio = bio_alloc(GFP_NOFS, max_pages); |
101 | BUG_ON(!bio); /* FIXME: handle this */ | 105 | BUG_ON(!bio); |
102 | 106 | ||
103 | for (i = 0; i < nr_pages; i++) { | 107 | for (i = 0; i < nr_pages; i++) { |
104 | if (i >= max_pages) { | 108 | if (i >= max_pages) { |
@@ -191,8 +195,10 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index, | |||
191 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); | 195 | unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9); |
192 | int i; | 196 | int i; |
193 | 197 | ||
198 | if (max_pages > BIO_MAX_PAGES) | ||
199 | max_pages = BIO_MAX_PAGES; | ||
194 | bio = bio_alloc(GFP_NOFS, max_pages); | 200 | bio = bio_alloc(GFP_NOFS, max_pages); |
195 | BUG_ON(!bio); /* FIXME: handle this */ | 201 | BUG_ON(!bio); |
196 | 202 | ||
197 | for (i = 0; i < nr_pages; i++) { | 203 | for (i = 0; i < nr_pages; i++) { |
198 | if (i >= max_pages) { | 204 | if (i >= max_pages) { |
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index 56a8bfbb0120..2396a85c0f55 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> | 6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> |
7 | */ | 7 | */ |
8 | #include "logfs.h" | 8 | #include "logfs.h" |
9 | 9 | #include <linux/slab.h> | |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * Atomic dir operations | 12 | * Atomic dir operations |
@@ -303,12 +303,12 @@ static int __logfs_readdir(struct file *file, void *buf, filldir_t filldir) | |||
303 | (filler_t *)logfs_readpage, NULL); | 303 | (filler_t *)logfs_readpage, NULL); |
304 | if (IS_ERR(page)) | 304 | if (IS_ERR(page)) |
305 | return PTR_ERR(page); | 305 | return PTR_ERR(page); |
306 | dd = kmap_atomic(page, KM_USER0); | 306 | dd = kmap(page); |
307 | BUG_ON(dd->namelen == 0); | 307 | BUG_ON(dd->namelen == 0); |
308 | 308 | ||
309 | full = filldir(buf, (char *)dd->name, be16_to_cpu(dd->namelen), | 309 | full = filldir(buf, (char *)dd->name, be16_to_cpu(dd->namelen), |
310 | pos, be64_to_cpu(dd->ino), dd->type); | 310 | pos, be64_to_cpu(dd->ino), dd->type); |
311 | kunmap_atomic(dd, KM_USER0); | 311 | kunmap(page); |
312 | page_cache_release(page); | 312 | page_cache_release(page); |
313 | if (full) | 313 | if (full) |
314 | break; | 314 | break; |
diff --git a/fs/logfs/gc.c b/fs/logfs/gc.c index 92949f95a901..76c242fbe1b0 100644 --- a/fs/logfs/gc.c +++ b/fs/logfs/gc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include "logfs.h" | 8 | #include "logfs.h" |
9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
10 | #include <linux/slab.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * Wear leveling needs to kick in when the difference between low erase | 13 | * Wear leveling needs to kick in when the difference between low erase |
@@ -458,6 +459,14 @@ static void __logfs_gc_pass(struct super_block *sb, int target) | |||
458 | struct logfs_block *block; | 459 | struct logfs_block *block; |
459 | int round, progress, last_progress = 0; | 460 | int round, progress, last_progress = 0; |
460 | 461 | ||
462 | /* | ||
463 | * Doing too many changes to the segfile at once would result | ||
464 | * in a large number of aliases. Write the journal before | ||
465 | * things get out of hand. | ||
466 | */ | ||
467 | if (super->s_shadow_tree.no_shadowed_segments >= MAX_OBJ_ALIASES) | ||
468 | logfs_write_anchor(sb); | ||
469 | |||
461 | if (no_free_segments(sb) >= target && | 470 | if (no_free_segments(sb) >= target && |
462 | super->s_no_object_aliases < MAX_OBJ_ALIASES) | 471 | super->s_no_object_aliases < MAX_OBJ_ALIASES) |
463 | return; | 472 | return; |
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index 33ec1aeaeec4..14ed27274da2 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> | 6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> |
7 | */ | 7 | */ |
8 | #include "logfs.h" | 8 | #include "logfs.h" |
9 | #include <linux/slab.h> | ||
9 | #include <linux/writeback.h> | 10 | #include <linux/writeback.h> |
10 | #include <linux/backing-dev.h> | 11 | #include <linux/backing-dev.h> |
11 | 12 | ||
diff --git a/fs/logfs/journal.c b/fs/logfs/journal.c index 6ad30a4c9052..fb0a613f885b 100644 --- a/fs/logfs/journal.c +++ b/fs/logfs/journal.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> | 6 | * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org> |
7 | */ | 7 | */ |
8 | #include "logfs.h" | 8 | #include "logfs.h" |
9 | #include <linux/slab.h> | ||
9 | 10 | ||
10 | static void logfs_calc_free(struct super_block *sb) | 11 | static void logfs_calc_free(struct super_block *sb) |
11 | { | 12 | { |
@@ -388,7 +389,10 @@ static void journal_get_erase_count(struct logfs_area *area) | |||
388 | static int journal_erase_segment(struct logfs_area *area) | 389 | static int journal_erase_segment(struct logfs_area *area) |
389 | { | 390 | { |
390 | struct super_block *sb = area->a_sb; | 391 | struct super_block *sb = area->a_sb; |
391 | struct logfs_segment_header sh; | 392 | union { |
393 | struct logfs_segment_header sh; | ||
394 | unsigned char c[ALIGN(sizeof(struct logfs_segment_header), 16)]; | ||
395 | } u; | ||
392 | u64 ofs; | 396 | u64 ofs; |
393 | int err; | 397 | int err; |
394 | 398 | ||
@@ -396,20 +400,21 @@ static int journal_erase_segment(struct logfs_area *area) | |||
396 | if (err) | 400 | if (err) |
397 | return err; | 401 | return err; |
398 | 402 | ||
399 | sh.pad = 0; | 403 | memset(&u, 0, sizeof(u)); |
400 | sh.type = SEG_JOURNAL; | 404 | u.sh.pad = 0; |
401 | sh.level = 0; | 405 | u.sh.type = SEG_JOURNAL; |
402 | sh.segno = cpu_to_be32(area->a_segno); | 406 | u.sh.level = 0; |
403 | sh.ec = cpu_to_be32(area->a_erase_count); | 407 | u.sh.segno = cpu_to_be32(area->a_segno); |
404 | sh.gec = cpu_to_be64(logfs_super(sb)->s_gec); | 408 | u.sh.ec = cpu_to_be32(area->a_erase_count); |
405 | sh.crc = logfs_crc32(&sh, sizeof(sh), 4); | 409 | u.sh.gec = cpu_to_be64(logfs_super(sb)->s_gec); |
410 | u.sh.crc = logfs_crc32(&u.sh, sizeof(u.sh), 4); | ||
406 | 411 | ||
407 | /* This causes a bug in segment.c. Not yet. */ | 412 | /* This causes a bug in segment.c. Not yet. */ |
408 | //logfs_set_segment_erased(sb, area->a_segno, area->a_erase_count, 0); | 413 | //logfs_set_segment_erased(sb, area->a_segno, area->a_erase_count, 0); |
409 | 414 | ||
410 | ofs = dev_ofs(sb, area->a_segno, 0); | 415 | ofs = dev_ofs(sb, area->a_segno, 0); |
411 | area->a_used_bytes = ALIGN(sizeof(sh), 16); | 416 | area->a_used_bytes = sizeof(u); |
412 | logfs_buf_write(area, ofs, &sh, sizeof(sh)); | 417 | logfs_buf_write(area, ofs, &u, sizeof(u)); |
413 | return 0; | 418 | return 0; |
414 | } | 419 | } |
415 | 420 | ||
@@ -493,6 +498,8 @@ static void account_shadows(struct super_block *sb) | |||
493 | 498 | ||
494 | btree_grim_visitor64(&tree->new, (unsigned long)sb, account_shadow); | 499 | btree_grim_visitor64(&tree->new, (unsigned long)sb, account_shadow); |
495 | btree_grim_visitor64(&tree->old, (unsigned long)sb, account_shadow); | 500 | btree_grim_visitor64(&tree->old, (unsigned long)sb, account_shadow); |
501 | btree_grim_visitor32(&tree->segment_map, 0, NULL); | ||
502 | tree->no_shadowed_segments = 0; | ||
496 | 503 | ||
497 | if (li->li_block) { | 504 | if (li->li_block) { |
498 | /* | 505 | /* |
@@ -606,9 +613,9 @@ static size_t __logfs_write_je(struct super_block *sb, void *buf, u16 type, | |||
606 | if (len == 0) | 613 | if (len == 0) |
607 | return logfs_write_header(super, header, 0, type); | 614 | return logfs_write_header(super, header, 0, type); |
608 | 615 | ||
616 | BUG_ON(len > sb->s_blocksize); | ||
609 | compr_len = logfs_compress(buf, data, len, sb->s_blocksize); | 617 | compr_len = logfs_compress(buf, data, len, sb->s_blocksize); |
610 | if (compr_len < 0 || type == JE_ANCHOR) { | 618 | if (compr_len < 0 || type == JE_ANCHOR) { |
611 | BUG_ON(len > sb->s_blocksize); | ||
612 | memcpy(data, buf, len); | 619 | memcpy(data, buf, len); |
613 | compr_len = len; | 620 | compr_len = len; |
614 | compr = COMPR_NONE; | 621 | compr = COMPR_NONE; |
@@ -660,6 +667,7 @@ static int logfs_write_je_buf(struct super_block *sb, void *buf, u16 type, | |||
660 | if (ofs < 0) | 667 | if (ofs < 0) |
661 | return ofs; | 668 | return ofs; |
662 | logfs_buf_write(area, ofs, super->s_compressed_je, len); | 669 | logfs_buf_write(area, ofs, super->s_compressed_je, len); |
670 | BUG_ON(super->s_no_je >= MAX_JOURNAL_ENTRIES); | ||
663 | super->s_je_array[super->s_no_je++] = cpu_to_be64(ofs); | 671 | super->s_je_array[super->s_no_je++] = cpu_to_be64(ofs); |
664 | return 0; | 672 | return 0; |
665 | } | 673 | } |
@@ -800,6 +808,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb) | |||
800 | { | 808 | { |
801 | struct logfs_super *super = logfs_super(sb); | 809 | struct logfs_super *super = logfs_super(sb); |
802 | struct logfs_area *area = super->s_journal_area; | 810 | struct logfs_area *area = super->s_journal_area; |
811 | struct btree_head32 *head = &super->s_reserved_segments; | ||
803 | u32 segno, ec; | 812 | u32 segno, ec; |
804 | int i, err; | 813 | int i, err; |
805 | 814 | ||
@@ -807,6 +816,7 @@ void do_logfs_journal_wl_pass(struct super_block *sb) | |||
807 | /* Drop old segments */ | 816 | /* Drop old segments */ |
808 | journal_for_each(i) | 817 | journal_for_each(i) |
809 | if (super->s_journal_seg[i]) { | 818 | if (super->s_journal_seg[i]) { |
819 | btree_remove32(head, super->s_journal_seg[i]); | ||
810 | logfs_set_segment_unreserved(sb, | 820 | logfs_set_segment_unreserved(sb, |
811 | super->s_journal_seg[i], | 821 | super->s_journal_seg[i], |
812 | super->s_journal_ec[i]); | 822 | super->s_journal_ec[i]); |
@@ -819,8 +829,13 @@ void do_logfs_journal_wl_pass(struct super_block *sb) | |||
819 | super->s_journal_seg[i] = segno; | 829 | super->s_journal_seg[i] = segno; |
820 | super->s_journal_ec[i] = ec; | 830 | super->s_journal_ec[i] = ec; |
821 | logfs_set_segment_reserved(sb, segno); | 831 | logfs_set_segment_reserved(sb, segno); |
832 | err = btree_insert32(head, segno, (void *)1, GFP_KERNEL); | ||
833 | BUG_ON(err); /* mempool should prevent this */ | ||
834 | err = logfs_erase_segment(sb, segno, 1); | ||
835 | BUG_ON(err); /* FIXME: remount-ro would be nicer */ | ||
822 | } | 836 | } |
823 | /* Manually move journal_area */ | 837 | /* Manually move journal_area */ |
838 | freeseg(sb, area->a_segno); | ||
824 | area->a_segno = super->s_journal_seg[0]; | 839 | area->a_segno = super->s_journal_seg[0]; |
825 | area->a_is_open = 0; | 840 | area->a_is_open = 0; |
826 | area->a_used_bytes = 0; | 841 | area->a_used_bytes = 0; |
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h index 129779431373..0a3df1a0c936 100644 --- a/fs/logfs/logfs.h +++ b/fs/logfs/logfs.h | |||
@@ -257,10 +257,14 @@ struct logfs_shadow { | |||
257 | * struct shadow_tree | 257 | * struct shadow_tree |
258 | * @new: shadows where old_ofs==0, indexed by new_ofs | 258 | * @new: shadows where old_ofs==0, indexed by new_ofs |
259 | * @old: shadows where old_ofs!=0, indexed by old_ofs | 259 | * @old: shadows where old_ofs!=0, indexed by old_ofs |
260 | * @segment_map: bitfield of segments containing shadows | ||
261 | * @no_shadowed_segment: number of segments containing shadows | ||
260 | */ | 262 | */ |
261 | struct shadow_tree { | 263 | struct shadow_tree { |
262 | struct btree_head64 new; | 264 | struct btree_head64 new; |
263 | struct btree_head64 old; | 265 | struct btree_head64 old; |
266 | struct btree_head32 segment_map; | ||
267 | int no_shadowed_segments; | ||
264 | }; | 268 | }; |
265 | 269 | ||
266 | struct object_alias_item { | 270 | struct object_alias_item { |
@@ -305,13 +309,14 @@ typedef int write_alias_t(struct super_block *sb, u64 ino, u64 bix, | |||
305 | level_t level, int child_no, __be64 val); | 309 | level_t level, int child_no, __be64 val); |
306 | struct logfs_block_ops { | 310 | struct logfs_block_ops { |
307 | void (*write_block)(struct logfs_block *block); | 311 | void (*write_block)(struct logfs_block *block); |
308 | gc_level_t (*block_level)(struct logfs_block *block); | ||
309 | void (*free_block)(struct super_block *sb, struct logfs_block*block); | 312 | void (*free_block)(struct super_block *sb, struct logfs_block*block); |
310 | int (*write_alias)(struct super_block *sb, | 313 | int (*write_alias)(struct super_block *sb, |
311 | struct logfs_block *block, | 314 | struct logfs_block *block, |
312 | write_alias_t *write_one_alias); | 315 | write_alias_t *write_one_alias); |
313 | }; | 316 | }; |
314 | 317 | ||
318 | #define MAX_JOURNAL_ENTRIES 256 | ||
319 | |||
315 | struct logfs_super { | 320 | struct logfs_super { |
316 | struct mtd_info *s_mtd; /* underlying device */ | 321 | struct mtd_info *s_mtd; /* underlying device */ |
317 | struct block_device *s_bdev; /* underlying device */ | 322 | struct block_device *s_bdev; /* underlying device */ |
@@ -378,7 +383,7 @@ struct logfs_super { | |||
378 | u32 s_journal_ec[LOGFS_JOURNAL_SEGS]; /* journal erasecounts */ | 383 | u32 s_journal_ec[LOGFS_JOURNAL_SEGS]; /* journal erasecounts */ |
379 | u64 s_last_version; | 384 | u64 s_last_version; |
380 | struct logfs_area *s_journal_area; /* open journal segment */ | 385 | struct logfs_area *s_journal_area; /* open journal segment */ |
381 | __be64 s_je_array[64]; | 386 | __be64 s_je_array[MAX_JOURNAL_ENTRIES]; |
382 | int s_no_je; | 387 | int s_no_je; |
383 | 388 | ||
384 | int s_sum_index; /* for the 12 summaries */ | 389 | int s_sum_index; /* for the 12 summaries */ |
@@ -587,6 +592,7 @@ void move_page_to_btree(struct page *page); | |||
587 | int logfs_init_mapping(struct super_block *sb); | 592 | int logfs_init_mapping(struct super_block *sb); |
588 | void logfs_sync_area(struct logfs_area *area); | 593 | void logfs_sync_area(struct logfs_area *area); |
589 | void logfs_sync_segments(struct super_block *sb); | 594 | void logfs_sync_segments(struct super_block *sb); |
595 | void freeseg(struct super_block *sb, u32 segno); | ||
590 | 596 | ||
591 | /* area handling */ | 597 | /* area handling */ |
592 | int logfs_init_areas(struct super_block *sb); | 598 | int logfs_init_areas(struct super_block *sb); |
@@ -721,4 +727,10 @@ static inline struct logfs_area *get_area(struct super_block *sb, | |||
721 | return logfs_super(sb)->s_area[(__force u8)gc_level]; | 727 | return logfs_super(sb)->s_area[(__force u8)gc_level]; |
722 | } | 728 | } |
723 | 729 | ||
730 | static inline void logfs_mempool_destroy(mempool_t *pool) | ||
731 | { | ||
732 | if (pool) | ||
733 | mempool_destroy(pool); | ||
734 | } | ||
735 | |||
724 | #endif | 736 | #endif |
diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c index 7a23b3e7c0a7..3159db6958e5 100644 --- a/fs/logfs/readwrite.c +++ b/fs/logfs/readwrite.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | #include "logfs.h" | 19 | #include "logfs.h" |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | static u64 adjust_bix(u64 bix, level_t level) | 23 | static u64 adjust_bix(u64 bix, level_t level) |
23 | { | 24 | { |
@@ -429,25 +430,6 @@ static void inode_write_block(struct logfs_block *block) | |||
429 | } | 430 | } |
430 | } | 431 | } |
431 | 432 | ||
432 | static gc_level_t inode_block_level(struct logfs_block *block) | ||
433 | { | ||
434 | BUG_ON(block->inode->i_ino == LOGFS_INO_MASTER); | ||
435 | return GC_LEVEL(LOGFS_MAX_LEVELS); | ||
436 | } | ||
437 | |||
438 | static gc_level_t indirect_block_level(struct logfs_block *block) | ||
439 | { | ||
440 | struct page *page; | ||
441 | struct inode *inode; | ||
442 | u64 bix; | ||
443 | level_t level; | ||
444 | |||
445 | page = block->page; | ||
446 | inode = page->mapping->host; | ||
447 | logfs_unpack_index(page->index, &bix, &level); | ||
448 | return expand_level(inode->i_ino, level); | ||
449 | } | ||
450 | |||
451 | /* | 433 | /* |
452 | * This silences a false, yet annoying gcc warning. I hate it when my editor | 434 | * This silences a false, yet annoying gcc warning. I hate it when my editor |
453 | * jumps into bitops.h each time I recompile this file. | 435 | * jumps into bitops.h each time I recompile this file. |
@@ -586,14 +568,12 @@ static void indirect_free_block(struct super_block *sb, | |||
586 | 568 | ||
587 | static struct logfs_block_ops inode_block_ops = { | 569 | static struct logfs_block_ops inode_block_ops = { |
588 | .write_block = inode_write_block, | 570 | .write_block = inode_write_block, |
589 | .block_level = inode_block_level, | ||
590 | .free_block = inode_free_block, | 571 | .free_block = inode_free_block, |
591 | .write_alias = inode_write_alias, | 572 | .write_alias = inode_write_alias, |
592 | }; | 573 | }; |
593 | 574 | ||
594 | struct logfs_block_ops indirect_block_ops = { | 575 | struct logfs_block_ops indirect_block_ops = { |
595 | .write_block = indirect_write_block, | 576 | .write_block = indirect_write_block, |
596 | .block_level = indirect_block_level, | ||
597 | .free_block = indirect_free_block, | 577 | .free_block = indirect_free_block, |
598 | .write_alias = indirect_write_alias, | 578 | .write_alias = indirect_write_alias, |
599 | }; | 579 | }; |
@@ -1240,6 +1220,18 @@ static void free_shadow(struct inode *inode, struct logfs_shadow *shadow) | |||
1240 | mempool_free(shadow, super->s_shadow_pool); | 1220 | mempool_free(shadow, super->s_shadow_pool); |
1241 | } | 1221 | } |
1242 | 1222 | ||
1223 | static void mark_segment(struct shadow_tree *tree, u32 segno) | ||
1224 | { | ||
1225 | int err; | ||
1226 | |||
1227 | if (!btree_lookup32(&tree->segment_map, segno)) { | ||
1228 | err = btree_insert32(&tree->segment_map, segno, (void *)1, | ||
1229 | GFP_NOFS); | ||
1230 | BUG_ON(err); | ||
1231 | tree->no_shadowed_segments++; | ||
1232 | } | ||
1233 | } | ||
1234 | |||
1243 | /** | 1235 | /** |
1244 | * fill_shadow_tree - Propagate shadow tree changes due to a write | 1236 | * fill_shadow_tree - Propagate shadow tree changes due to a write |
1245 | * @inode: Inode owning the page | 1237 | * @inode: Inode owning the page |
@@ -1287,6 +1279,8 @@ static void fill_shadow_tree(struct inode *inode, struct page *page, | |||
1287 | 1279 | ||
1288 | super->s_dirty_used_bytes += shadow->new_len; | 1280 | super->s_dirty_used_bytes += shadow->new_len; |
1289 | super->s_dirty_free_bytes += shadow->old_len; | 1281 | super->s_dirty_free_bytes += shadow->old_len; |
1282 | mark_segment(tree, shadow->old_ofs >> super->s_segshift); | ||
1283 | mark_segment(tree, shadow->new_ofs >> super->s_segshift); | ||
1290 | } | 1284 | } |
1291 | } | 1285 | } |
1292 | 1286 | ||
@@ -1594,7 +1588,6 @@ int logfs_delete(struct inode *inode, pgoff_t index, | |||
1594 | return ret; | 1588 | return ret; |
1595 | } | 1589 | } |
1596 | 1590 | ||
1597 | /* Rewrite cannot mark the inode dirty but has to write it immediatly. */ | ||
1598 | int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs, | 1591 | int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs, |
1599 | gc_level_t gc_level, long flags) | 1592 | gc_level_t gc_level, long flags) |
1600 | { | 1593 | { |
@@ -1611,6 +1604,18 @@ int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs, | |||
1611 | if (level != 0) | 1604 | if (level != 0) |
1612 | alloc_indirect_block(inode, page, 0); | 1605 | alloc_indirect_block(inode, page, 0); |
1613 | err = logfs_write_buf(inode, page, flags); | 1606 | err = logfs_write_buf(inode, page, flags); |
1607 | if (!err && shrink_level(gc_level) == 0) { | ||
1608 | /* Rewrite cannot mark the inode dirty but has to | ||
1609 | * write it immediatly. | ||
1610 | * Q: Can't we just create an alias for the inode | ||
1611 | * instead? And if not, why not? | ||
1612 | */ | ||
1613 | if (inode->i_ino == LOGFS_INO_MASTER) | ||
1614 | logfs_write_anchor(inode->i_sb); | ||
1615 | else { | ||
1616 | err = __logfs_write_inode(inode, flags); | ||
1617 | } | ||
1618 | } | ||
1614 | } | 1619 | } |
1615 | logfs_put_write_page(page); | 1620 | logfs_put_write_page(page); |
1616 | return err; | 1621 | return err; |
@@ -1833,19 +1838,37 @@ static int __logfs_truncate(struct inode *inode, u64 size) | |||
1833 | return logfs_truncate_direct(inode, size); | 1838 | return logfs_truncate_direct(inode, size); |
1834 | } | 1839 | } |
1835 | 1840 | ||
1836 | int logfs_truncate(struct inode *inode, u64 size) | 1841 | /* |
1842 | * Truncate, by changing the segment file, can consume a fair amount | ||
1843 | * of resources. So back off from time to time and do some GC. | ||
1844 | * 8 or 2048 blocks should be well within safety limits even if | ||
1845 | * every single block resided in a different segment. | ||
1846 | */ | ||
1847 | #define TRUNCATE_STEP (8 * 1024 * 1024) | ||
1848 | int logfs_truncate(struct inode *inode, u64 target) | ||
1837 | { | 1849 | { |
1838 | struct super_block *sb = inode->i_sb; | 1850 | struct super_block *sb = inode->i_sb; |
1839 | int err; | 1851 | u64 size = i_size_read(inode); |
1852 | int err = 0; | ||
1840 | 1853 | ||
1841 | logfs_get_wblocks(sb, NULL, 1); | 1854 | size = ALIGN(size, TRUNCATE_STEP); |
1842 | err = __logfs_truncate(inode, size); | 1855 | while (size > target) { |
1843 | if (!err) | 1856 | if (size > TRUNCATE_STEP) |
1844 | err = __logfs_write_inode(inode, 0); | 1857 | size -= TRUNCATE_STEP; |
1845 | logfs_put_wblocks(sb, NULL, 1); | 1858 | else |
1859 | size = 0; | ||
1860 | if (size < target) | ||
1861 | size = target; | ||
1862 | |||
1863 | logfs_get_wblocks(sb, NULL, 1); | ||
1864 | err = __logfs_truncate(inode, target); | ||
1865 | if (!err) | ||
1866 | err = __logfs_write_inode(inode, 0); | ||
1867 | logfs_put_wblocks(sb, NULL, 1); | ||
1868 | } | ||
1846 | 1869 | ||
1847 | if (!err) | 1870 | if (!err) |
1848 | err = vmtruncate(inode, size); | 1871 | err = vmtruncate(inode, target); |
1849 | 1872 | ||
1850 | /* I don't trust error recovery yet. */ | 1873 | /* I don't trust error recovery yet. */ |
1851 | WARN_ON(err); | 1874 | WARN_ON(err); |
@@ -2239,8 +2262,6 @@ void logfs_cleanup_rw(struct super_block *sb) | |||
2239 | struct logfs_super *super = logfs_super(sb); | 2262 | struct logfs_super *super = logfs_super(sb); |
2240 | 2263 | ||
2241 | destroy_meta_inode(super->s_segfile_inode); | 2264 | destroy_meta_inode(super->s_segfile_inode); |
2242 | if (super->s_block_pool) | 2265 | logfs_mempool_destroy(super->s_block_pool); |
2243 | mempool_destroy(super->s_block_pool); | 2266 | logfs_mempool_destroy(super->s_shadow_pool); |
2244 | if (super->s_shadow_pool) | ||
2245 | mempool_destroy(super->s_shadow_pool); | ||
2246 | } | 2267 | } |
diff --git a/fs/logfs/segment.c b/fs/logfs/segment.c index 1a14f9910d55..f77ce2b470ba 100644 --- a/fs/logfs/segment.c +++ b/fs/logfs/segment.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * three kinds of objects: inodes, dentries and blocks, both data and indirect. | 10 | * three kinds of objects: inodes, dentries and blocks, both data and indirect. |
11 | */ | 11 | */ |
12 | #include "logfs.h" | 12 | #include "logfs.h" |
13 | #include <linux/slab.h> | ||
13 | 14 | ||
14 | static int logfs_mark_segment_bad(struct super_block *sb, u32 segno) | 15 | static int logfs_mark_segment_bad(struct super_block *sb, u32 segno) |
15 | { | 16 | { |
@@ -93,50 +94,58 @@ void __logfs_buf_write(struct logfs_area *area, u64 ofs, void *buf, size_t len, | |||
93 | } while (len); | 94 | } while (len); |
94 | } | 95 | } |
95 | 96 | ||
96 | /* | 97 | static void pad_partial_page(struct logfs_area *area) |
97 | * bdev_writeseg will write full pages. Memset the tail to prevent data leaks. | ||
98 | */ | ||
99 | static void pad_wbuf(struct logfs_area *area, int final) | ||
100 | { | 98 | { |
101 | struct super_block *sb = area->a_sb; | 99 | struct super_block *sb = area->a_sb; |
102 | struct logfs_super *super = logfs_super(sb); | ||
103 | struct page *page; | 100 | struct page *page; |
104 | u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes); | 101 | u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes); |
105 | pgoff_t index = ofs >> PAGE_SHIFT; | 102 | pgoff_t index = ofs >> PAGE_SHIFT; |
106 | long offset = ofs & (PAGE_SIZE-1); | 103 | long offset = ofs & (PAGE_SIZE-1); |
107 | u32 len = PAGE_SIZE - offset; | 104 | u32 len = PAGE_SIZE - offset; |
108 | 105 | ||
109 | if (len == PAGE_SIZE) { | 106 | if (len % PAGE_SIZE) { |
110 | /* The math in this function can surely use some love */ | 107 | page = get_mapping_page(sb, index, 0); |
111 | len = 0; | ||
112 | } | ||
113 | if (len) { | ||
114 | BUG_ON(area->a_used_bytes >= super->s_segsize); | ||
115 | |||
116 | page = get_mapping_page(area->a_sb, index, 0); | ||
117 | BUG_ON(!page); /* FIXME: reserve a pool */ | 108 | BUG_ON(!page); /* FIXME: reserve a pool */ |
118 | memset(page_address(page) + offset, 0xff, len); | 109 | memset(page_address(page) + offset, 0xff, len); |
119 | SetPagePrivate(page); | 110 | SetPagePrivate(page); |
120 | page_cache_release(page); | 111 | page_cache_release(page); |
121 | } | 112 | } |
113 | } | ||
122 | 114 | ||
123 | if (!final) | 115 | static void pad_full_pages(struct logfs_area *area) |
124 | return; | 116 | { |
117 | struct super_block *sb = area->a_sb; | ||
118 | struct logfs_super *super = logfs_super(sb); | ||
119 | u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes); | ||
120 | u32 len = super->s_segsize - area->a_used_bytes; | ||
121 | pgoff_t index = PAGE_CACHE_ALIGN(ofs) >> PAGE_CACHE_SHIFT; | ||
122 | pgoff_t no_indizes = len >> PAGE_CACHE_SHIFT; | ||
123 | struct page *page; | ||
125 | 124 | ||
126 | area->a_used_bytes += len; | 125 | while (no_indizes) { |
127 | for ( ; area->a_used_bytes < super->s_segsize; | 126 | page = get_mapping_page(sb, index, 0); |
128 | area->a_used_bytes += PAGE_SIZE) { | ||
129 | /* Memset another page */ | ||
130 | index++; | ||
131 | page = get_mapping_page(area->a_sb, index, 0); | ||
132 | BUG_ON(!page); /* FIXME: reserve a pool */ | 127 | BUG_ON(!page); /* FIXME: reserve a pool */ |
133 | memset(page_address(page), 0xff, PAGE_SIZE); | 128 | SetPageUptodate(page); |
129 | memset(page_address(page), 0xff, PAGE_CACHE_SIZE); | ||
134 | SetPagePrivate(page); | 130 | SetPagePrivate(page); |
135 | page_cache_release(page); | 131 | page_cache_release(page); |
132 | index++; | ||
133 | no_indizes--; | ||
136 | } | 134 | } |
137 | } | 135 | } |
138 | 136 | ||
139 | /* | 137 | /* |
138 | * bdev_writeseg will write full pages. Memset the tail to prevent data leaks. | ||
139 | * Also make sure we allocate (and memset) all pages for final writeout. | ||
140 | */ | ||
141 | static void pad_wbuf(struct logfs_area *area, int final) | ||
142 | { | ||
143 | pad_partial_page(area); | ||
144 | if (final) | ||
145 | pad_full_pages(area); | ||
146 | } | ||
147 | |||
148 | /* | ||
140 | * We have to be careful with the alias tree. Since lookup is done by bix, | 149 | * We have to be careful with the alias tree. Since lookup is done by bix, |
141 | * it needs to be normalized, so 14, 15, 16, etc. all match when dealing with | 150 | * it needs to be normalized, so 14, 15, 16, etc. all match when dealing with |
142 | * indirect blocks. So always use it through accessor functions. | 151 | * indirect blocks. So always use it through accessor functions. |
@@ -174,14 +183,8 @@ static int btree_write_alias(struct super_block *sb, struct logfs_block *block, | |||
174 | return 0; | 183 | return 0; |
175 | } | 184 | } |
176 | 185 | ||
177 | static gc_level_t btree_block_level(struct logfs_block *block) | ||
178 | { | ||
179 | return expand_level(block->ino, block->level); | ||
180 | } | ||
181 | |||
182 | static struct logfs_block_ops btree_block_ops = { | 186 | static struct logfs_block_ops btree_block_ops = { |
183 | .write_block = btree_write_block, | 187 | .write_block = btree_write_block, |
184 | .block_level = btree_block_level, | ||
185 | .free_block = __free_block, | 188 | .free_block = __free_block, |
186 | .write_alias = btree_write_alias, | 189 | .write_alias = btree_write_alias, |
187 | }; | 190 | }; |
@@ -683,7 +686,7 @@ int logfs_segment_delete(struct inode *inode, struct logfs_shadow *shadow) | |||
683 | return 0; | 686 | return 0; |
684 | } | 687 | } |
685 | 688 | ||
686 | static void freeseg(struct super_block *sb, u32 segno) | 689 | void freeseg(struct super_block *sb, u32 segno) |
687 | { | 690 | { |
688 | struct logfs_super *super = logfs_super(sb); | 691 | struct logfs_super *super = logfs_super(sb); |
689 | struct address_space *mapping = super->s_mapping_inode->i_mapping; | 692 | struct address_space *mapping = super->s_mapping_inode->i_mapping; |
@@ -910,7 +913,7 @@ err: | |||
910 | for (i--; i >= 0; i--) | 913 | for (i--; i >= 0; i--) |
911 | free_area(super->s_area[i]); | 914 | free_area(super->s_area[i]); |
912 | free_area(super->s_journal_area); | 915 | free_area(super->s_journal_area); |
913 | mempool_destroy(super->s_alias_pool); | 916 | logfs_mempool_destroy(super->s_alias_pool); |
914 | return -ENOMEM; | 917 | return -ENOMEM; |
915 | } | 918 | } |
916 | 919 | ||
diff --git a/fs/logfs/super.c b/fs/logfs/super.c index c66beab78dee..5866ee6e1327 100644 --- a/fs/logfs/super.c +++ b/fs/logfs/super.c | |||
@@ -11,6 +11,8 @@ | |||
11 | */ | 11 | */ |
12 | #include "logfs.h" | 12 | #include "logfs.h" |
13 | #include <linux/bio.h> | 13 | #include <linux/bio.h> |
14 | #include <linux/slab.h> | ||
15 | #include <linux/blkdev.h> | ||
14 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
15 | #include <linux/statfs.h> | 17 | #include <linux/statfs.h> |
16 | #include <linux/buffer_head.h> | 18 | #include <linux/buffer_head.h> |
@@ -136,6 +138,10 @@ static int logfs_sb_set(struct super_block *sb, void *_super) | |||
136 | sb->s_fs_info = super; | 138 | sb->s_fs_info = super; |
137 | sb->s_mtd = super->s_mtd; | 139 | sb->s_mtd = super->s_mtd; |
138 | sb->s_bdev = super->s_bdev; | 140 | sb->s_bdev = super->s_bdev; |
141 | if (sb->s_bdev) | ||
142 | sb->s_bdi = &bdev_get_queue(sb->s_bdev)->backing_dev_info; | ||
143 | if (sb->s_mtd) | ||
144 | sb->s_bdi = sb->s_mtd->backing_dev_info; | ||
139 | return 0; | 145 | return 0; |
140 | } | 146 | } |
141 | 147 | ||
@@ -277,7 +283,7 @@ static int logfs_recover_sb(struct super_block *sb) | |||
277 | } | 283 | } |
278 | if (valid0 && valid1 && ds_cmp(ds0, ds1)) { | 284 | if (valid0 && valid1 && ds_cmp(ds0, ds1)) { |
279 | printk(KERN_INFO"Superblocks don't match - fixing.\n"); | 285 | printk(KERN_INFO"Superblocks don't match - fixing.\n"); |
280 | return write_one_sb(sb, super->s_devops->find_last_sb); | 286 | return logfs_write_sb(sb); |
281 | } | 287 | } |
282 | /* If neither is valid now, something's wrong. Didn't we properly | 288 | /* If neither is valid now, something's wrong. Didn't we properly |
283 | * check them before?!? */ | 289 | * check them before?!? */ |
@@ -289,6 +295,10 @@ static int logfs_make_writeable(struct super_block *sb) | |||
289 | { | 295 | { |
290 | int err; | 296 | int err; |
291 | 297 | ||
298 | err = logfs_open_segfile(sb); | ||
299 | if (err) | ||
300 | return err; | ||
301 | |||
292 | /* Repair any broken superblock copies */ | 302 | /* Repair any broken superblock copies */ |
293 | err = logfs_recover_sb(sb); | 303 | err = logfs_recover_sb(sb); |
294 | if (err) | 304 | if (err) |
@@ -299,10 +309,6 @@ static int logfs_make_writeable(struct super_block *sb) | |||
299 | if (err) | 309 | if (err) |
300 | return err; | 310 | return err; |
301 | 311 | ||
302 | err = logfs_open_segfile(sb); | ||
303 | if (err) | ||
304 | return err; | ||
305 | |||
306 | /* Do one GC pass before any data gets dirtied */ | 312 | /* Do one GC pass before any data gets dirtied */ |
307 | logfs_gc_pass(sb); | 313 | logfs_gc_pass(sb); |
308 | 314 | ||
@@ -328,7 +334,7 @@ static int logfs_get_sb_final(struct super_block *sb, struct vfsmount *mnt) | |||
328 | 334 | ||
329 | sb->s_root = d_alloc_root(rootdir); | 335 | sb->s_root = d_alloc_root(rootdir); |
330 | if (!sb->s_root) | 336 | if (!sb->s_root) |
331 | goto fail; | 337 | goto fail2; |
332 | 338 | ||
333 | super->s_erase_page = alloc_pages(GFP_KERNEL, 0); | 339 | super->s_erase_page = alloc_pages(GFP_KERNEL, 0); |
334 | if (!super->s_erase_page) | 340 | if (!super->s_erase_page) |
@@ -451,6 +457,8 @@ static int logfs_read_sb(struct super_block *sb, int read_only) | |||
451 | 457 | ||
452 | btree_init_mempool64(&super->s_shadow_tree.new, super->s_btree_pool); | 458 | btree_init_mempool64(&super->s_shadow_tree.new, super->s_btree_pool); |
453 | btree_init_mempool64(&super->s_shadow_tree.old, super->s_btree_pool); | 459 | btree_init_mempool64(&super->s_shadow_tree.old, super->s_btree_pool); |
460 | btree_init_mempool32(&super->s_shadow_tree.segment_map, | ||
461 | super->s_btree_pool); | ||
454 | 462 | ||
455 | ret = logfs_init_mapping(sb); | 463 | ret = logfs_init_mapping(sb); |
456 | if (ret) | 464 | if (ret) |
@@ -515,8 +523,8 @@ static void logfs_kill_sb(struct super_block *sb) | |||
515 | if (super->s_erase_page) | 523 | if (super->s_erase_page) |
516 | __free_page(super->s_erase_page); | 524 | __free_page(super->s_erase_page); |
517 | super->s_devops->put_device(sb); | 525 | super->s_devops->put_device(sb); |
518 | mempool_destroy(super->s_btree_pool); | 526 | logfs_mempool_destroy(super->s_btree_pool); |
519 | mempool_destroy(super->s_alias_pool); | 527 | logfs_mempool_destroy(super->s_alias_pool); |
520 | kfree(super); | 528 | kfree(super); |
521 | log_super("LogFS: Finished unmounting\n"); | 529 | log_super("LogFS: Finished unmounting\n"); |
522 | } | 530 | } |
@@ -572,8 +580,7 @@ int logfs_get_sb_device(struct file_system_type *type, int flags, | |||
572 | return 0; | 580 | return 0; |
573 | 581 | ||
574 | err1: | 582 | err1: |
575 | up_write(&sb->s_umount); | 583 | deactivate_locked_super(sb); |
576 | deactivate_super(sb); | ||
577 | return err; | 584 | return err; |
578 | err0: | 585 | err0: |
579 | kfree(super); | 586 | kfree(super); |
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c index 82d6554b02fe..282e15ad8cd8 100644 --- a/fs/minix/itree_v1.c +++ b/fs/minix/itree_v1.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/buffer_head.h> | 1 | #include <linux/buffer_head.h> |
2 | #include <linux/slab.h> | ||
2 | #include "minix.h" | 3 | #include "minix.h" |
3 | 4 | ||
4 | enum {DEPTH = 3, DIRECT = 7}; /* Only double indirect */ | 5 | enum {DEPTH = 3, DIRECT = 7}; /* Only double indirect */ |
diff --git a/fs/mpage.c b/fs/mpage.c index 598d54e200eb..fd56ca2ea556 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/kdev_t.h> | 18 | #include <linux/kdev_t.h> |
19 | #include <linux/gfp.h> | ||
19 | #include <linux/bio.h> | 20 | #include <linux/bio.h> |
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index b8b5b30d53f0..7edfcd4d5e52 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
20 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
21 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 6a7d901f1936..1daabb90e0a5 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/fcntl.h> | 15 | #include <linux/fcntl.h> |
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/slab.h> | ||
19 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
20 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
21 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index ec8f45f12e05..60a5e2864ea8 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/time.h> | 15 | #include <linux/time.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
18 | #include <linux/slab.h> | ||
18 | #include <linux/highuid.h> | 19 | #include <linux/highuid.h> |
19 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
20 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c index 15458decdb8a..56f5b3a0e1ee 100644 --- a/fs/ncpfs/mmap.c +++ b/fs/ncpfs/mmap.c | |||
@@ -9,12 +9,12 @@ | |||
9 | #include <linux/stat.h> | 9 | #include <linux/stat.h> |
10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/gfp.h> | ||
12 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
13 | #include <linux/shm.h> | 14 | #include <linux/shm.h> |
14 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
15 | #include <linux/mman.h> | 16 | #include <linux/mman.h> |
16 | #include <linux/string.h> | 17 | #include <linux/string.h> |
17 | #include <linux/slab.h> | ||
18 | #include <linux/fcntl.h> | 18 | #include <linux/fcntl.h> |
19 | #include <linux/ncp_fs.h> | 19 | #include <linux/ncp_fs.h> |
20 | 20 | ||
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c index e37df8d5fe70..c7ff6c700a6e 100644 --- a/fs/ncpfs/sock.c +++ b/fs/ncpfs/sock.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/netdevice.h> | 22 | #include <linux/netdevice.h> |
23 | #include <linux/signal.h> | 23 | #include <linux/signal.h> |
24 | #include <linux/slab.h> | ||
24 | #include <net/scm.h> | 25 | #include <net/scm.h> |
25 | #include <net/sock.h> | 26 | #include <net/sock.h> |
26 | #include <linux/ipx.h> | 27 | #include <linux/ipx.h> |
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index e3d26c1bd105..c634fd17b337 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/ncp_fs.h> | 28 | #include <linux/ncp_fs.h> |
29 | #include <linux/time.h> | 29 | #include <linux/time.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
31 | #include <linux/stat.h> | 32 | #include <linux/stat.h> |
32 | #include "ncplib_kernel.h" | 33 | #include "ncplib_kernel.h" |
diff --git a/fs/nfs/cache_lib.c b/fs/nfs/cache_lib.c index b4ffd0146ea6..84690319e625 100644 --- a/fs/nfs/cache_lib.c +++ b/fs/nfs/cache_lib.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/moduleparam.h> | 10 | #include <linux/moduleparam.h> |
11 | #include <linux/mount.h> | 11 | #include <linux/mount.h> |
12 | #include <linux/namei.h> | 12 | #include <linux/namei.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/sunrpc/cache.h> | 14 | #include <linux/sunrpc/cache.h> |
14 | #include <linux/sunrpc/rpc_pipe_fs.h> | 15 | #include <linux/sunrpc/rpc_pipe_fs.h> |
15 | 16 | ||
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 84761b5bb8e2..a08770a7e857 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/nfs4.h> | 8 | #include <linux/nfs4.h> |
9 | #include <linux/nfs_fs.h> | 9 | #include <linux/nfs_fs.h> |
10 | #include <linux/slab.h> | ||
10 | #include "nfs4_fs.h" | 11 | #include "nfs4_fs.h" |
11 | #include "callback.h" | 12 | #include "callback.h" |
12 | #include "delegation.h" | 13 | #include "delegation.h" |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index a2b8b4df125d..05af212f0edf 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/sunrpc/svc.h> | 9 | #include <linux/sunrpc/svc.h> |
10 | #include <linux/nfs4.h> | 10 | #include <linux/nfs4.h> |
11 | #include <linux/nfs_fs.h> | 11 | #include <linux/nfs_fs.h> |
12 | #include <linux/slab.h> | ||
12 | #include "nfs4_fs.h" | 13 | #include "nfs4_fs.h" |
13 | #include "callback.h" | 14 | #include "callback.h" |
14 | 15 | ||
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 2274f1737336..a8766c4ef2e0 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/vfs.h> | 35 | #include <linux/vfs.h> |
36 | #include <linux/inet.h> | 36 | #include <linux/inet.h> |
37 | #include <linux/in6.h> | 37 | #include <linux/in6.h> |
38 | #include <linux/slab.h> | ||
38 | #include <net/ipv6.h> | 39 | #include <net/ipv6.h> |
39 | #include <linux/nfs_xdr.h> | 40 | #include <linux/nfs_xdr.h> |
40 | #include <linux/sunrpc/bc_xprt.h> | 41 | #include <linux/sunrpc/bc_xprt.h> |
@@ -1293,7 +1294,8 @@ static int nfs4_init_server(struct nfs_server *server, | |||
1293 | 1294 | ||
1294 | /* Initialise the client representation from the mount data */ | 1295 | /* Initialise the client representation from the mount data */ |
1295 | server->flags = data->flags; | 1296 | server->flags = data->flags; |
1296 | server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR; | 1297 | server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR| |
1298 | NFS_CAP_POSIX_LOCK; | ||
1297 | server->options = data->options; | 1299 | server->options = data->options; |
1298 | 1300 | ||
1299 | /* Get a client record */ | 1301 | /* Get a client record */ |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 2563bebc4c67..15671245c6ee 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/kthread.h> | 10 | #include <linux/kthread.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
15 | 16 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index c6f2750648f4..be46f26c9a56 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1025,12 +1025,12 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
1025 | res = NULL; | 1025 | res = NULL; |
1026 | goto out; | 1026 | goto out; |
1027 | /* This turned out not to be a regular file */ | 1027 | /* This turned out not to be a regular file */ |
1028 | case -EISDIR: | ||
1028 | case -ENOTDIR: | 1029 | case -ENOTDIR: |
1029 | goto no_open; | 1030 | goto no_open; |
1030 | case -ELOOP: | 1031 | case -ELOOP: |
1031 | if (!(nd->intent.open.flags & O_NOFOLLOW)) | 1032 | if (!(nd->intent.open.flags & O_NOFOLLOW)) |
1032 | goto no_open; | 1033 | goto no_open; |
1033 | /* case -EISDIR: */ | ||
1034 | /* case -EINVAL: */ | 1034 | /* case -EINVAL: */ |
1035 | default: | 1035 | default: |
1036 | goto out; | 1036 | goto out; |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 0d289823e856..ad4cd31d6050 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/file.h> | 44 | #include <linux/file.h> |
45 | #include <linux/pagemap.h> | 45 | #include <linux/pagemap.h> |
46 | #include <linux/kref.h> | 46 | #include <linux/kref.h> |
47 | #include <linux/slab.h> | ||
47 | 48 | ||
48 | #include <linux/nfs_fs.h> | 49 | #include <linux/nfs_fs.h> |
49 | #include <linux/nfs_page.h> | 50 | #include <linux/nfs_page.h> |
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index 3f0cd4dfddaf..76fd235d0024 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/hash.h> | 9 | #include <linux/hash.h> |
10 | #include <linux/string.h> | 10 | #include <linux/string.h> |
11 | #include <linux/kmod.h> | 11 | #include <linux/kmod.h> |
12 | #include <linux/slab.h> | ||
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/socket.h> | 14 | #include <linux/socket.h> |
14 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index ae0d92736531..8d965bddb87e 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -24,9 +24,9 @@ | |||
24 | #include <linux/nfs_fs.h> | 24 | #include <linux/nfs_fs.h> |
25 | #include <linux/nfs_mount.h> | 25 | #include <linux/nfs_mount.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
29 | #include <linux/aio.h> | 28 | #include <linux/aio.h> |
29 | #include <linux/gfp.h> | ||
30 | 30 | ||
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | #include <asm/system.h> | 32 | #include <asm/system.h> |
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index 237874f1af23..a6b16ed93229 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/nfs_fs_sb.h> | 17 | #include <linux/nfs_fs_sb.h> |
18 | #include <linux/in6.h> | 18 | #include <linux/in6.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | #include "internal.h" | 22 | #include "internal.h" |
22 | #include "iostat.h" | 23 | #include "iostat.h" |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e358df75a6ad..50a56edca0b5 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/vfs.h> | 36 | #include <linux/vfs.h> |
37 | #include <linux/inet.h> | 37 | #include <linux/inet.h> |
38 | #include <linux/nfs_xdr.h> | 38 | #include <linux/nfs_xdr.h> |
39 | #include <linux/slab.h> | ||
39 | 40 | ||
40 | #include <asm/system.h> | 41 | #include <asm/system.h> |
41 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
@@ -622,10 +623,10 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c | |||
622 | list_for_each_entry(pos, &nfsi->open_files, list) { | 623 | list_for_each_entry(pos, &nfsi->open_files, list) { |
623 | if (cred != NULL && pos->cred != cred) | 624 | if (cred != NULL && pos->cred != cred) |
624 | continue; | 625 | continue; |
625 | if ((pos->mode & mode) == mode) { | 626 | if ((pos->mode & (FMODE_READ|FMODE_WRITE)) != mode) |
626 | ctx = get_nfs_open_context(pos); | 627 | continue; |
627 | break; | 628 | ctx = get_nfs_open_context(pos); |
628 | } | 629 | break; |
629 | } | 630 | } |
630 | spin_unlock(&inode->i_lock); | 631 | spin_unlock(&inode->i_lock); |
631 | return ctx; | 632 | return ctx; |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 40c766782891..7888cf36022d 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/dcache.h> | 10 | #include <linux/dcache.h> |
11 | #include <linux/gfp.h> | ||
11 | #include <linux/mount.h> | 12 | #include <linux/mount.h> |
12 | #include <linux/namei.h> | 13 | #include <linux/namei.h> |
13 | #include <linux/nfs_fs.h> | 14 | #include <linux/nfs_fs.h> |
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 7bc2da8efd4a..81cf14257916 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/param.h> | 12 | #include <linux/param.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
17 | #include <linux/string.h> | 16 | #include <linux/string.h> |
18 | #include <linux/in.h> | 17 | #include <linux/in.h> |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index bac60515a4b3..d150ae0c5ecd 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/fs.h> | 1 | #include <linux/fs.h> |
2 | #include <linux/gfp.h> | ||
2 | #include <linux/nfs.h> | 3 | #include <linux/nfs.h> |
3 | #include <linux/nfs3.h> | 4 | #include <linux/nfs3.h> |
4 | #include <linux/nfs_fs.h> | 5 | #include <linux/nfs_fs.h> |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 24992f0a29f2..e701002694e5 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/sunrpc/clnt.h> | 12 | #include <linux/sunrpc/clnt.h> |
13 | #include <linux/slab.h> | ||
13 | #include <linux/nfs.h> | 14 | #include <linux/nfs.h> |
14 | #include <linux/nfs3.h> | 15 | #include <linux/nfs3.h> |
15 | #include <linux/nfs_fs.h> | 16 | #include <linux/nfs_fs.h> |
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index 5fe5492fbd29..56a86f6ac8b5 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/param.h> | 9 | #include <linux/param.h> |
10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
11 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
12 | #include <linux/slab.h> | ||
13 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
14 | #include <linux/string.h> | 13 | #include <linux/string.h> |
15 | #include <linux/in.h> | 14 | #include <linux/in.h> |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index fa3408f20112..f071d12c613b 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/mount.h> | 11 | #include <linux/mount.h> |
12 | #include <linux/namei.h> | 12 | #include <linux/namei.h> |
13 | #include <linux/nfs_fs.h> | 13 | #include <linux/nfs_fs.h> |
14 | #include <linux/slab.h> | ||
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
15 | #include <linux/sunrpc/clnt.h> | 16 | #include <linux/sunrpc/clnt.h> |
16 | #include <linux/vfs.h> | 17 | #include <linux/vfs.h> |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f9254fb0c9d0..638067007c65 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/string.h> | 41 | #include <linux/string.h> |
42 | #include <linux/slab.h> | ||
42 | #include <linux/sunrpc/clnt.h> | 43 | #include <linux/sunrpc/clnt.h> |
43 | #include <linux/nfs.h> | 44 | #include <linux/nfs.h> |
44 | #include <linux/nfs4.h> | 45 | #include <linux/nfs4.h> |
@@ -1522,6 +1523,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
1522 | nfs_post_op_update_inode(dir, o_res->dir_attr); | 1523 | nfs_post_op_update_inode(dir, o_res->dir_attr); |
1523 | } else | 1524 | } else |
1524 | nfs_refresh_inode(dir, o_res->dir_attr); | 1525 | nfs_refresh_inode(dir, o_res->dir_attr); |
1526 | if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) | ||
1527 | server->caps &= ~NFS_CAP_POSIX_LOCK; | ||
1525 | if(o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { | 1528 | if(o_res->rflags & NFS4_OPEN_RESULT_CONFIRM) { |
1526 | status = _nfs4_proc_open_confirm(data); | 1529 | status = _nfs4_proc_open_confirm(data); |
1527 | if (status != 0) | 1530 | if (status != 0) |
@@ -1663,7 +1666,7 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, in | |||
1663 | status = PTR_ERR(state); | 1666 | status = PTR_ERR(state); |
1664 | if (IS_ERR(state)) | 1667 | if (IS_ERR(state)) |
1665 | goto err_opendata_put; | 1668 | goto err_opendata_put; |
1666 | if ((opendata->o_res.rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) != 0) | 1669 | if (server->caps & NFS_CAP_POSIX_LOCK) |
1667 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); | 1670 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); |
1668 | nfs4_opendata_put(opendata); | 1671 | nfs4_opendata_put(opendata); |
1669 | nfs4_put_state_owner(sp); | 1672 | nfs4_put_state_owner(sp); |
@@ -2067,8 +2070,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st | |||
2067 | case -EDQUOT: | 2070 | case -EDQUOT: |
2068 | case -ENOSPC: | 2071 | case -ENOSPC: |
2069 | case -EROFS: | 2072 | case -EROFS: |
2070 | lookup_instantiate_filp(nd, (struct dentry *)state, NULL); | 2073 | return PTR_ERR(state); |
2071 | return 1; | ||
2072 | default: | 2074 | default: |
2073 | goto out_drop; | 2075 | goto out_drop; |
2074 | } | 2076 | } |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index dd17713413a5..38f3b582e7c2 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/param.h> | 38 | #include <linux/param.h> |
39 | #include <linux/time.h> | 39 | #include <linux/time.h> |
40 | #include <linux/mm.h> | 40 | #include <linux/mm.h> |
41 | #include <linux/slab.h> | ||
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/string.h> | 42 | #include <linux/string.h> |
44 | #include <linux/in.h> | 43 | #include <linux/in.h> |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index c752d944fe9e..0288be80444f 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -29,7 +29,6 @@ | |||
29 | 29 | ||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/param.h> | 31 | #include <linux/param.h> |
32 | #include <linux/slab.h> | ||
33 | #include <linux/time.h> | 32 | #include <linux/time.h> |
34 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
35 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 6baf9a393466..e01637240eeb 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/vfs.h> | 48 | #include <linux/vfs.h> |
49 | #include <linux/inet.h> | 49 | #include <linux/inet.h> |
50 | #include <linux/in6.h> | 50 | #include <linux/in6.h> |
51 | #include <linux/slab.h> | ||
51 | #include <net/ipv6.h> | 52 | #include <net/ipv6.h> |
52 | #include <linux/netdevice.h> | 53 | #include <linux/netdevice.h> |
53 | #include <linux/nfs_xdr.h> | 54 | #include <linux/nfs_xdr.h> |
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 2ea9e5c27e55..05c9e02f4153 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
20 | #include <linux/stat.h> | 20 | #include <linux/stat.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/slab.h> | ||
23 | #include <linux/string.h> | 22 | #include <linux/string.h> |
24 | #include <linux/namei.h> | 23 | #include <linux/namei.h> |
25 | 24 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 53ff70e23993..de38d63aa920 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -201,6 +201,7 @@ static int nfs_set_page_writeback(struct page *page) | |||
201 | struct inode *inode = page->mapping->host; | 201 | struct inode *inode = page->mapping->host; |
202 | struct nfs_server *nfss = NFS_SERVER(inode); | 202 | struct nfs_server *nfss = NFS_SERVER(inode); |
203 | 203 | ||
204 | page_cache_get(page); | ||
204 | if (atomic_long_inc_return(&nfss->writeback) > | 205 | if (atomic_long_inc_return(&nfss->writeback) > |
205 | NFS_CONGESTION_ON_THRESH) { | 206 | NFS_CONGESTION_ON_THRESH) { |
206 | set_bdi_congested(&nfss->backing_dev_info, | 207 | set_bdi_congested(&nfss->backing_dev_info, |
@@ -216,6 +217,7 @@ static void nfs_end_page_writeback(struct page *page) | |||
216 | struct nfs_server *nfss = NFS_SERVER(inode); | 217 | struct nfs_server *nfss = NFS_SERVER(inode); |
217 | 218 | ||
218 | end_page_writeback(page); | 219 | end_page_writeback(page); |
220 | page_cache_release(page); | ||
219 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) | 221 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) |
220 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); | 222 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); |
221 | } | 223 | } |
@@ -421,6 +423,7 @@ static void | |||
421 | nfs_mark_request_dirty(struct nfs_page *req) | 423 | nfs_mark_request_dirty(struct nfs_page *req) |
422 | { | 424 | { |
423 | __set_page_dirty_nobuffers(req->wb_page); | 425 | __set_page_dirty_nobuffers(req->wb_page); |
426 | __mark_inode_dirty(req->wb_page->mapping->host, I_DIRTY_DATASYNC); | ||
424 | } | 427 | } |
425 | 428 | ||
426 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 429 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
@@ -660,9 +663,11 @@ static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page, | |||
660 | req = nfs_setup_write_request(ctx, page, offset, count); | 663 | req = nfs_setup_write_request(ctx, page, offset, count); |
661 | if (IS_ERR(req)) | 664 | if (IS_ERR(req)) |
662 | return PTR_ERR(req); | 665 | return PTR_ERR(req); |
666 | nfs_mark_request_dirty(req); | ||
663 | /* Update file length */ | 667 | /* Update file length */ |
664 | nfs_grow_file(page, offset, count); | 668 | nfs_grow_file(page, offset, count); |
665 | nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); | 669 | nfs_mark_uptodate(page, req->wb_pgbase, req->wb_bytes); |
670 | nfs_mark_request_dirty(req); | ||
666 | nfs_clear_page_tag_locked(req); | 671 | nfs_clear_page_tag_locked(req); |
667 | return 0; | 672 | return 0; |
668 | } | 673 | } |
@@ -739,8 +744,6 @@ int nfs_updatepage(struct file *file, struct page *page, | |||
739 | status = nfs_writepage_setup(ctx, page, offset, count); | 744 | status = nfs_writepage_setup(ctx, page, offset, count); |
740 | if (status < 0) | 745 | if (status < 0) |
741 | nfs_set_pageerror(page); | 746 | nfs_set_pageerror(page); |
742 | else | ||
743 | __set_page_dirty_nobuffers(page); | ||
744 | 747 | ||
745 | dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", | 748 | dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", |
746 | status, (long long)i_size_read(inode)); | 749 | status, (long long)i_size_read(inode)); |
@@ -749,13 +752,12 @@ int nfs_updatepage(struct file *file, struct page *page, | |||
749 | 752 | ||
750 | static void nfs_writepage_release(struct nfs_page *req) | 753 | static void nfs_writepage_release(struct nfs_page *req) |
751 | { | 754 | { |
755 | struct page *page = req->wb_page; | ||
752 | 756 | ||
753 | if (PageError(req->wb_page) || !nfs_reschedule_unstable_write(req)) { | 757 | if (PageError(req->wb_page) || !nfs_reschedule_unstable_write(req)) |
754 | nfs_end_page_writeback(req->wb_page); | ||
755 | nfs_inode_remove_request(req); | 758 | nfs_inode_remove_request(req); |
756 | } else | ||
757 | nfs_end_page_writeback(req->wb_page); | ||
758 | nfs_clear_page_tag_locked(req); | 759 | nfs_clear_page_tag_locked(req); |
760 | nfs_end_page_writeback(page); | ||
759 | } | 761 | } |
760 | 762 | ||
761 | static int flush_task_priority(int how) | 763 | static int flush_task_priority(int how) |
@@ -779,7 +781,6 @@ static int nfs_write_rpcsetup(struct nfs_page *req, | |||
779 | int how) | 781 | int how) |
780 | { | 782 | { |
781 | struct inode *inode = req->wb_context->path.dentry->d_inode; | 783 | struct inode *inode = req->wb_context->path.dentry->d_inode; |
782 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
783 | int priority = flush_task_priority(how); | 784 | int priority = flush_task_priority(how); |
784 | struct rpc_task *task; | 785 | struct rpc_task *task; |
785 | struct rpc_message msg = { | 786 | struct rpc_message msg = { |
@@ -794,9 +795,10 @@ static int nfs_write_rpcsetup(struct nfs_page *req, | |||
794 | .callback_ops = call_ops, | 795 | .callback_ops = call_ops, |
795 | .callback_data = data, | 796 | .callback_data = data, |
796 | .workqueue = nfsiod_workqueue, | 797 | .workqueue = nfsiod_workqueue, |
797 | .flags = flags, | 798 | .flags = RPC_TASK_ASYNC, |
798 | .priority = priority, | 799 | .priority = priority, |
799 | }; | 800 | }; |
801 | int ret = 0; | ||
800 | 802 | ||
801 | /* Set up the RPC argument and reply structs | 803 | /* Set up the RPC argument and reply structs |
802 | * NB: take care not to mess about with data->commit et al. */ | 804 | * NB: take care not to mess about with data->commit et al. */ |
@@ -835,10 +837,18 @@ static int nfs_write_rpcsetup(struct nfs_page *req, | |||
835 | (unsigned long long)data->args.offset); | 837 | (unsigned long long)data->args.offset); |
836 | 838 | ||
837 | task = rpc_run_task(&task_setup_data); | 839 | task = rpc_run_task(&task_setup_data); |
838 | if (IS_ERR(task)) | 840 | if (IS_ERR(task)) { |
839 | return PTR_ERR(task); | 841 | ret = PTR_ERR(task); |
842 | goto out; | ||
843 | } | ||
844 | if (how & FLUSH_SYNC) { | ||
845 | ret = rpc_wait_for_completion_task(task); | ||
846 | if (ret == 0) | ||
847 | ret = task->tk_status; | ||
848 | } | ||
840 | rpc_put_task(task); | 849 | rpc_put_task(task); |
841 | return 0; | 850 | out: |
851 | return ret; | ||
842 | } | 852 | } |
843 | 853 | ||
844 | /* If a nfs_flush_* function fails, it should remove reqs from @head and | 854 | /* If a nfs_flush_* function fails, it should remove reqs from @head and |
@@ -847,9 +857,11 @@ static int nfs_write_rpcsetup(struct nfs_page *req, | |||
847 | */ | 857 | */ |
848 | static void nfs_redirty_request(struct nfs_page *req) | 858 | static void nfs_redirty_request(struct nfs_page *req) |
849 | { | 859 | { |
860 | struct page *page = req->wb_page; | ||
861 | |||
850 | nfs_mark_request_dirty(req); | 862 | nfs_mark_request_dirty(req); |
851 | nfs_end_page_writeback(req->wb_page); | ||
852 | nfs_clear_page_tag_locked(req); | 863 | nfs_clear_page_tag_locked(req); |
864 | nfs_end_page_writeback(page); | ||
853 | } | 865 | } |
854 | 866 | ||
855 | /* | 867 | /* |
@@ -1084,16 +1096,15 @@ static void nfs_writeback_release_full(void *calldata) | |||
1084 | if (nfs_write_need_commit(data)) { | 1096 | if (nfs_write_need_commit(data)) { |
1085 | memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf)); | 1097 | memcpy(&req->wb_verf, &data->verf, sizeof(req->wb_verf)); |
1086 | nfs_mark_request_commit(req); | 1098 | nfs_mark_request_commit(req); |
1087 | nfs_end_page_writeback(page); | ||
1088 | dprintk(" marked for commit\n"); | 1099 | dprintk(" marked for commit\n"); |
1089 | goto next; | 1100 | goto next; |
1090 | } | 1101 | } |
1091 | dprintk(" OK\n"); | 1102 | dprintk(" OK\n"); |
1092 | remove_request: | 1103 | remove_request: |
1093 | nfs_end_page_writeback(page); | ||
1094 | nfs_inode_remove_request(req); | 1104 | nfs_inode_remove_request(req); |
1095 | next: | 1105 | next: |
1096 | nfs_clear_page_tag_locked(req); | 1106 | nfs_clear_page_tag_locked(req); |
1107 | nfs_end_page_writeback(page); | ||
1097 | } | 1108 | } |
1098 | nfs_writedata_release(calldata); | 1109 | nfs_writedata_release(calldata); |
1099 | } | 1110 | } |
@@ -1207,7 +1218,6 @@ static int nfs_commit_rpcsetup(struct list_head *head, | |||
1207 | { | 1218 | { |
1208 | struct nfs_page *first = nfs_list_entry(head->next); | 1219 | struct nfs_page *first = nfs_list_entry(head->next); |
1209 | struct inode *inode = first->wb_context->path.dentry->d_inode; | 1220 | struct inode *inode = first->wb_context->path.dentry->d_inode; |
1210 | int flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
1211 | int priority = flush_task_priority(how); | 1221 | int priority = flush_task_priority(how); |
1212 | struct rpc_task *task; | 1222 | struct rpc_task *task; |
1213 | struct rpc_message msg = { | 1223 | struct rpc_message msg = { |
@@ -1222,7 +1232,7 @@ static int nfs_commit_rpcsetup(struct list_head *head, | |||
1222 | .callback_ops = &nfs_commit_ops, | 1232 | .callback_ops = &nfs_commit_ops, |
1223 | .callback_data = data, | 1233 | .callback_data = data, |
1224 | .workqueue = nfsiod_workqueue, | 1234 | .workqueue = nfsiod_workqueue, |
1225 | .flags = flags, | 1235 | .flags = RPC_TASK_ASYNC, |
1226 | .priority = priority, | 1236 | .priority = priority, |
1227 | }; | 1237 | }; |
1228 | 1238 | ||
@@ -1252,6 +1262,8 @@ static int nfs_commit_rpcsetup(struct list_head *head, | |||
1252 | task = rpc_run_task(&task_setup_data); | 1262 | task = rpc_run_task(&task_setup_data); |
1253 | if (IS_ERR(task)) | 1263 | if (IS_ERR(task)) |
1254 | return PTR_ERR(task); | 1264 | return PTR_ERR(task); |
1265 | if (how & FLUSH_SYNC) | ||
1266 | rpc_wait_for_completion_task(task); | ||
1255 | rpc_put_task(task); | 1267 | rpc_put_task(task); |
1256 | return 0; | 1268 | return 0; |
1257 | } | 1269 | } |
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c index 04133aacb1e5..fc1c52571c03 100644 --- a/fs/nfs_common/nfsacl.c +++ b/fs/nfs_common/nfsacl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/gfp.h> | ||
25 | #include <linux/sunrpc/xdr.h> | 26 | #include <linux/sunrpc/xdr.h> |
26 | #include <linux/nfsacl.h> | 27 | #include <linux/nfsacl.h> |
27 | #include <linux/nfs3.h> | 28 | #include <linux/nfs3.h> |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index a0c4016413f1..872a5ef550c7 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de> | 12 | * Copyright (C) 1995, 1996 Olaf Kirch, <okir@monad.swb.de> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/slab.h> | ||
15 | #include <linux/namei.h> | 16 | #include <linux/namei.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/exportfs.h> | 18 | #include <linux/exportfs.h> |
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index f20589d2ae27..6aa5590c3679 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "nfsd.h" | 7 | #include "nfsd.h" |
8 | /* FIXME: nfsacl.h is a broken header */ | 8 | /* FIXME: nfsacl.h is a broken header */ |
9 | #include <linux/nfsacl.h> | 9 | #include <linux/nfsacl.h> |
10 | #include <linux/gfp.h> | ||
10 | #include "cache.h" | 11 | #include "cache.h" |
11 | #include "xdr3.h" | 12 | #include "xdr3.h" |
12 | #include "vfs.h" | 13 | #include "vfs.h" |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index e0c4846bad92..a596e9d987e4 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "nfsd.h" | 7 | #include "nfsd.h" |
8 | /* FIXME: nfsacl.h is a broken header */ | 8 | /* FIXME: nfsacl.h is a broken header */ |
9 | #include <linux/nfsacl.h> | 9 | #include <linux/nfsacl.h> |
10 | #include <linux/gfp.h> | ||
10 | #include "cache.h" | 11 | #include "cache.h" |
11 | #include "xdr3.h" | 12 | #include "xdr3.h" |
12 | #include "vfs.h" | 13 | #include "vfs.h" |
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 88150685df34..e48052615159 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -34,6 +34,7 @@ | |||
34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/slab.h> | ||
37 | #include <linux/nfs_fs.h> | 38 | #include <linux/nfs_fs.h> |
38 | #include <linux/nfs4_acl.h> | 39 | #include <linux/nfs4_acl.h> |
39 | 40 | ||
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 4bc22c763de7..7e32bd394e86 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -32,6 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/sunrpc/clnt.h> | 34 | #include <linux/sunrpc/clnt.h> |
35 | #include <linux/slab.h> | ||
35 | #include "nfsd.h" | 36 | #include "nfsd.h" |
36 | #include "state.h" | 37 | #include "state.h" |
37 | 38 | ||
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 6e2983b27f3c..c78dbf493424 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/nfsd_idmap.h> | 36 | #include <linux/nfsd_idmap.h> |
37 | #include <linux/seq_file.h> | 37 | #include <linux/seq_file.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/slab.h> | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Cache entry | 42 | * Cache entry |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 37514c469846..2ab9e8501bfe 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -33,6 +33,7 @@ | |||
33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
34 | */ | 34 | */ |
35 | #include <linux/file.h> | 35 | #include <linux/file.h> |
36 | #include <linux/slab.h> | ||
36 | 37 | ||
37 | #include "cache.h" | 38 | #include "cache.h" |
38 | #include "xdr4.h" | 39 | #include "xdr4.h" |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 98fb98e330b4..7a9ae3254a4b 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -32,6 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/file.h> | 34 | #include <linux/file.h> |
35 | #include <linux/slab.h> | ||
35 | #include <linux/namei.h> | 36 | #include <linux/namei.h> |
36 | #include <linux/crypto.h> | 37 | #include <linux/crypto.h> |
37 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c97fddbd17db..6a8fedaa4f55 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/file.h> | 35 | #include <linux/file.h> |
36 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
37 | #include <linux/slab.h> | ||
37 | #include <linux/namei.h> | 38 | #include <linux/namei.h> |
38 | #include <linux/swap.h> | 39 | #include <linux/swap.h> |
39 | #include <linux/sunrpc/svcauth_gss.h> | 40 | #include <linux/sunrpc/svcauth_gss.h> |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index c47b4d7bafa7..e1703175ee28 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -40,6 +40,7 @@ | |||
40 | * at the end of nfs4svc_decode_compoundargs. | 40 | * at the end of nfs4svc_decode_compoundargs. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/slab.h> | ||
43 | #include <linux/namei.h> | 44 | #include <linux/namei.h> |
44 | #include <linux/statfs.h> | 45 | #include <linux/statfs.h> |
45 | #include <linux/utsname.h> | 46 | #include <linux/utsname.h> |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index da08560c4818..4666a209678a 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -8,6 +8,8 @@ | |||
8 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 8 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/slab.h> | ||
12 | |||
11 | #include "nfsd.h" | 13 | #include "nfsd.h" |
12 | #include "cache.h" | 14 | #include "cache.h" |
13 | 15 | ||
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 0f0e77f2012f..e3591073098f 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/slab.h> | ||
7 | #include <linux/namei.h> | 8 | #include <linux/namei.h> |
8 | #include <linux/ctype.h> | 9 | #include <linux/ctype.h> |
9 | 10 | ||
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index a11b0e8678ee..6dd5f1970e01 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/xattr.h> | 25 | #include <linux/xattr.h> |
26 | #include <linux/jhash.h> | 26 | #include <linux/jhash.h> |
27 | #include <linux/ima.h> | 27 | #include <linux/ima.h> |
28 | #include <linux/slab.h> | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <linux/exportfs.h> | 30 | #include <linux/exportfs.h> |
30 | #include <linux/writeback.h> | 31 | #include <linux/writeback.h> |
diff --git a/fs/nilfs2/alloc.c b/fs/nilfs2/alloc.c index 3f959f1879d8..7cfb87e692da 100644 --- a/fs/nilfs2/alloc.c +++ b/fs/nilfs2/alloc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/buffer_head.h> | 26 | #include <linux/buffer_head.h> |
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/slab.h> | ||
29 | #include "mdt.h" | 30 | #include "mdt.h" |
30 | #include "alloc.h" | 31 | #include "alloc.h" |
31 | 32 | ||
@@ -425,7 +426,7 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode, | |||
425 | bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); | 426 | bitmap = bitmap_kaddr + bh_offset(req->pr_bitmap_bh); |
426 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), | 427 | if (!nilfs_clear_bit_atomic(nilfs_mdt_bgl_lock(inode, group), |
427 | group_offset, bitmap)) | 428 | group_offset, bitmap)) |
428 | printk(KERN_WARNING "%s: entry numer %llu already freed\n", | 429 | printk(KERN_WARNING "%s: entry number %llu already freed\n", |
429 | __func__, (unsigned long long)req->pr_entry_nr); | 430 | __func__, (unsigned long long)req->pr_entry_nr); |
430 | 431 | ||
431 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); | 432 | nilfs_palloc_group_desc_add_entries(inode, group, desc, 1); |
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index 471e269536ae..447ce47a3306 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/buffer_head.h> | 27 | #include <linux/buffer_head.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/backing-dev.h> | 29 | #include <linux/backing-dev.h> |
30 | #include <linux/gfp.h> | ||
30 | #include "nilfs.h" | 31 | #include "nilfs.h" |
31 | #include "mdt.h" | 32 | #include "mdt.h" |
32 | #include "dat.h" | 33 | #include "dat.h" |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 7cdd98b8d514..76c38e3e19d2 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -1879,7 +1879,7 @@ static int nilfs_btree_propagate_v(struct nilfs_btree *btree, | |||
1879 | struct nilfs_btree_path *path, | 1879 | struct nilfs_btree_path *path, |
1880 | int level, struct buffer_head *bh) | 1880 | int level, struct buffer_head *bh) |
1881 | { | 1881 | { |
1882 | int maxlevel, ret; | 1882 | int maxlevel = 0, ret; |
1883 | struct nilfs_btree_node *parent; | 1883 | struct nilfs_btree_node *parent; |
1884 | struct inode *dat = nilfs_bmap_get_dat(&btree->bt_bmap); | 1884 | struct inode *dat = nilfs_bmap_get_dat(&btree->bt_bmap); |
1885 | __u64 ptr; | 1885 | __u64 ptr; |
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c index 8880a9e281e7..145f03cd7d3e 100644 --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/buffer_head.h> | 45 | #include <linux/buffer_head.h> |
46 | #include <linux/mpage.h> | 46 | #include <linux/mpage.h> |
47 | #include <linux/hash.h> | 47 | #include <linux/hash.h> |
48 | #include <linux/slab.h> | ||
48 | #include <linux/swap.h> | 49 | #include <linux/swap.h> |
49 | #include "nilfs.h" | 50 | #include "nilfs.h" |
50 | #include "page.h" | 51 | #include "page.h" |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 7868cc122ac7..0957b58f909d 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/buffer_head.h> | 24 | #include <linux/buffer_head.h> |
25 | #include <linux/gfp.h> | ||
25 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
26 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
27 | #include <linux/uio.h> | 28 | #include <linux/uio.h> |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 313d0a21da48..f90a33d9a5b0 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/smp_lock.h> /* lock_kernel(), unlock_kernel() */ | 25 | #include <linux/smp_lock.h> /* lock_kernel(), unlock_kernel() */ |
26 | #include <linux/slab.h> | ||
26 | #include <linux/capability.h> /* capable() */ | 27 | #include <linux/capability.h> /* capable() */ |
27 | #include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */ | 28 | #include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */ |
28 | #include <linux/vmalloc.h> | 29 | #include <linux/vmalloc.h> |
@@ -648,7 +649,7 @@ static int nilfs_ioctl_get_info(struct inode *inode, struct file *filp, | |||
648 | long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 649 | long nilfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
649 | { | 650 | { |
650 | struct inode *inode = filp->f_dentry->d_inode; | 651 | struct inode *inode = filp->f_dentry->d_inode; |
651 | void __user *argp = (void * __user *)arg; | 652 | void __user *argp = (void __user *)arg; |
652 | 653 | ||
653 | switch (cmd) { | 654 | switch (cmd) { |
654 | case NILFS_IOCTL_CHANGE_CPMODE: | 655 | case NILFS_IOCTL_CHANGE_CPMODE: |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 06713ffcc7f2..024be8c35bb6 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/writeback.h> | 26 | #include <linux/writeback.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/swap.h> | 28 | #include <linux/swap.h> |
29 | #include <linux/slab.h> | ||
29 | #include "nilfs.h" | 30 | #include "nilfs.h" |
30 | #include "segment.h" | 31 | #include "segment.h" |
31 | #include "page.h" | 32 | #include "page.h" |
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index fc246dba112a..8de3e1e48130 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/highmem.h> | 30 | #include <linux/highmem.h> |
31 | #include <linux/pagevec.h> | 31 | #include <linux/pagevec.h> |
32 | #include <linux/gfp.h> | ||
32 | #include "nilfs.h" | 33 | #include "nilfs.h" |
33 | #include "page.h" | 34 | #include "page.h" |
34 | #include "mdt.h" | 35 | #include "mdt.h" |
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index 017bedc761a0..ba43146f3c30 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
25 | #include <linux/swap.h> | 25 | #include <linux/swap.h> |
26 | #include <linux/slab.h> | ||
26 | #include <linux/crc32.h> | 27 | #include <linux/crc32.h> |
27 | #include "nilfs.h" | 28 | #include "nilfs.h" |
28 | #include "segment.h" | 29 | #include "segment.h" |
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c index 6129a431aa34..17851f77f739 100644 --- a/fs/nilfs2/segbuf.c +++ b/fs/nilfs2/segbuf.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/writeback.h> | 25 | #include <linux/writeback.h> |
26 | #include <linux/crc32.h> | 26 | #include <linux/crc32.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/slab.h> | ||
28 | #include "page.h" | 29 | #include "page.h" |
29 | #include "segbuf.h" | 30 | #include "segbuf.h" |
30 | 31 | ||
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index c161d89061b5..6a7dbd8451db 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kthread.h> | 32 | #include <linux/kthread.h> |
33 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
34 | #include <linux/pagevec.h> | 34 | #include <linux/pagevec.h> |
35 | #include <linux/slab.h> | ||
35 | #include "nilfs.h" | 36 | #include "nilfs.h" |
36 | #include "btnode.h" | 37 | #include "btnode.h" |
37 | #include "page.h" | 38 | #include "page.h" |
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h index e9795f1724d7..1ab974533697 100644 --- a/fs/nilfs2/the_nilfs.h +++ b/fs/nilfs2/the_nilfs.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
31 | #include <linux/backing-dev.h> | 31 | #include <linux/backing-dev.h> |
32 | #include <linux/slab.h> | ||
32 | #include "sb.h" | 33 | #include "sb.h" |
33 | 34 | ||
34 | /* the_nilfs struct */ | 35 | /* the_nilfs struct */ |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 037e878e03fc..fcc2f064af83 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <linux/dcache.h> | 19 | #include <linux/dcache.h> |
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/gfp.h> | ||
21 | #include <linux/init.h> | 22 | #include <linux/init.h> |
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
23 | #include <linux/srcu.h> | 24 | #include <linux/srcu.h> |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 3165d85aada2..0399bcbe09c8 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -87,7 +87,6 @@ | |||
87 | #include <linux/kernel.h> | 87 | #include <linux/kernel.h> |
88 | #include <linux/module.h> | 88 | #include <linux/module.h> |
89 | #include <linux/mutex.h> | 89 | #include <linux/mutex.h> |
90 | #include <linux/slab.h> | ||
91 | #include <linux/spinlock.h> | 90 | #include <linux/spinlock.h> |
92 | #include <linux/writeback.h> /* for inode_lock */ | 91 | #include <linux/writeback.h> /* for inode_lock */ |
93 | 92 | ||
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index cfce53cb65d7..c3c2c7ac9020 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/gfp.h> | ||
26 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
27 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
28 | #include <linux/swap.h> | 29 | #include <linux/swap.h> |
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 50d3b0c258e3..f5094ee224c1 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
26 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
27 | 28 | ||
diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c index 08f7530e9341..6551c7cbad92 100644 --- a/fs/ntfs/compress.c +++ b/fs/ntfs/compress.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/buffer_head.h> | 25 | #include <linux/buffer_head.h> |
26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
27 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
28 | #include <linux/slab.h> | ||
28 | 29 | ||
29 | #include "attrib.h" | 30 | #include "attrib.h" |
30 | #include "inode.h" | 31 | #include "inode.h" |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 9173e82a45d1..fe44d3feee4a 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
24 | #include <linux/slab.h> | ||
24 | 25 | ||
25 | #include "dir.h" | 26 | #include "dir.h" |
26 | #include "aops.h" | 27 | #include "aops.h" |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index b681c71d7069..8804f093ba75 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
23 | #include <linux/gfp.h> | ||
23 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
24 | #include <linux/pagevec.h> | 25 | #include <linux/pagevec.h> |
25 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c index 2194eff49743..096c135691ae 100644 --- a/fs/ntfs/index.c +++ b/fs/ntfs/index.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
23 | |||
22 | #include "aops.h" | 24 | #include "aops.h" |
23 | #include "collate.h" | 25 | #include "collate.h" |
24 | #include "debug.h" | 26 | #include "debug.h" |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 1caa0ef0b2bb..b572b6727181 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/swap.h> | 25 | #include <linux/swap.h> |
25 | 26 | ||
26 | #include "attrib.h" | 27 | #include "attrib.h" |
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index 2ca00153b6ec..358273e59ade 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/dcache.h> | 23 | #include <linux/dcache.h> |
24 | #include <linux/exportfs.h> | 24 | #include <linux/exportfs.h> |
25 | #include <linux/security.h> | 25 | #include <linux/security.h> |
26 | #include <linux/slab.h> | ||
26 | 27 | ||
27 | #include "attrib.h" | 28 | #include "attrib.h" |
28 | #include "debug.h" | 29 | #include "debug.h" |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index 8ccf0f8c9cc8..e13fc9e8fcdc 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | 26 | ||
26 | #define MLOG_MASK_PREFIX ML_INODE | 27 | #define MLOG_MASK_PREFIX ML_INODE |
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index b18c6d677f9d..f9d5d3ffc75a 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/slab.h> | ||
29 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
30 | 29 | ||
31 | #include <cluster/masklog.h> | 30 | #include <cluster/masklog.h> |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 5c9890006708..41d5f1f92d56 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/crc32.h> | 34 | #include <linux/crc32.h> |
35 | #include <linux/time.h> | 35 | #include <linux/time.h> |
36 | #include <linux/debugfs.h> | 36 | #include <linux/debugfs.h> |
37 | #include <linux/slab.h> | ||
37 | 38 | ||
38 | #include "heartbeat.h" | 39 | #include "heartbeat.h" |
39 | #include "tcp.h" | 40 | #include "tcp.h" |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index c81142e3ef84..ed0c9f367fed 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Boston, MA 021110-1307, USA. | 19 | * Boston, MA 021110-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/configfs.h> | 25 | #include <linux/configfs.h> |
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index 639024033fce..cf3e16696216 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c | |||
@@ -44,7 +44,6 @@ | |||
44 | * and if they're the last, they fire off the decision. | 44 | * and if they're the last, they fire off the decision. |
45 | */ | 45 | */ |
46 | #include <linux/kernel.h> | 46 | #include <linux/kernel.h> |
47 | #include <linux/slab.h> | ||
48 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
49 | #include <linux/reboot.h> | 48 | #include <linux/reboot.h> |
50 | 49 | ||
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c index b7a25ef18e2a..12d5eb78a11a 100644 --- a/fs/ocfs2/dlm/dlmast.c +++ b/fs/ocfs2/dlm/dlmast.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/highmem.h> | 31 | #include <linux/highmem.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/sysctl.h> | 33 | #include <linux/sysctl.h> |
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index f283bce776b4..90803b47cd8c 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/highmem.h> | 31 | #include <linux/highmem.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/sysctl.h> | 33 | #include <linux/sysctl.h> |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 52ec020ea78b..11a6d1fd1d35 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/highmem.h> | 31 | #include <linux/highmem.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/sysctl.h> | 33 | #include <linux/sysctl.h> |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index 49e29ecd0201..b47c1b92b82b 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/highmem.h> | 31 | #include <linux/highmem.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/sysctl.h> | 33 | #include <linux/sysctl.h> |
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index c562a7581cf9..09e3fdfa6d33 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/types.h> | 28 | #include <linux/types.h> |
28 | #include <linux/fiemap.h> | 29 | #include <linux/fiemap.h> |
29 | 30 | ||
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c index c6e7213db868..1aa863dd901f 100644 --- a/fs/ocfs2/heartbeat.c +++ b/fs/ocfs2/heartbeat.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/slab.h> | ||
30 | #include <linux/highmem.h> | 29 | #include <linux/highmem.h> |
31 | 30 | ||
32 | #define MLOG_MASK_PREFIX ML_SUPER | 31 | #define MLOG_MASK_PREFIX ML_SUPER |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 23c254e26018..83fe1d38f5cb 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/slab.h> | ||
29 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
30 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
31 | #include <linux/quotaops.h> | 30 | #include <linux/quotaops.h> |
@@ -641,11 +640,13 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
641 | goto bail_unlock; | 640 | goto bail_unlock; |
642 | } | 641 | } |
643 | 642 | ||
644 | status = ocfs2_orphan_del(osb, handle, orphan_dir_inode, inode, | 643 | if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) { |
645 | orphan_dir_bh); | 644 | status = ocfs2_orphan_del(osb, handle, orphan_dir_inode, inode, |
646 | if (status < 0) { | 645 | orphan_dir_bh); |
647 | mlog_errno(status); | 646 | if (status < 0) { |
648 | goto bail_commit; | 647 | mlog_errno(status); |
648 | goto bail_commit; | ||
649 | } | ||
649 | } | 650 | } |
650 | 651 | ||
651 | /* set the inodes dtime */ | 652 | /* set the inodes dtime */ |
@@ -728,34 +729,35 @@ static int ocfs2_wipe_inode(struct inode *inode, | |||
728 | struct inode *orphan_dir_inode = NULL; | 729 | struct inode *orphan_dir_inode = NULL; |
729 | struct buffer_head *orphan_dir_bh = NULL; | 730 | struct buffer_head *orphan_dir_bh = NULL; |
730 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 731 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
731 | struct ocfs2_dinode *di; | 732 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; |
732 | 733 | ||
733 | di = (struct ocfs2_dinode *) di_bh->b_data; | 734 | if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) { |
734 | orphaned_slot = le16_to_cpu(di->i_orphaned_slot); | 735 | orphaned_slot = le16_to_cpu(di->i_orphaned_slot); |
735 | 736 | ||
736 | status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot); | 737 | status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot); |
737 | if (status) | 738 | if (status) |
738 | return status; | 739 | return status; |
739 | 740 | ||
740 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, | 741 | orphan_dir_inode = ocfs2_get_system_file_inode(osb, |
741 | ORPHAN_DIR_SYSTEM_INODE, | 742 | ORPHAN_DIR_SYSTEM_INODE, |
742 | orphaned_slot); | 743 | orphaned_slot); |
743 | if (!orphan_dir_inode) { | 744 | if (!orphan_dir_inode) { |
744 | status = -EEXIST; | 745 | status = -EEXIST; |
745 | mlog_errno(status); | 746 | mlog_errno(status); |
746 | goto bail; | 747 | goto bail; |
747 | } | 748 | } |
748 | 749 | ||
749 | /* Lock the orphan dir. The lock will be held for the entire | 750 | /* Lock the orphan dir. The lock will be held for the entire |
750 | * delete_inode operation. We do this now to avoid races with | 751 | * delete_inode operation. We do this now to avoid races with |
751 | * recovery completion on other nodes. */ | 752 | * recovery completion on other nodes. */ |
752 | mutex_lock(&orphan_dir_inode->i_mutex); | 753 | mutex_lock(&orphan_dir_inode->i_mutex); |
753 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | 754 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); |
754 | if (status < 0) { | 755 | if (status < 0) { |
755 | mutex_unlock(&orphan_dir_inode->i_mutex); | 756 | mutex_unlock(&orphan_dir_inode->i_mutex); |
756 | 757 | ||
757 | mlog_errno(status); | 758 | mlog_errno(status); |
758 | goto bail; | 759 | goto bail; |
760 | } | ||
759 | } | 761 | } |
760 | 762 | ||
761 | /* we do this while holding the orphan dir lock because we | 763 | /* we do this while holding the orphan dir lock because we |
@@ -796,6 +798,9 @@ static int ocfs2_wipe_inode(struct inode *inode, | |||
796 | mlog_errno(status); | 798 | mlog_errno(status); |
797 | 799 | ||
798 | bail_unlock_dir: | 800 | bail_unlock_dir: |
801 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR) | ||
802 | return status; | ||
803 | |||
799 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 804 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
800 | mutex_unlock(&orphan_dir_inode->i_mutex); | 805 | mutex_unlock(&orphan_dir_inode->i_mutex); |
801 | brelse(orphan_dir_bh); | 806 | brelse(orphan_dir_bh); |
@@ -891,7 +896,8 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
891 | 896 | ||
892 | /* Do some basic inode verification... */ | 897 | /* Do some basic inode verification... */ |
893 | di = (struct ocfs2_dinode *) di_bh->b_data; | 898 | di = (struct ocfs2_dinode *) di_bh->b_data; |
894 | if (!(di->i_flags & cpu_to_le32(OCFS2_ORPHANED_FL))) { | 899 | if (!(di->i_flags & cpu_to_le32(OCFS2_ORPHANED_FL)) && |
900 | !(oi->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) { | ||
895 | /* | 901 | /* |
896 | * Inodes in the orphan dir must have ORPHANED_FL. The only | 902 | * Inodes in the orphan dir must have ORPHANED_FL. The only |
897 | * inodes that come back out of the orphan dir are reflink | 903 | * inodes that come back out of the orphan dir are reflink |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index ba4fe07b293c..0b28e1921a39 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -100,6 +100,8 @@ struct ocfs2_inode_info | |||
100 | #define OCFS2_INODE_MAYBE_ORPHANED 0x00000020 | 100 | #define OCFS2_INODE_MAYBE_ORPHANED 0x00000020 |
101 | /* Does someone have the file open O_DIRECT */ | 101 | /* Does someone have the file open O_DIRECT */ |
102 | #define OCFS2_INODE_OPEN_DIRECT 0x00000040 | 102 | #define OCFS2_INODE_OPEN_DIRECT 0x00000040 |
103 | /* Tell the inode wipe code it's not in orphan dir */ | ||
104 | #define OCFS2_INODE_SKIP_ORPHAN_DIR 0x00000080 | ||
103 | 105 | ||
104 | static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode) | 106 | static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode) |
105 | { | 107 | { |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 39737613424a..7898bd3a99f5 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/slab.h> | ||
29 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
30 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
31 | #include <linux/uio.h> | 30 | #include <linux/uio.h> |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index b1eb50ae4097..4cbb18f26c5f 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -408,23 +408,28 @@ static int ocfs2_mknod(struct inode *dir, | |||
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | status = ocfs2_add_entry(handle, dentry, inode, | 411 | /* |
412 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, | 412 | * Do this before adding the entry to the directory. We add |
413 | &lookup); | 413 | * also set d_op after success so that ->d_iput() will cleanup |
414 | if (status < 0) { | 414 | * the dentry lock even if ocfs2_add_entry() fails below. |
415 | */ | ||
416 | status = ocfs2_dentry_attach_lock(dentry, inode, | ||
417 | OCFS2_I(dir)->ip_blkno); | ||
418 | if (status) { | ||
415 | mlog_errno(status); | 419 | mlog_errno(status); |
416 | goto leave; | 420 | goto leave; |
417 | } | 421 | } |
422 | dentry->d_op = &ocfs2_dentry_ops; | ||
418 | 423 | ||
419 | status = ocfs2_dentry_attach_lock(dentry, inode, | 424 | status = ocfs2_add_entry(handle, dentry, inode, |
420 | OCFS2_I(dir)->ip_blkno); | 425 | OCFS2_I(inode)->ip_blkno, parent_fe_bh, |
421 | if (status) { | 426 | &lookup); |
427 | if (status < 0) { | ||
422 | mlog_errno(status); | 428 | mlog_errno(status); |
423 | goto leave; | 429 | goto leave; |
424 | } | 430 | } |
425 | 431 | ||
426 | insert_inode_hash(inode); | 432 | insert_inode_hash(inode); |
427 | dentry->d_op = &ocfs2_dentry_ops; | ||
428 | d_instantiate(dentry, inode); | 433 | d_instantiate(dentry, inode); |
429 | status = 0; | 434 | status = 0; |
430 | leave: | 435 | leave: |
@@ -445,11 +450,6 @@ leave: | |||
445 | 450 | ||
446 | ocfs2_free_dir_lookup_result(&lookup); | 451 | ocfs2_free_dir_lookup_result(&lookup); |
447 | 452 | ||
448 | if ((status < 0) && inode) { | ||
449 | clear_nlink(inode); | ||
450 | iput(inode); | ||
451 | } | ||
452 | |||
453 | if (inode_ac) | 453 | if (inode_ac) |
454 | ocfs2_free_alloc_context(inode_ac); | 454 | ocfs2_free_alloc_context(inode_ac); |
455 | 455 | ||
@@ -459,6 +459,17 @@ leave: | |||
459 | if (meta_ac) | 459 | if (meta_ac) |
460 | ocfs2_free_alloc_context(meta_ac); | 460 | ocfs2_free_alloc_context(meta_ac); |
461 | 461 | ||
462 | /* | ||
463 | * We should call iput after the i_mutex of the bitmap been | ||
464 | * unlocked in ocfs2_free_alloc_context, or the | ||
465 | * ocfs2_delete_inode will mutex_lock again. | ||
466 | */ | ||
467 | if ((status < 0) && inode) { | ||
468 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; | ||
469 | clear_nlink(inode); | ||
470 | iput(inode); | ||
471 | } | ||
472 | |||
462 | mlog_exit(status); | 473 | mlog_exit(status); |
463 | 474 | ||
464 | return status; | 475 | return status; |
@@ -1771,22 +1782,27 @@ static int ocfs2_symlink(struct inode *dir, | |||
1771 | } | 1782 | } |
1772 | } | 1783 | } |
1773 | 1784 | ||
1774 | status = ocfs2_add_entry(handle, dentry, inode, | 1785 | /* |
1775 | le64_to_cpu(fe->i_blkno), parent_fe_bh, | 1786 | * Do this before adding the entry to the directory. We add |
1776 | &lookup); | 1787 | * also set d_op after success so that ->d_iput() will cleanup |
1777 | if (status < 0) { | 1788 | * the dentry lock even if ocfs2_add_entry() fails below. |
1789 | */ | ||
1790 | status = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(dir)->ip_blkno); | ||
1791 | if (status) { | ||
1778 | mlog_errno(status); | 1792 | mlog_errno(status); |
1779 | goto bail; | 1793 | goto bail; |
1780 | } | 1794 | } |
1795 | dentry->d_op = &ocfs2_dentry_ops; | ||
1781 | 1796 | ||
1782 | status = ocfs2_dentry_attach_lock(dentry, inode, OCFS2_I(dir)->ip_blkno); | 1797 | status = ocfs2_add_entry(handle, dentry, inode, |
1783 | if (status) { | 1798 | le64_to_cpu(fe->i_blkno), parent_fe_bh, |
1799 | &lookup); | ||
1800 | if (status < 0) { | ||
1784 | mlog_errno(status); | 1801 | mlog_errno(status); |
1785 | goto bail; | 1802 | goto bail; |
1786 | } | 1803 | } |
1787 | 1804 | ||
1788 | insert_inode_hash(inode); | 1805 | insert_inode_hash(inode); |
1789 | dentry->d_op = &ocfs2_dentry_ops; | ||
1790 | d_instantiate(dentry, inode); | 1806 | d_instantiate(dentry, inode); |
1791 | bail: | 1807 | bail: |
1792 | if (status < 0 && did_quota) | 1808 | if (status < 0 && did_quota) |
@@ -1811,6 +1827,7 @@ bail: | |||
1811 | if (xattr_ac) | 1827 | if (xattr_ac) |
1812 | ocfs2_free_alloc_context(xattr_ac); | 1828 | ocfs2_free_alloc_context(xattr_ac); |
1813 | if ((status < 0) && inode) { | 1829 | if ((status < 0) && inode) { |
1830 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR; | ||
1814 | clear_nlink(inode); | 1831 | clear_nlink(inode); |
1815 | iput(inode); | 1832 | iput(inode); |
1816 | } | 1833 | } |
@@ -1976,6 +1993,7 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
1976 | } | 1993 | } |
1977 | 1994 | ||
1978 | le32_add_cpu(&fe->i_flags, OCFS2_ORPHANED_FL); | 1995 | le32_add_cpu(&fe->i_flags, OCFS2_ORPHANED_FL); |
1996 | OCFS2_I(inode)->ip_flags &= ~OCFS2_INODE_SKIP_ORPHAN_DIR; | ||
1979 | 1997 | ||
1980 | /* Record which orphan dir our inode now resides | 1998 | /* Record which orphan dir our inode now resides |
1981 | * in. delete_inode will use this to determine which orphan | 1999 | * in. delete_inode will use this to determine which orphan |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 355f41d1d520..ab42a74c7539 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/spinlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/quota.h> | 7 | #include <linux/quota.h> |
7 | #include <linux/quotaops.h> | 8 | #include <linux/quotaops.h> |
8 | #include <linux/dqblk_qtree.h> | 9 | #include <linux/dqblk_qtree.h> |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index a6467f3d262e..9ad49305f450 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/fs.h> | 5 | #include <linux/fs.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/quota.h> | 7 | #include <linux/quota.h> |
7 | #include <linux/quotaops.h> | 8 | #include <linux/quotaops.h> |
8 | #include <linux/module.h> | 9 | #include <linux/module.h> |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 32a8ac589c87..5cbcd0f008fc 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #include <linux/bio.h> | 38 | #include <linux/bio.h> |
39 | #include <linux/blkdev.h> | 39 | #include <linux/blkdev.h> |
40 | #include <linux/gfp.h> | ||
41 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
42 | #include <linux/writeback.h> | 41 | #include <linux/writeback.h> |
43 | #include <linux/pagevec.h> | 42 | #include <linux/pagevec.h> |
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 7020e1253ffa..0d3049f696c5 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/crc32.h> | 21 | #include <linux/crc32.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
23 | 24 | ||
24 | /* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */ | 25 | /* Needed for AOP_TRUNCATED_PAGE in mlog_errno() */ |
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 5ae8812b2864..2dc57bca0688 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/miscdevice.h> | 22 | #include <linux/miscdevice.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/smp_lock.h> | 25 | #include <linux/smp_lock.h> |
25 | #include <linux/reboot.h> | 26 | #include <linux/reboot.h> |
26 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c index 40e53702948c..bfe7190cdbf1 100644 --- a/fs/ocfs2/sysfile.c +++ b/fs/ocfs2/sysfile.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/slab.h> | ||
29 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
30 | 29 | ||
31 | #define MLOG_MASK_PREFIX ML_INODE | 30 | #define MLOG_MASK_PREFIX ML_INODE |
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 75d9b5ba1d45..c82af6acc2e7 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/version.h> | 6 | #include <linux/version.h> |
7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | ||
9 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
10 | #include <linux/vfs.h> | 11 | #include <linux/vfs.h> |
11 | #include <linux/parser.h> | 12 | #include <linux/parser.h> |
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/fdtable.h> | 10 | #include <linux/fdtable.h> |
11 | #include <linux/fsnotify.h> | 11 | #include <linux/fsnotify.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/slab.h> | ||
14 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
15 | #include <linux/namei.h> | 14 | #include <linux/namei.h> |
16 | #include <linux/backing-dev.h> | 15 | #include <linux/backing-dev.h> |
@@ -20,6 +19,7 @@ | |||
20 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
21 | #include <linux/vfs.h> | 20 | #include <linux/vfs.h> |
22 | #include <linux/fcntl.h> | 21 | #include <linux/fcntl.h> |
22 | #include <linux/slab.h> | ||
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/personality.h> | 25 | #include <linux/personality.h> |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index e8865c11777f..e238ab23a9e7 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/slab.h> | ||
19 | #include <linux/kmod.h> | 20 | #include <linux/kmod.h> |
20 | #include <linux/ctype.h> | 21 | #include <linux/ctype.h> |
21 | #include <linux/genhd.h> | 22 | #include <linux/genhd.h> |
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index 49cfd5f54238..91babdae7587 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c | |||
@@ -95,6 +95,7 @@ | |||
95 | ************************************************************/ | 95 | ************************************************************/ |
96 | #include <linux/crc32.h> | 96 | #include <linux/crc32.h> |
97 | #include <linux/math64.h> | 97 | #include <linux/math64.h> |
98 | #include <linux/slab.h> | ||
98 | #include "check.h" | 99 | #include "check.h" |
99 | #include "efi.h" | 100 | #include "efi.h" |
100 | 101 | ||
diff --git a/fs/proc/array.c b/fs/proc/array.c index aa8637b81028..e51f2ec2c5e5 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -68,7 +68,6 @@ | |||
68 | #include <linux/hugetlb.h> | 68 | #include <linux/hugetlb.h> |
69 | #include <linux/pagemap.h> | 69 | #include <linux/pagemap.h> |
70 | #include <linux/swap.h> | 70 | #include <linux/swap.h> |
71 | #include <linux/slab.h> | ||
72 | #include <linux/smp.h> | 71 | #include <linux/smp.h> |
73 | #include <linux/signal.h> | 72 | #include <linux/signal.h> |
74 | #include <linux/highmem.h> | 73 | #include <linux/highmem.h> |
diff --git a/fs/proc/base.c b/fs/proc/base.c index a7310841c831..7621db800a74 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/elf.h> | 81 | #include <linux/elf.h> |
82 | #include <linux/pid_namespace.h> | 82 | #include <linux/pid_namespace.h> |
83 | #include <linux/fs_struct.h> | 83 | #include <linux/fs_struct.h> |
84 | #include <linux/slab.h> | ||
84 | #include "internal.h" | 85 | #include "internal.h" |
85 | 86 | ||
86 | /* NOTE: | 87 | /* NOTE: |
@@ -442,12 +443,13 @@ static const struct file_operations proc_lstats_operations = { | |||
442 | unsigned long badness(struct task_struct *p, unsigned long uptime); | 443 | unsigned long badness(struct task_struct *p, unsigned long uptime); |
443 | static int proc_oom_score(struct task_struct *task, char *buffer) | 444 | static int proc_oom_score(struct task_struct *task, char *buffer) |
444 | { | 445 | { |
445 | unsigned long points; | 446 | unsigned long points = 0; |
446 | struct timespec uptime; | 447 | struct timespec uptime; |
447 | 448 | ||
448 | do_posix_clock_monotonic_gettime(&uptime); | 449 | do_posix_clock_monotonic_gettime(&uptime); |
449 | read_lock(&tasklist_lock); | 450 | read_lock(&tasklist_lock); |
450 | points = badness(task->group_leader, uptime.tv_sec); | 451 | if (pid_alive(task)) |
452 | points = badness(task, uptime.tv_sec); | ||
451 | read_unlock(&tasklist_lock); | 453 | read_unlock(&tasklist_lock); |
452 | return sprintf(buffer, "%lu\n", points); | 454 | return sprintf(buffer, "%lu\n", points); |
453 | } | 455 | } |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 08f4d71dacd7..43c127490606 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/stat.h> | 14 | #include <linux/stat.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/mount.h> | 17 | #include <linux/mount.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/idr.h> | 19 | #include <linux/idr.h> |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 445a02bcaab3..d35b23238fb1 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/sysctl.h> | 20 | #include <linux/sysctl.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index b442dac8f5f9..19979a2ce272 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/highmem.h> | 19 | #include <linux/highmem.h> |
20 | #include <linux/bootmem.h> | 20 | #include <linux/bootmem.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/slab.h> | ||
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | #include <linux/list.h> | 25 | #include <linux/list.h> |
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c index 9fe7d7ebe115..b1822dde55c2 100644 --- a/fs/proc/nommu.c +++ b/fs/proc/nommu.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/mmzone.h> | 21 | #include <linux/mmzone.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/swap.h> | 23 | #include <linux/swap.h> |
24 | #include <linux/slab.h> | ||
25 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
26 | #include <linux/seq_file.h> | 25 | #include <linux/seq_file.h> |
27 | #include <linux/hugetlb.h> | 26 | #include <linux/hugetlb.h> |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index f8650dce74fb..ce94801f48ca 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/of.h> | 13 | #include <linux/of.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | ||
15 | #include <asm/prom.h> | 16 | #include <asm/prom.h> |
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
17 | #include "internal.h" | 18 | #include "internal.h" |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 04d1270f1c38..9020ac15baaa 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/time.h> | 14 | #include <linux/time.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_fs.h> |
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index b9b7aad2003d..bf31b03fc275 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/cpumask.h> | 1 | #include <linux/cpumask.h> |
2 | #include <linux/fs.h> | 2 | #include <linux/fs.h> |
3 | #include <linux/gfp.h> | ||
4 | #include <linux/init.h> | 3 | #include <linux/init.h> |
5 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
6 | #include <linux/kernel_stat.h> | 5 | #include <linux/kernel_stat.h> |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 183f8ff5f400..070553427dd5 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/seq_file.h> | 4 | #include <linux/seq_file.h> |
5 | #include <linux/highmem.h> | 5 | #include <linux/highmem.h> |
6 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
7 | #include <linux/slab.h> | ||
7 | #include <linux/pagemap.h> | 8 | #include <linux/pagemap.h> |
8 | #include <linux/mempolicy.h> | 9 | #include <linux/mempolicy.h> |
9 | #include <linux/swap.h> | 10 | #include <linux/swap.h> |
@@ -406,6 +407,7 @@ static int show_smap(struct seq_file *m, void *v) | |||
406 | 407 | ||
407 | memset(&mss, 0, sizeof mss); | 408 | memset(&mss, 0, sizeof mss); |
408 | mss.vma = vma; | 409 | mss.vma = vma; |
410 | /* mmap_sem is held in m_start */ | ||
409 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) | 411 | if (vma->vm_mm && !is_vm_hugetlb_page(vma)) |
410 | walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); | 412 | walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); |
411 | 413 | ||
@@ -552,7 +554,8 @@ const struct file_operations proc_clear_refs_operations = { | |||
552 | }; | 554 | }; |
553 | 555 | ||
554 | struct pagemapread { | 556 | struct pagemapread { |
555 | u64 __user *out, *end; | 557 | int pos, len; |
558 | u64 *buffer; | ||
556 | }; | 559 | }; |
557 | 560 | ||
558 | #define PM_ENTRY_BYTES sizeof(u64) | 561 | #define PM_ENTRY_BYTES sizeof(u64) |
@@ -575,10 +578,8 @@ struct pagemapread { | |||
575 | static int add_to_pagemap(unsigned long addr, u64 pfn, | 578 | static int add_to_pagemap(unsigned long addr, u64 pfn, |
576 | struct pagemapread *pm) | 579 | struct pagemapread *pm) |
577 | { | 580 | { |
578 | if (put_user(pfn, pm->out)) | 581 | pm->buffer[pm->pos++] = pfn; |
579 | return -EFAULT; | 582 | if (pm->pos >= pm->len) |
580 | pm->out++; | ||
581 | if (pm->out >= pm->end) | ||
582 | return PM_END_OF_BUFFER; | 583 | return PM_END_OF_BUFFER; |
583 | return 0; | 584 | return 0; |
584 | } | 585 | } |
@@ -661,31 +662,18 @@ static u64 huge_pte_to_pagemap_entry(pte_t pte, int offset) | |||
661 | return pme; | 662 | return pme; |
662 | } | 663 | } |
663 | 664 | ||
664 | static int pagemap_hugetlb_range(pte_t *pte, unsigned long addr, | 665 | /* This function walks within one hugetlb entry in the single call */ |
665 | unsigned long end, struct mm_walk *walk) | 666 | static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask, |
667 | unsigned long addr, unsigned long end, | ||
668 | struct mm_walk *walk) | ||
666 | { | 669 | { |
667 | struct vm_area_struct *vma; | ||
668 | struct pagemapread *pm = walk->private; | 670 | struct pagemapread *pm = walk->private; |
669 | struct hstate *hs = NULL; | ||
670 | int err = 0; | 671 | int err = 0; |
672 | u64 pfn; | ||
671 | 673 | ||
672 | vma = find_vma(walk->mm, addr); | ||
673 | if (vma) | ||
674 | hs = hstate_vma(vma); | ||
675 | for (; addr != end; addr += PAGE_SIZE) { | 674 | for (; addr != end; addr += PAGE_SIZE) { |
676 | u64 pfn = PM_NOT_PRESENT; | 675 | int offset = (addr & ~hmask) >> PAGE_SHIFT; |
677 | 676 | pfn = huge_pte_to_pagemap_entry(*pte, offset); | |
678 | if (vma && (addr >= vma->vm_end)) { | ||
679 | vma = find_vma(walk->mm, addr); | ||
680 | if (vma) | ||
681 | hs = hstate_vma(vma); | ||
682 | } | ||
683 | |||
684 | if (vma && (vma->vm_start <= addr) && is_vm_hugetlb_page(vma)) { | ||
685 | /* calculate pfn of the "raw" page in the hugepage. */ | ||
686 | int offset = (addr & ~huge_page_mask(hs)) >> PAGE_SHIFT; | ||
687 | pfn = huge_pte_to_pagemap_entry(*pte, offset); | ||
688 | } | ||
689 | err = add_to_pagemap(addr, pfn, pm); | 677 | err = add_to_pagemap(addr, pfn, pm); |
690 | if (err) | 678 | if (err) |
691 | return err; | 679 | return err; |
@@ -720,21 +708,20 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long addr, | |||
720 | * determine which areas of memory are actually mapped and llseek to | 708 | * determine which areas of memory are actually mapped and llseek to |
721 | * skip over unmapped regions. | 709 | * skip over unmapped regions. |
722 | */ | 710 | */ |
711 | #define PAGEMAP_WALK_SIZE (PMD_SIZE) | ||
723 | static ssize_t pagemap_read(struct file *file, char __user *buf, | 712 | static ssize_t pagemap_read(struct file *file, char __user *buf, |
724 | size_t count, loff_t *ppos) | 713 | size_t count, loff_t *ppos) |
725 | { | 714 | { |
726 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); | 715 | struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); |
727 | struct page **pages, *page; | ||
728 | unsigned long uaddr, uend; | ||
729 | struct mm_struct *mm; | 716 | struct mm_struct *mm; |
730 | struct pagemapread pm; | 717 | struct pagemapread pm; |
731 | int pagecount; | ||
732 | int ret = -ESRCH; | 718 | int ret = -ESRCH; |
733 | struct mm_walk pagemap_walk = {}; | 719 | struct mm_walk pagemap_walk = {}; |
734 | unsigned long src; | 720 | unsigned long src; |
735 | unsigned long svpfn; | 721 | unsigned long svpfn; |
736 | unsigned long start_vaddr; | 722 | unsigned long start_vaddr; |
737 | unsigned long end_vaddr; | 723 | unsigned long end_vaddr; |
724 | int copied = 0; | ||
738 | 725 | ||
739 | if (!task) | 726 | if (!task) |
740 | goto out; | 727 | goto out; |
@@ -757,35 +744,12 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
757 | if (!mm) | 744 | if (!mm) |
758 | goto out_task; | 745 | goto out_task; |
759 | 746 | ||
760 | 747 | pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); | |
761 | uaddr = (unsigned long)buf & PAGE_MASK; | 748 | pm.buffer = kmalloc(pm.len, GFP_TEMPORARY); |
762 | uend = (unsigned long)(buf + count); | ||
763 | pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE; | ||
764 | ret = 0; | ||
765 | if (pagecount == 0) | ||
766 | goto out_mm; | ||
767 | pages = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL); | ||
768 | ret = -ENOMEM; | 749 | ret = -ENOMEM; |
769 | if (!pages) | 750 | if (!pm.buffer) |
770 | goto out_mm; | 751 | goto out_mm; |
771 | 752 | ||
772 | down_read(¤t->mm->mmap_sem); | ||
773 | ret = get_user_pages(current, current->mm, uaddr, pagecount, | ||
774 | 1, 0, pages, NULL); | ||
775 | up_read(¤t->mm->mmap_sem); | ||
776 | |||
777 | if (ret < 0) | ||
778 | goto out_free; | ||
779 | |||
780 | if (ret != pagecount) { | ||
781 | pagecount = ret; | ||
782 | ret = -EFAULT; | ||
783 | goto out_pages; | ||
784 | } | ||
785 | |||
786 | pm.out = (u64 __user *)buf; | ||
787 | pm.end = (u64 __user *)(buf + count); | ||
788 | |||
789 | pagemap_walk.pmd_entry = pagemap_pte_range; | 753 | pagemap_walk.pmd_entry = pagemap_pte_range; |
790 | pagemap_walk.pte_hole = pagemap_pte_hole; | 754 | pagemap_walk.pte_hole = pagemap_pte_hole; |
791 | pagemap_walk.hugetlb_entry = pagemap_hugetlb_range; | 755 | pagemap_walk.hugetlb_entry = pagemap_hugetlb_range; |
@@ -807,23 +771,36 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
807 | * user buffer is tracked in "pm", and the walk | 771 | * user buffer is tracked in "pm", and the walk |
808 | * will stop when we hit the end of the buffer. | 772 | * will stop when we hit the end of the buffer. |
809 | */ | 773 | */ |
810 | ret = walk_page_range(start_vaddr, end_vaddr, &pagemap_walk); | 774 | ret = 0; |
811 | if (ret == PM_END_OF_BUFFER) | 775 | while (count && (start_vaddr < end_vaddr)) { |
812 | ret = 0; | 776 | int len; |
813 | /* don't need mmap_sem for these, but this looks cleaner */ | 777 | unsigned long end; |
814 | *ppos += (char __user *)pm.out - buf; | 778 | |
815 | if (!ret) | 779 | pm.pos = 0; |
816 | ret = (char __user *)pm.out - buf; | 780 | end = start_vaddr + PAGEMAP_WALK_SIZE; |
817 | 781 | /* overflow ? */ | |
818 | out_pages: | 782 | if (end < start_vaddr || end > end_vaddr) |
819 | for (; pagecount; pagecount--) { | 783 | end = end_vaddr; |
820 | page = pages[pagecount-1]; | 784 | down_read(&mm->mmap_sem); |
821 | if (!PageReserved(page)) | 785 | ret = walk_page_range(start_vaddr, end, &pagemap_walk); |
822 | SetPageDirty(page); | 786 | up_read(&mm->mmap_sem); |
823 | page_cache_release(page); | 787 | start_vaddr = end; |
788 | |||
789 | len = min(count, PM_ENTRY_BYTES * pm.pos); | ||
790 | if (copy_to_user(buf, pm.buffer, len)) { | ||
791 | ret = -EFAULT; | ||
792 | goto out_free; | ||
793 | } | ||
794 | copied += len; | ||
795 | buf += len; | ||
796 | count -= len; | ||
824 | } | 797 | } |
798 | *ppos += copied; | ||
799 | if (!ret || ret == PM_END_OF_BUFFER) | ||
800 | ret = copied; | ||
801 | |||
825 | out_free: | 802 | out_free: |
826 | kfree(pages); | 803 | kfree(pm.buffer); |
827 | out_mm: | 804 | out_mm: |
828 | mmput(mm); | 805 | mmput(mm); |
829 | out_task: | 806 | out_task: |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 5d9fd64ef81a..46d4b5d72bd3 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/fs_struct.h> | 5 | #include <linux/fs_struct.h> |
6 | #include <linux/mount.h> | 6 | #include <linux/mount.h> |
7 | #include <linux/ptrace.h> | 7 | #include <linux/ptrace.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/seq_file.h> | 9 | #include <linux/seq_file.h> |
9 | #include "internal.h" | 10 | #include "internal.h" |
10 | 11 | ||
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 0872afa58d39..9fbc99ec799a 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/user.h> | 12 | #include <linux/user.h> |
13 | #include <linux/elf.h> | 13 | #include <linux/elf.h> |
14 | #include <linux/elfcore.h> | 14 | #include <linux/elfcore.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/highmem.h> | 16 | #include <linux/highmem.h> |
16 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
diff --git a/fs/quota/Kconfig b/fs/quota/Kconfig index dad7fb247ddc..3e21b1e2ad3a 100644 --- a/fs/quota/Kconfig +++ b/fs/quota/Kconfig | |||
@@ -33,6 +33,14 @@ config PRINT_QUOTA_WARNING | |||
33 | Note that this behavior is currently deprecated and may go away in | 33 | Note that this behavior is currently deprecated and may go away in |
34 | future. Please use notification via netlink socket instead. | 34 | future. Please use notification via netlink socket instead. |
35 | 35 | ||
36 | config QUOTA_DEBUG | ||
37 | bool "Additional quota sanity checks" | ||
38 | depends on QUOTA | ||
39 | default n | ||
40 | help | ||
41 | If you say Y here, quota subsystem will perform some additional | ||
42 | sanity checks of quota internal structures. If unsure, say N. | ||
43 | |||
36 | # Generic support for tree structured quota files. Selected when needed. | 44 | # Generic support for tree structured quota files. Selected when needed. |
37 | config QUOTA_TREE | 45 | config QUOTA_TREE |
38 | tristate | 46 | tristate |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index e0b870f4749f..788b5802a7ce 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -80,8 +80,6 @@ | |||
80 | 80 | ||
81 | #include <asm/uaccess.h> | 81 | #include <asm/uaccess.h> |
82 | 82 | ||
83 | #define __DQUOT_PARANOIA | ||
84 | |||
85 | /* | 83 | /* |
86 | * There are three quota SMP locks. dq_list_lock protects all lists with quotas | 84 | * There are three quota SMP locks. dq_list_lock protects all lists with quotas |
87 | * and quota formats, dqstats structure containing statistics about the lists | 85 | * and quota formats, dqstats structure containing statistics about the lists |
@@ -695,7 +693,7 @@ void dqput(struct dquot *dquot) | |||
695 | 693 | ||
696 | if (!dquot) | 694 | if (!dquot) |
697 | return; | 695 | return; |
698 | #ifdef __DQUOT_PARANOIA | 696 | #ifdef CONFIG_QUOTA_DEBUG |
699 | if (!atomic_read(&dquot->dq_count)) { | 697 | if (!atomic_read(&dquot->dq_count)) { |
700 | printk("VFS: dqput: trying to free free dquot\n"); | 698 | printk("VFS: dqput: trying to free free dquot\n"); |
701 | printk("VFS: device %s, dquot of %s %d\n", | 699 | printk("VFS: device %s, dquot of %s %d\n", |
@@ -748,7 +746,7 @@ we_slept: | |||
748 | goto we_slept; | 746 | goto we_slept; |
749 | } | 747 | } |
750 | atomic_dec(&dquot->dq_count); | 748 | atomic_dec(&dquot->dq_count); |
751 | #ifdef __DQUOT_PARANOIA | 749 | #ifdef CONFIG_QUOTA_DEBUG |
752 | /* sanity check */ | 750 | /* sanity check */ |
753 | BUG_ON(!list_empty(&dquot->dq_free)); | 751 | BUG_ON(!list_empty(&dquot->dq_free)); |
754 | #endif | 752 | #endif |
@@ -845,7 +843,7 @@ we_slept: | |||
845 | dquot = NULL; | 843 | dquot = NULL; |
846 | goto out; | 844 | goto out; |
847 | } | 845 | } |
848 | #ifdef __DQUOT_PARANOIA | 846 | #ifdef CONFIG_QUOTA_DEBUG |
849 | BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ | 847 | BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ |
850 | #endif | 848 | #endif |
851 | out: | 849 | out: |
@@ -874,14 +872,18 @@ static int dqinit_needed(struct inode *inode, int type) | |||
874 | static void add_dquot_ref(struct super_block *sb, int type) | 872 | static void add_dquot_ref(struct super_block *sb, int type) |
875 | { | 873 | { |
876 | struct inode *inode, *old_inode = NULL; | 874 | struct inode *inode, *old_inode = NULL; |
875 | #ifdef CONFIG_QUOTA_DEBUG | ||
877 | int reserved = 0; | 876 | int reserved = 0; |
877 | #endif | ||
878 | 878 | ||
879 | spin_lock(&inode_lock); | 879 | spin_lock(&inode_lock); |
880 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 880 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
881 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) | 881 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW)) |
882 | continue; | 882 | continue; |
883 | #ifdef CONFIG_QUOTA_DEBUG | ||
883 | if (unlikely(inode_get_rsv_space(inode) > 0)) | 884 | if (unlikely(inode_get_rsv_space(inode) > 0)) |
884 | reserved = 1; | 885 | reserved = 1; |
886 | #endif | ||
885 | if (!atomic_read(&inode->i_writecount)) | 887 | if (!atomic_read(&inode->i_writecount)) |
886 | continue; | 888 | continue; |
887 | if (!dqinit_needed(inode, type)) | 889 | if (!dqinit_needed(inode, type)) |
@@ -903,11 +905,13 @@ static void add_dquot_ref(struct super_block *sb, int type) | |||
903 | spin_unlock(&inode_lock); | 905 | spin_unlock(&inode_lock); |
904 | iput(old_inode); | 906 | iput(old_inode); |
905 | 907 | ||
908 | #ifdef CONFIG_QUOTA_DEBUG | ||
906 | if (reserved) { | 909 | if (reserved) { |
907 | printk(KERN_WARNING "VFS (%s): Writes happened before quota" | 910 | printk(KERN_WARNING "VFS (%s): Writes happened before quota" |
908 | " was turned on thus quota information is probably " | 911 | " was turned on thus quota information is probably " |
909 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); | 912 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); |
910 | } | 913 | } |
914 | #endif | ||
911 | } | 915 | } |
912 | 916 | ||
913 | /* | 917 | /* |
@@ -934,7 +938,7 @@ static int remove_inode_dquot_ref(struct inode *inode, int type, | |||
934 | inode->i_dquot[type] = NULL; | 938 | inode->i_dquot[type] = NULL; |
935 | if (dquot) { | 939 | if (dquot) { |
936 | if (dqput_blocks(dquot)) { | 940 | if (dqput_blocks(dquot)) { |
937 | #ifdef __DQUOT_PARANOIA | 941 | #ifdef CONFIG_QUOTA_DEBUG |
938 | if (atomic_read(&dquot->dq_count) != 1) | 942 | if (atomic_read(&dquot->dq_count) != 1) |
939 | printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); | 943 | printk(KERN_WARNING "VFS: Adding dquot with dq_count %d to dispose list.\n", atomic_read(&dquot->dq_count)); |
940 | #endif | 944 | #endif |
@@ -2322,34 +2326,34 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
2322 | if (di->dqb_valid & QIF_SPACE) { | 2326 | if (di->dqb_valid & QIF_SPACE) { |
2323 | dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; | 2327 | dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace; |
2324 | check_blim = 1; | 2328 | check_blim = 1; |
2325 | __set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); | 2329 | set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); |
2326 | } | 2330 | } |
2327 | if (di->dqb_valid & QIF_BLIMITS) { | 2331 | if (di->dqb_valid & QIF_BLIMITS) { |
2328 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); | 2332 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); |
2329 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); | 2333 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); |
2330 | check_blim = 1; | 2334 | check_blim = 1; |
2331 | __set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); | 2335 | set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); |
2332 | } | 2336 | } |
2333 | if (di->dqb_valid & QIF_INODES) { | 2337 | if (di->dqb_valid & QIF_INODES) { |
2334 | dm->dqb_curinodes = di->dqb_curinodes; | 2338 | dm->dqb_curinodes = di->dqb_curinodes; |
2335 | check_ilim = 1; | 2339 | check_ilim = 1; |
2336 | __set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); | 2340 | set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); |
2337 | } | 2341 | } |
2338 | if (di->dqb_valid & QIF_ILIMITS) { | 2342 | if (di->dqb_valid & QIF_ILIMITS) { |
2339 | dm->dqb_isoftlimit = di->dqb_isoftlimit; | 2343 | dm->dqb_isoftlimit = di->dqb_isoftlimit; |
2340 | dm->dqb_ihardlimit = di->dqb_ihardlimit; | 2344 | dm->dqb_ihardlimit = di->dqb_ihardlimit; |
2341 | check_ilim = 1; | 2345 | check_ilim = 1; |
2342 | __set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); | 2346 | set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); |
2343 | } | 2347 | } |
2344 | if (di->dqb_valid & QIF_BTIME) { | 2348 | if (di->dqb_valid & QIF_BTIME) { |
2345 | dm->dqb_btime = di->dqb_btime; | 2349 | dm->dqb_btime = di->dqb_btime; |
2346 | check_blim = 1; | 2350 | check_blim = 1; |
2347 | __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); | 2351 | set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); |
2348 | } | 2352 | } |
2349 | if (di->dqb_valid & QIF_ITIME) { | 2353 | if (di->dqb_valid & QIF_ITIME) { |
2350 | dm->dqb_itime = di->dqb_itime; | 2354 | dm->dqb_itime = di->dqb_itime; |
2351 | check_ilim = 1; | 2355 | check_ilim = 1; |
2352 | __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); | 2356 | set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); |
2353 | } | 2357 | } |
2354 | 2358 | ||
2355 | if (check_blim) { | 2359 | if (check_blim) { |
diff --git a/fs/quota/netlink.c b/fs/quota/netlink.c index 2663ed90fb03..d67908b407d9 100644 --- a/fs/quota/netlink.c +++ b/fs/quota/netlink.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/quotaops.h> | 6 | #include <linux/quotaops.h> |
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/slab.h> | ||
8 | #include <net/netlink.h> | 9 | #include <net/netlink.h> |
9 | #include <net/genetlink.h> | 10 | #include <net/genetlink.h> |
10 | 11 | ||
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 1739a4aba25f..5ea4ad81a429 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/pagevec.h> | 21 | #include <linux/pagevec.h> |
22 | #include <linux/mman.h> | 22 | #include <linux/mman.h> |
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <linux/slab.h> | ||
24 | 25 | ||
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
26 | #include "internal.h" | 27 | #include "internal.h" |
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index a6090aa1a7c1..c94853473ca9 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/magic.h> | 37 | #include <linux/magic.h> |
38 | #include <linux/slab.h> | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | #include "internal.h" | 40 | #include "internal.h" |
40 | 41 | ||
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index c094f58c7448..f8a6075abf50 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/reiserfs_fs.h> | 8 | #include <linux/reiserfs_fs.h> |
9 | #include <linux/stat.h> | 9 | #include <linux/stat.h> |
10 | #include <linux/buffer_head.h> | 10 | #include <linux/buffer_head.h> |
11 | #include <linux/slab.h> | ||
11 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
12 | 13 | ||
13 | extern const struct reiserfs_key MIN_KEY; | 14 | extern const struct reiserfs_key MIN_KEY; |
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index 6591cb21edf6..1e4250bc3a6f 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -35,6 +35,7 @@ | |||
35 | **/ | 35 | **/ |
36 | 36 | ||
37 | #include <linux/time.h> | 37 | #include <linux/time.h> |
38 | #include <linux/slab.h> | ||
38 | #include <linux/string.h> | 39 | #include <linux/string.h> |
39 | #include <linux/reiserfs_fs.h> | 40 | #include <linux/reiserfs_fs.h> |
40 | #include <linux/buffer_head.h> | 41 | #include <linux/buffer_head.h> |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index d1da94b82d8f..dc2c65e04853 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/smp_lock.h> | 11 | #include <linux/smp_lock.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/highmem.h> | 13 | #include <linux/highmem.h> |
14 | #include <linux/slab.h> | ||
14 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
15 | #include <asm/unaligned.h> | 16 | #include <asm/unaligned.h> |
16 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index f3de5e8a2ae8..19fbc810e8e7 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/blkdev.h> | 50 | #include <linux/blkdev.h> |
51 | #include <linux/backing-dev.h> | 51 | #include <linux/backing-dev.h> |
52 | #include <linux/uaccess.h> | 52 | #include <linux/uaccess.h> |
53 | #include <linux/slab.h> | ||
53 | 54 | ||
54 | #include <asm/system.h> | 55 | #include <asm/system.h> |
55 | 56 | ||
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 96e4cbbfaa18..d0c43cb99ffc 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/time.h> | 14 | #include <linux/time.h> |
15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/reiserfs_fs.h> | 17 | #include <linux/reiserfs_fs.h> |
17 | #include <linux/reiserfs_acl.h> | 18 | #include <linux/reiserfs_acl.h> |
18 | #include <linux/reiserfs_xattr.h> | 19 | #include <linux/reiserfs_xattr.h> |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 04bf5d791bda..59125fb36d42 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/vmalloc.h> | 16 | #include <linux/vmalloc.h> |
16 | #include <linux/time.h> | 17 | #include <linux/time.h> |
17 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
@@ -1618,10 +1619,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1618 | save_mount_options(s, data); | 1619 | save_mount_options(s, data); |
1619 | 1620 | ||
1620 | sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); | 1621 | sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL); |
1621 | if (!sbi) { | 1622 | if (!sbi) |
1622 | errval = -ENOMEM; | 1623 | return -ENOMEM; |
1623 | goto error_alloc; | ||
1624 | } | ||
1625 | s->s_fs_info = sbi; | 1624 | s->s_fs_info = sbi; |
1626 | /* Set default values for options: non-aggressive tails, RO on errors */ | 1625 | /* Set default values for options: non-aggressive tails, RO on errors */ |
1627 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); | 1626 | REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL); |
@@ -1878,12 +1877,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1878 | return (0); | 1877 | return (0); |
1879 | 1878 | ||
1880 | error: | 1879 | error: |
1881 | reiserfs_write_unlock(s); | ||
1882 | error_alloc: | ||
1883 | if (jinit_done) { /* kill the commit thread, free journal ram */ | 1880 | if (jinit_done) { /* kill the commit thread, free journal ram */ |
1884 | journal_release_error(NULL, s); | 1881 | journal_release_error(NULL, s); |
1885 | } | 1882 | } |
1886 | 1883 | ||
1884 | reiserfs_write_unlock(s); | ||
1885 | |||
1887 | reiserfs_free_bitmap_cache(s); | 1886 | reiserfs_free_bitmap_cache(s); |
1888 | if (SB_BUFFER_WITH_SB(s)) | 1887 | if (SB_BUFFER_WITH_SB(s)) |
1889 | brelse(SB_BUFFER_WITH_SB(s)); | 1888 | brelse(SB_BUFFER_WITH_SB(s)); |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 37d034ca7d99..4f9586bb7631 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/dcache.h> | 38 | #include <linux/dcache.h> |
39 | #include <linux/namei.h> | 39 | #include <linux/namei.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/gfp.h> | ||
41 | #include <linux/fs.h> | 42 | #include <linux/fs.h> |
42 | #include <linux/file.h> | 43 | #include <linux/file.h> |
43 | #include <linux/pagemap.h> | 44 | #include <linux/pagemap.h> |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index dd20a7883f0f..9cdb759645a9 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
6 | #include <linux/pagemap.h> | 6 | #include <linux/pagemap.h> |
7 | #include <linux/xattr.h> | 7 | #include <linux/xattr.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/posix_acl_xattr.h> | 9 | #include <linux/posix_acl_xattr.h> |
9 | #include <linux/reiserfs_xattr.h> | 10 | #include <linux/reiserfs_xattr.h> |
10 | #include <linux/reiserfs_acl.h> | 11 | #include <linux/reiserfs_acl.h> |
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index de1fcffd906b..7271a477c041 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/pagemap.h> | 4 | #include <linux/pagemap.h> |
5 | #include <linux/xattr.h> | 5 | #include <linux/xattr.h> |
6 | #include <linux/slab.h> | ||
6 | #include <linux/reiserfs_xattr.h> | 7 | #include <linux/reiserfs_xattr.h> |
7 | #include <linux/security.h> | 8 | #include <linux/security.h> |
8 | #include <asm/uaccess.h> | 9 | #include <asm/uaccess.h> |
diff --git a/fs/signalfd.c b/fs/signalfd.c index 1dabe4ee02fe..f329849ce3c0 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
26 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
27 | #include <linux/list.h> | 28 | #include <linux/list.h> |
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index 92d5e8ffb639..dbf6548bbf06 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/fcntl.h> | 13 | #include <linux/fcntl.h> |
14 | #include <linux/stat.h> | 14 | #include <linux/stat.h> |
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/slab.h> | ||
17 | #include <linux/pagemap.h> | 16 | #include <linux/pagemap.h> |
18 | #include <linux/smp_lock.h> | 17 | #include <linux/smp_lock.h> |
19 | #include <linux/net.h> | 18 | #include <linux/net.h> |
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 6bd9b691a463..0e39a924f10a 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/stat.h> | 13 | #include <linux/stat.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/init.h> | 15 | #include <linux/init.h> |
17 | #include <linux/file.h> | 16 | #include <linux/file.h> |
18 | #include <linux/dcache.h> | 17 | #include <linux/dcache.h> |
diff --git a/fs/smbfs/symlink.c b/fs/smbfs/symlink.c index 00b2909bd469..54350b59046b 100644 --- a/fs/smbfs/symlink.c +++ b/fs/smbfs/symlink.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/net.h> | 16 | #include <linux/net.h> |
17 | #include <linux/namei.h> | 17 | #include <linux/namei.h> |
18 | #include <linux/slab.h> | ||
18 | 19 | ||
19 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
20 | #include <asm/system.h> | 21 | #include <asm/system.h> |
diff --git a/fs/splice.c b/fs/splice.c index 39208663aaf1..9313b6124a2e 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/syscalls.h> | 30 | #include <linux/syscalls.h> |
31 | #include <linux/uio.h> | 31 | #include <linux/uio.h> |
32 | #include <linux/security.h> | 32 | #include <linux/security.h> |
33 | #include <linux/gfp.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * Attempt to steal a page from a pipe buffer. This should perhaps go into | 36 | * Attempt to steal a page from a pipe buffer. This should perhaps go into |
diff --git a/fs/squashfs/symlink.c b/fs/squashfs/symlink.c index e80be2022a7f..32b911f4ee39 100644 --- a/fs/squashfs/symlink.c +++ b/fs/squashfs/symlink.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/vfs.h> | 34 | #include <linux/vfs.h> |
35 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
36 | #include <linux/slab.h> | ||
37 | #include <linux/string.h> | 36 | #include <linux/string.h> |
38 | #include <linux/pagemap.h> | 37 | #include <linux/pagemap.h> |
39 | 38 | ||
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c index 4dd70e04333b..15a03d0fb9f3 100644 --- a/fs/squashfs/zlib_wrapper.c +++ b/fs/squashfs/zlib_wrapper.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/buffer_head.h> | 26 | #include <linux/buffer_head.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/zlib.h> | 28 | #include <linux/zlib.h> |
28 | 29 | ||
29 | #include "squashfs_fs.h" | 30 | #include "squashfs_fs.h" |
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/file.h> | 6 | #include <linux/file.h> |
7 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
8 | #include <linux/slab.h> | ||
8 | #include <linux/module.h> | 9 | #include <linux/module.h> |
9 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
10 | #include <linux/writeback.h> | 11 | #include <linux/writeback.h> |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 082daaecac1b..a4a0a9419711 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/capability.h> | 18 | #include <linux/capability.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/xattr.h> | 22 | #include <linux/xattr.h> |
22 | #include <linux/security.h> | 23 | #include <linux/security.h> |
23 | #include "sysfs.h" | 24 | #include "sysfs.h" |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 0cb10884a2fc..776137828dca 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/magic.h> | 20 | #include <linux/magic.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include "sysfs.h" | 23 | #include "sysfs.h" |
23 | 24 | ||
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 1b9a3a1e8a17..b93ec51fa7ac 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -11,6 +11,7 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/gfp.h> | ||
14 | #include <linux/mount.h> | 15 | #include <linux/mount.h> |
15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
16 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
diff --git a/fs/timerfd.c b/fs/timerfd.c index 1bfc95ad5f71..98158de91d24 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/slab.h> | ||
17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
19 | #include <linux/time.h> | 20 | #include <linux/time.h> |
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index 4775af401167..37fa7ed062d8 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -45,6 +45,7 @@ | |||
45 | 45 | ||
46 | #include <linux/freezer.h> | 46 | #include <linux/freezer.h> |
47 | #include <linux/kthread.h> | 47 | #include <linux/kthread.h> |
48 | #include <linux/slab.h> | ||
48 | #include "ubifs.h" | 49 | #include "ubifs.h" |
49 | 50 | ||
50 | /** | 51 | /** |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 90492327b383..c2a68baa782f 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
35 | #include <linux/debugfs.h> | 35 | #include <linux/debugfs.h> |
36 | #include <linux/math64.h> | 36 | #include <linux/math64.h> |
37 | #include <linux/slab.h> | ||
37 | 38 | ||
38 | #ifdef CONFIG_UBIFS_FS_DEBUG | 39 | #ifdef CONFIG_UBIFS_FS_DEBUG |
39 | 40 | ||
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index e26c02ab6cd5..5692cf72b807 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "ubifs.h" | 52 | #include "ubifs.h" |
53 | #include <linux/mount.h> | 53 | #include <linux/mount.h> |
54 | #include <linux/namei.h> | 54 | #include <linux/namei.h> |
55 | #include <linux/slab.h> | ||
55 | 56 | ||
56 | static int read_block(struct inode *inode, void *addr, unsigned int block, | 57 | static int read_block(struct inode *inode, void *addr, unsigned int block, |
57 | struct ubifs_data_node *dn) | 58 | struct ubifs_data_node *dn) |
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index e5a3d8e96bb7..918d1582ca05 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -53,6 +53,7 @@ | |||
53 | * good, and GC takes extra care when moving them. | 53 | * good, and GC takes extra care when moving them. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <linux/slab.h> | ||
56 | #include <linux/pagemap.h> | 57 | #include <linux/pagemap.h> |
57 | #include <linux/list_sort.h> | 58 | #include <linux/list_sort.h> |
58 | #include "ubifs.h" | 59 | #include "ubifs.h" |
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index e589fedaf1ef..77d5cf4a7547 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -51,6 +51,7 @@ | |||
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/crc32.h> | 53 | #include <linux/crc32.h> |
54 | #include <linux/slab.h> | ||
54 | #include "ubifs.h" | 55 | #include "ubifs.h" |
55 | 56 | ||
56 | /** | 57 | /** |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index b2792e84d245..ad7f67b827ea 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "ubifs.h" | 46 | #include "ubifs.h" |
47 | #include <linux/crc16.h> | 47 | #include <linux/crc16.h> |
48 | #include <linux/math64.h> | 48 | #include <linux/math64.h> |
49 | #include <linux/slab.h> | ||
49 | 50 | ||
50 | /** | 51 | /** |
51 | * do_calc_lpt_geom - calculate sizes for the LPT area. | 52 | * do_calc_lpt_geom - calculate sizes for the LPT area. |
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 8cbfb8248025..13cb7a4237bf 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/crc16.h> | 28 | #include <linux/crc16.h> |
29 | #include <linux/slab.h> | ||
29 | #include "ubifs.h" | 30 | #include "ubifs.h" |
30 | 31 | ||
31 | /** | 32 | /** |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 868a55ee080f..109c6ea03bb5 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -31,6 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
34 | #include <linux/slab.h> | ||
34 | #include "ubifs.h" | 35 | #include "ubifs.h" |
35 | 36 | ||
36 | /** | 37 | /** |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 57085e43320f..96cb62c8a9dd 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -27,6 +27,7 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "ubifs.h" | 29 | #include "ubifs.h" |
30 | #include <linux/slab.h> | ||
30 | #include <linux/random.h> | 31 | #include <linux/random.h> |
31 | #include <linux/math64.h> | 32 | #include <linux/math64.h> |
32 | 33 | ||
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index e5b1a7d00fa0..2194915220e5 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -31,6 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
34 | #include <linux/slab.h> | ||
34 | #include "ubifs.h" | 35 | #include "ubifs.h" |
35 | 36 | ||
36 | /* | 37 | /* |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index b2d976366a46..bd2542dad014 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/err.h> | 29 | #include <linux/err.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/slab.h> | ||
31 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
32 | #include <linux/spinlock.h> | 33 | #include <linux/spinlock.h> |
33 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 195830f47569..c74400f88fe0 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
@@ -56,6 +56,7 @@ | |||
56 | */ | 56 | */ |
57 | 57 | ||
58 | #include "ubifs.h" | 58 | #include "ubifs.h" |
59 | #include <linux/slab.h> | ||
59 | #include <linux/xattr.h> | 60 | #include <linux/xattr.h> |
60 | #include <linux/posix_acl_xattr.h> | 61 | #include <linux/posix_acl_xattr.h> |
61 | 62 | ||
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 19626e2491c4..9a9378b4eb5a 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
@@ -125,9 +125,8 @@ static void udf_bitmap_free_blocks(struct super_block *sb, | |||
125 | 125 | ||
126 | mutex_lock(&sbi->s_alloc_mutex); | 126 | mutex_lock(&sbi->s_alloc_mutex); |
127 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; | 127 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; |
128 | if (bloc->logicalBlockNum < 0 || | 128 | if (bloc->logicalBlockNum + count < count || |
129 | (bloc->logicalBlockNum + count) > | 129 | (bloc->logicalBlockNum + count) > partmap->s_partition_len) { |
130 | partmap->s_partition_len) { | ||
131 | udf_debug("%d < %d || %d + %d > %d\n", | 130 | udf_debug("%d < %d || %d + %d > %d\n", |
132 | bloc->logicalBlockNum, 0, bloc->logicalBlockNum, | 131 | bloc->logicalBlockNum, 0, bloc->logicalBlockNum, |
133 | count, partmap->s_partition_len); | 132 | count, partmap->s_partition_len); |
@@ -393,9 +392,8 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
393 | 392 | ||
394 | mutex_lock(&sbi->s_alloc_mutex); | 393 | mutex_lock(&sbi->s_alloc_mutex); |
395 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; | 394 | partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; |
396 | if (bloc->logicalBlockNum < 0 || | 395 | if (bloc->logicalBlockNum + count < count || |
397 | (bloc->logicalBlockNum + count) > | 396 | (bloc->logicalBlockNum + count) > partmap->s_partition_len) { |
398 | partmap->s_partition_len) { | ||
399 | udf_debug("%d < %d || %d + %d > %d\n", | 397 | udf_debug("%d < %d || %d + %d > %d\n", |
400 | bloc->logicalBlockNum, 0, bloc->logicalBlockNum, count, | 398 | bloc->logicalBlockNum, 0, bloc->logicalBlockNum, count, |
401 | partmap->s_partition_len); | 399 | partmap->s_partition_len); |
diff --git a/fs/udf/file.c b/fs/udf/file.c index 1eb06774ed90..4b6a46ccbf46 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -218,7 +218,7 @@ const struct file_operations udf_file_operations = { | |||
218 | .llseek = generic_file_llseek, | 218 | .llseek = generic_file_llseek, |
219 | }; | 219 | }; |
220 | 220 | ||
221 | static int udf_setattr(struct dentry *dentry, struct iattr *iattr) | 221 | int udf_setattr(struct dentry *dentry, struct iattr *iattr) |
222 | { | 222 | { |
223 | struct inode *inode = dentry->d_inode; | 223 | struct inode *inode = dentry->d_inode; |
224 | int error; | 224 | int error; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index bb863fe579ac..8a3fbd177cab 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1314,7 +1314,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1314 | break; | 1314 | break; |
1315 | case ICBTAG_FILE_TYPE_SYMLINK: | 1315 | case ICBTAG_FILE_TYPE_SYMLINK: |
1316 | inode->i_data.a_ops = &udf_symlink_aops; | 1316 | inode->i_data.a_ops = &udf_symlink_aops; |
1317 | inode->i_op = &page_symlink_inode_operations; | 1317 | inode->i_op = &udf_symlink_inode_operations; |
1318 | inode->i_mode = S_IFLNK | S_IRWXUGO; | 1318 | inode->i_mode = S_IFLNK | S_IRWXUGO; |
1319 | break; | 1319 | break; |
1320 | case ICBTAG_FILE_TYPE_MAIN: | 1320 | case ICBTAG_FILE_TYPE_MAIN: |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index db423ab078b1..75816025f95f 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -925,7 +925,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
925 | iinfo = UDF_I(inode); | 925 | iinfo = UDF_I(inode); |
926 | inode->i_mode = S_IFLNK | S_IRWXUGO; | 926 | inode->i_mode = S_IFLNK | S_IRWXUGO; |
927 | inode->i_data.a_ops = &udf_symlink_aops; | 927 | inode->i_data.a_ops = &udf_symlink_aops; |
928 | inode->i_op = &page_symlink_inode_operations; | 928 | inode->i_op = &udf_symlink_inode_operations; |
929 | 929 | ||
930 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { | 930 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { |
931 | struct kernel_lb_addr eloc; | 931 | struct kernel_lb_addr eloc; |
@@ -1393,6 +1393,7 @@ const struct export_operations udf_export_ops = { | |||
1393 | const struct inode_operations udf_dir_inode_operations = { | 1393 | const struct inode_operations udf_dir_inode_operations = { |
1394 | .lookup = udf_lookup, | 1394 | .lookup = udf_lookup, |
1395 | .create = udf_create, | 1395 | .create = udf_create, |
1396 | .setattr = udf_setattr, | ||
1396 | .link = udf_link, | 1397 | .link = udf_link, |
1397 | .unlink = udf_unlink, | 1398 | .unlink = udf_unlink, |
1398 | .symlink = udf_symlink, | 1399 | .symlink = udf_symlink, |
@@ -1401,3 +1402,9 @@ const struct inode_operations udf_dir_inode_operations = { | |||
1401 | .mknod = udf_mknod, | 1402 | .mknod = udf_mknod, |
1402 | .rename = udf_rename, | 1403 | .rename = udf_rename, |
1403 | }; | 1404 | }; |
1405 | const struct inode_operations udf_symlink_inode_operations = { | ||
1406 | .readlink = generic_readlink, | ||
1407 | .follow_link = page_follow_link_light, | ||
1408 | .put_link = page_put_link, | ||
1409 | .setattr = udf_setattr, | ||
1410 | }; | ||
diff --git a/fs/udf/partition.c b/fs/udf/partition.c index 4b540ee632d5..745eb209be0c 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/buffer_head.h> | 27 | #include <linux/buffer_head.h> |
29 | 28 | ||
30 | uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, | 29 | uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, |
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index 852e91845688..16064787d2b7 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/stat.h> | 28 | #include <linux/stat.h> |
29 | #include <linux/slab.h> | ||
30 | #include <linux/pagemap.h> | 29 | #include <linux/pagemap.h> |
31 | #include <linux/smp_lock.h> | 30 | #include <linux/smp_lock.h> |
32 | #include <linux/buffer_head.h> | 31 | #include <linux/buffer_head.h> |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 4223ac855da9..702a1148e702 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -76,6 +76,7 @@ extern const struct inode_operations udf_dir_inode_operations; | |||
76 | extern const struct file_operations udf_dir_operations; | 76 | extern const struct file_operations udf_dir_operations; |
77 | extern const struct inode_operations udf_file_inode_operations; | 77 | extern const struct inode_operations udf_file_inode_operations; |
78 | extern const struct file_operations udf_file_operations; | 78 | extern const struct file_operations udf_file_operations; |
79 | extern const struct inode_operations udf_symlink_inode_operations; | ||
79 | extern const struct address_space_operations udf_aops; | 80 | extern const struct address_space_operations udf_aops; |
80 | extern const struct address_space_operations udf_adinicb_aops; | 81 | extern const struct address_space_operations udf_adinicb_aops; |
81 | extern const struct address_space_operations udf_symlink_aops; | 82 | extern const struct address_space_operations udf_symlink_aops; |
@@ -131,7 +132,7 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, | |||
131 | /* file.c */ | 132 | /* file.c */ |
132 | extern int udf_ioctl(struct inode *, struct file *, unsigned int, | 133 | extern int udf_ioctl(struct inode *, struct file *, unsigned int, |
133 | unsigned long); | 134 | unsigned long); |
134 | 135 | extern int udf_setattr(struct dentry *dentry, struct iattr *iattr); | |
135 | /* inode.c */ | 136 | /* inode.c */ |
136 | extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); | 137 | extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); |
137 | extern int udf_sync_inode(struct inode *); | 138 | extern int udf_sync_inode(struct inode *); |
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index cefa8c8913e6..d03a90b6ad69 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/string.h> /* for memset */ | 24 | #include <linux/string.h> /* for memset */ |
25 | #include <linux/nls.h> | 25 | #include <linux/nls.h> |
26 | #include <linux/crc-itu-t.h> | 26 | #include <linux/crc-itu-t.h> |
27 | #include <linux/slab.h> | ||
27 | 28 | ||
28 | #include "udf_sb.h" | 29 | #include "udf_sb.h" |
29 | 30 | ||
diff --git a/fs/xattr_acl.c b/fs/xattr_acl.c index 05ac0fe9c4d3..8d5a506c82eb 100644 --- a/fs/xattr_acl.c +++ b/fs/xattr_acl.c | |||
@@ -6,9 +6,9 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/slab.h> | ||
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/posix_acl_xattr.h> | 10 | #include <linux/posix_acl_xattr.h> |
11 | #include <linux/gfp.h> | ||
12 | 12 | ||
13 | 13 | ||
14 | /* | 14 | /* |
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index bc7405585def..666c9db48eb6 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/highmem.h> | 19 | #include <linux/highmem.h> |
20 | #include <linux/slab.h> | ||
20 | #include <linux/swap.h> | 21 | #include <linux/swap.h> |
21 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
22 | #include <linux/backing-dev.h> | 23 | #include <linux/backing-dev.h> |
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index bf85bbe4a9ae..a7bc925c4d60 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "xfs_inode.h" | 22 | #include "xfs_inode.h" |
23 | #include "xfs_vnodeops.h" | 23 | #include "xfs_vnodeops.h" |
24 | #include "xfs_trace.h" | 24 | #include "xfs_trace.h" |
25 | #include <linux/slab.h> | ||
25 | #include <linux/xattr.h> | 26 | #include <linux/xattr.h> |
26 | #include <linux/posix_acl_xattr.h> | 27 | #include <linux/posix_acl_xattr.h> |
27 | 28 | ||
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 99628508cb11..0f8b9968a803 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "xfs_vnodeops.h" | 40 | #include "xfs_vnodeops.h" |
41 | #include "xfs_trace.h" | 41 | #include "xfs_trace.h" |
42 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
43 | #include <linux/gfp.h> | ||
43 | #include <linux/mpage.h> | 44 | #include <linux/mpage.h> |
44 | #include <linux/pagevec.h> | 45 | #include <linux/pagevec.h> |
45 | #include <linux/writeback.h> | 46 | #include <linux/writeback.h> |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index bd111b7e1daa..44c2b0ef9a41 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include "xfs.h" | 18 | #include "xfs.h" |
19 | #include <linux/stddef.h> | 19 | #include <linux/stddef.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/gfp.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/vmalloc.h> | 24 | #include <linux/vmalloc.h> |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index 4ea1ee18aded..7b26cc2fd284 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/mount.h> | 58 | #include <linux/mount.h> |
59 | #include <linux/namei.h> | 59 | #include <linux/namei.h> |
60 | #include <linux/pagemap.h> | 60 | #include <linux/pagemap.h> |
61 | #include <linux/slab.h> | ||
61 | #include <linux/exportfs.h> | 62 | #include <linux/exportfs.h> |
62 | 63 | ||
63 | /* | 64 | /* |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index 0bf6d61f0528..593c05b4df8d 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/compat.h> | 18 | #include <linux/compat.h> |
19 | #include <linux/ioctl.h> | 19 | #include <linux/ioctl.h> |
20 | #include <linux/mount.h> | 20 | #include <linux/mount.h> |
21 | #include <linux/slab.h> | ||
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
22 | #include "xfs.h" | 23 | #include "xfs.h" |
23 | #include "xfs_fs.h" | 24 | #include "xfs_fs.h" |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 61a99608731e..e65a7937f3a4 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/security.h> | 56 | #include <linux/security.h> |
57 | #include <linux/falloc.h> | 57 | #include <linux/falloc.h> |
58 | #include <linux/fiemap.h> | 58 | #include <linux/fiemap.h> |
59 | #include <linux/slab.h> | ||
59 | 60 | ||
60 | /* | 61 | /* |
61 | * Bring the timestamps in the XFS inode uptodate. | 62 | * Bring the timestamps in the XFS inode uptodate. |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 71345a370d9f..52e06b487ced 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -61,6 +61,7 @@ | |||
61 | 61 | ||
62 | #include <linux/namei.h> | 62 | #include <linux/namei.h> |
63 | #include <linux/init.h> | 63 | #include <linux/init.h> |
64 | #include <linux/slab.h> | ||
64 | #include <linux/mount.h> | 65 | #include <linux/mount.h> |
65 | #include <linux/mempool.h> | 66 | #include <linux/mempool.h> |
66 | #include <linux/writeback.h> | 67 | #include <linux/writeback.h> |
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 05cd85317f6f..fd9698215759 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -820,10 +820,10 @@ xfs_reclaim_inode( | |||
820 | * call into reclaim to find it in a clean state instead of waiting for | 820 | * call into reclaim to find it in a clean state instead of waiting for |
821 | * it now. We also don't return errors here - if the error is transient | 821 | * it now. We also don't return errors here - if the error is transient |
822 | * then the next reclaim pass will flush the inode, and if the error | 822 | * then the next reclaim pass will flush the inode, and if the error |
823 | * is permanent then the next sync reclaim will relcaim the inode and | 823 | * is permanent then the next sync reclaim will reclaim the inode and |
824 | * pass on the error. | 824 | * pass on the error. |
825 | */ | 825 | */ |
826 | if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 826 | if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { |
827 | xfs_fs_cmn_err(CE_WARN, ip->i_mount, | 827 | xfs_fs_cmn_err(CE_WARN, ip->i_mount, |
828 | "inode 0x%llx background reclaim flush failed with %d", | 828 | "inode 0x%llx background reclaim flush failed with %d", |
829 | (long long)ip->i_ino, error); | 829 | (long long)ip->i_ino, error); |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index e8fba92d7cd9..2be019136287 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -745,9 +745,16 @@ xfs_log_move_tail(xfs_mount_t *mp, | |||
745 | 745 | ||
746 | /* | 746 | /* |
747 | * Determine if we have a transaction that has gone to disk | 747 | * Determine if we have a transaction that has gone to disk |
748 | * that needs to be covered. Log activity needs to be idle (no AIL and | 748 | * that needs to be covered. To begin the transition to the idle state |
749 | * nothing in the iclogs). And, we need to be in the right state indicating | 749 | * firstly the log needs to be idle (no AIL and nothing in the iclogs). |
750 | * something has gone out. | 750 | * If we are then in a state where covering is needed, the caller is informed |
751 | * that dummy transactions are required to move the log into the idle state. | ||
752 | * | ||
753 | * Because this is called as part of the sync process, we should also indicate | ||
754 | * that dummy transactions should be issued in anything but the covered or | ||
755 | * idle states. This ensures that the log tail is accurately reflected in | ||
756 | * the log at the end of the sync, hence if a crash occurrs avoids replay | ||
757 | * of transactions where the metadata is already on disk. | ||
751 | */ | 758 | */ |
752 | int | 759 | int |
753 | xfs_log_need_covered(xfs_mount_t *mp) | 760 | xfs_log_need_covered(xfs_mount_t *mp) |
@@ -759,17 +766,24 @@ xfs_log_need_covered(xfs_mount_t *mp) | |||
759 | return 0; | 766 | return 0; |
760 | 767 | ||
761 | spin_lock(&log->l_icloglock); | 768 | spin_lock(&log->l_icloglock); |
762 | if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || | 769 | switch (log->l_covered_state) { |
763 | (log->l_covered_state == XLOG_STATE_COVER_NEED2)) | 770 | case XLOG_STATE_COVER_DONE: |
764 | && !xfs_trans_ail_tail(log->l_ailp) | 771 | case XLOG_STATE_COVER_DONE2: |
765 | && xlog_iclogs_empty(log)) { | 772 | case XLOG_STATE_COVER_IDLE: |
766 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) | 773 | break; |
767 | log->l_covered_state = XLOG_STATE_COVER_DONE; | 774 | case XLOG_STATE_COVER_NEED: |
768 | else { | 775 | case XLOG_STATE_COVER_NEED2: |
769 | ASSERT(log->l_covered_state == XLOG_STATE_COVER_NEED2); | 776 | if (!xfs_trans_ail_tail(log->l_ailp) && |
770 | log->l_covered_state = XLOG_STATE_COVER_DONE2; | 777 | xlog_iclogs_empty(log)) { |
778 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) | ||
779 | log->l_covered_state = XLOG_STATE_COVER_DONE; | ||
780 | else | ||
781 | log->l_covered_state = XLOG_STATE_COVER_DONE2; | ||
771 | } | 782 | } |
783 | /* FALLTHRU */ | ||
784 | default: | ||
772 | needed = 1; | 785 | needed = 1; |
786 | break; | ||
773 | } | 787 | } |
774 | spin_unlock(&log->l_icloglock); | 788 | spin_unlock(&log->l_icloglock); |
775 | return needed; | 789 | return needed; |