diff options
author | Tejun Heo <tj@kernel.org> | 2010-03-24 04:04:11 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-03-30 09:02:32 -0400 |
commit | 5a0e3ad6af8660be21ca98a971cd00f331318c05 (patch) | |
tree | 5bfb7be11a03176a87296a43ac6647975c00a1d1 /fs/ceph | |
parent | ed391f4ebf8f701d3566423ce8f17e614cde9806 (diff) |
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/addr.c | 1 | ||||
-rw-r--r-- | fs/ceph/auth.c | 1 | ||||
-rw-r--r-- | fs/ceph/auth_none.c | 1 | ||||
-rw-r--r-- | fs/ceph/auth_x.c | 1 | ||||
-rw-r--r-- | fs/ceph/buffer.c | 3 | ||||
-rw-r--r-- | fs/ceph/caps.c | 1 | ||||
-rw-r--r-- | fs/ceph/crypto.c | 1 | ||||
-rw-r--r-- | fs/ceph/debugfs.c | 1 | ||||
-rw-r--r-- | fs/ceph/dir.c | 1 | ||||
-rw-r--r-- | fs/ceph/export.c | 1 | ||||
-rw-r--r-- | fs/ceph/file.c | 1 | ||||
-rw-r--r-- | fs/ceph/mds_client.c | 1 | ||||
-rw-r--r-- | fs/ceph/messenger.c | 1 | ||||
-rw-r--r-- | fs/ceph/mon_client.c | 1 | ||||
-rw-r--r-- | fs/ceph/osdmap.c | 4 | ||||
-rw-r--r-- | fs/ceph/pagelist.c | 1 | ||||
-rw-r--r-- | fs/ceph/snap.c | 1 | ||||
-rw-r--r-- | fs/ceph/super.c | 1 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 | ||||
-rw-r--r-- | fs/ceph/xattr.c | 1 |
20 files changed, 24 insertions, 1 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index ce8ef6107727..aa3cd7cc3e40 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 | ||
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..3710e077a857 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> |
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..7261dc6c2ead 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" |
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/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..8f1715ffbe4b 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> |
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..21c6623c4b07 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 | { |
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/snap.c b/fs/ceph/snap.c index df04e210a055..e6f9bc57d472 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" |
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..ca702c67bc66 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" |
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 | { |