diff options
author | Tejun Heo <tj@kernel.org> | 2010-03-24 17:04:11 +0900 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-03-30 22:02:32 +0900 |
commit | 5a0e3ad6af8660be21ca98a971cd00f331318c05 (patch) | |
tree | 5bfb7be11a03176a87296a43ac6647975c00a1d1 /drivers/block | |
parent | ed391f4ebf8f701d3566423ce8f17e614cde9806 (diff) | |
download | linux-5a0e3ad6af8660be21ca98a971cd00f331318c05.tar.bz2 |
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 'drivers/block')
-rw-r--r-- | drivers/block/amiflop.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoeblk.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoechr.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoedev.c | 1 | ||||
-rw-r--r-- | drivers/block/aoe/aoenet.c | 1 | ||||
-rw-r--r-- | drivers/block/brd.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_bitmap.c | 1 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_proc.c | 1 | ||||
-rw-r--r-- | drivers/block/hd.c | 1 | ||||
-rw-r--r-- | drivers/block/loop.c | 1 | ||||
-rw-r--r-- | drivers/block/mg_disk.c | 1 | ||||
-rw-r--r-- | drivers/block/nbd.c | 1 | ||||
-rw-r--r-- | drivers/block/osdblk.c | 1 | ||||
-rw-r--r-- | drivers/block/paride/pd.c | 1 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 1 | ||||
-rw-r--r-- | drivers/block/ps3disk.c | 1 | ||||
-rw-r--r-- | drivers/block/ps3vram.c | 1 | ||||
-rw-r--r-- | drivers/block/swim.c | 1 | ||||
-rw-r--r-- | drivers/block/ub.c | 1 | ||||
-rw-r--r-- | drivers/block/umem.c | 2 | ||||
-rw-r--r-- | drivers/block/virtio_blk.c | 1 | ||||
-rw-r--r-- | drivers/block/xd.c | 1 | ||||
-rw-r--r-- | drivers/block/xen-blkfront.c | 1 | ||||
-rw-r--r-- | drivers/block/z2ram.c | 1 |
25 files changed, 22 insertions, 5 deletions
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 055225839024..0182a22c423a 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c @@ -54,6 +54,7 @@ */ #include <linux/module.h> +#include <linux/slab.h> #include <linux/fd.h> #include <linux/hdreg.h> diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index 3af97d4da2db..035cefe4045a 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c @@ -9,6 +9,7 @@ #include <linux/backing-dev.h> #include <linux/fs.h> #include <linux/ioctl.h> +#include <linux/slab.h> #include <linux/genhd.h> #include <linux/netdevice.h> #include "aoe.h" diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 62141ec09a22..4a1b9e7464aa 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c @@ -8,6 +8,7 @@ #include <linux/blkdev.h> #include <linux/completion.h> #include <linux/delay.h> +#include <linux/slab.h> #include <linux/smp_lock.h> #include <linux/skbuff.h> #include "aoe.h" diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 64a223b0cc22..5674bd01d96d 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -5,6 +5,7 @@ */ #include <linux/ata.h> +#include <linux/slab.h> #include <linux/hdreg.h> #include <linux/blkdev.h> #include <linux/skbuff.h> diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c index fa67027789aa..0849280bfc1c 100644 --- a/drivers/block/aoe/aoedev.c +++ b/drivers/block/aoe/aoedev.c @@ -8,6 +8,7 @@ #include <linux/blkdev.h> #include <linux/netdevice.h> #include <linux/delay.h> +#include <linux/slab.h> #include "aoe.h" static void dummy_timer(ulong); diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index ce0d62cd71b2..4d3bc0d49df5 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c @@ -4,6 +4,7 @@ * Ethernet portion of AoE driver */ +#include <linux/gfp.h> #include <linux/hdreg.h> #include <linux/blkdev.h> #include <linux/netdevice.h> diff --git a/drivers/block/brd.c b/drivers/block/brd.c index c6ddeacb77fd..6081e81d5738 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -15,9 +15,9 @@ #include <linux/blkdev.h> #include <linux/bio.h> #include <linux/highmem.h> -#include <linux/gfp.h> #include <linux/radix-tree.h> #include <linux/buffer_head.h> /* invalidate_bh_lrus() */ +#include <linux/slab.h> #include <asm/uaccess.h> diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index b61057e77882..3d6f3d988949 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -26,6 +26,7 @@ #include <linux/vmalloc.h> #include <linux/string.h> #include <linux/drbd.h> +#include <linux/slab.h> #include <asm/kmap_types.h> #include "drbd_int.h" diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index df8ad9660d8f..be3374b68460 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c @@ -28,7 +28,6 @@ #include <asm/uaccess.h> #include <linux/fs.h> #include <linux/file.h> -#include <linux/slab.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/drbd.h> diff --git a/drivers/block/hd.c b/drivers/block/hd.c index 5116c65c07cb..034e6dfc878c 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c @@ -34,7 +34,6 @@ #include <linux/fs.h> #include <linux/kernel.h> #include <linux/genhd.h> -#include <linux/slab.h> #include <linux/string.h> #include <linux/ioport.h> #include <linux/init.h> diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bd112c8c7bcd..cb69929d917a 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -71,7 +71,6 @@ #include <linux/buffer_head.h> /* for invalidate_bdev() */ #include <linux/completion.h> #include <linux/highmem.h> -#include <linux/gfp.h> #include <linux/kthread.h> #include <linux/splice.h> diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 5416c9a606e4..28db925dbdad 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/mg_disk.h> +#include <linux/slab.h> #define MG_RES_SEC (CONFIG_MG_DISK_RES << 1) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cc923a5b430c..218d091f3c52 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -27,6 +27,7 @@ #include <linux/compiler.h> #include <linux/err.h> #include <linux/kernel.h> +#include <linux/slab.h> #include <net/sock.h> #include <linux/net.h> #include <linux/kthread.h> diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c index eb2091aa1c19..6cd8b705b11b 100644 --- a/drivers/block/osdblk.c +++ b/drivers/block/osdblk.c @@ -63,6 +63,7 @@ #include <linux/device.h> #include <linux/module.h> #include <linux/fs.h> +#include <linux/slab.h> #include <scsi/osd_initiator.h> #include <scsi/osd_attributes.h> #include <scsi/osd_sec.h> diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index e712cd51af15..c1e5cd029b23 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -145,6 +145,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV}; #include <linux/init.h> #include <linux/module.h> +#include <linux/gfp.h> #include <linux/fs.h> #include <linux/delay.h> #include <linux/hdreg.h> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 39c8514442eb..ddf19425245d 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -57,6 +57,7 @@ #include <linux/miscdevice.h> #include <linux/freezer.h> #include <linux/mutex.h> +#include <linux/slab.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_ioctl.h> #include <scsi/scsi.h> diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index bc95469d33c1..3b419e3fffa1 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c @@ -20,6 +20,7 @@ #include <linux/ata.h> #include <linux/blkdev.h> +#include <linux/slab.h> #include <asm/lv1call.h> #include <asm/ps3stor.h> diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index e44608229972..b3bdb8af89cf 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -12,6 +12,7 @@ #include <linux/delay.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> +#include <linux/slab.h> #include <asm/cell-regs.h> #include <asm/firmware.h> diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 821c2833f9cf..e463657569ff 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -18,6 +18,7 @@ #include <linux/module.h> #include <linux/fd.h> +#include <linux/slab.h> #include <linux/blkdev.h> #include <linux/hdreg.h> #include <linux/kernel.h> diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 2e889838e819..0536b5b29adc 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c @@ -27,6 +27,7 @@ #include <linux/blkdev.h> #include <linux/timer.h> #include <linux/scatterlist.h> +#include <linux/slab.h> #include <scsi/scsi.h> #define DRV_NAME "ub" diff --git a/drivers/block/umem.c b/drivers/block/umem.c index ad1ba393801a..2f9470ff8f7c 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -40,13 +40,13 @@ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/mman.h> +#include <linux/gfp.h> #include <linux/ioctl.h> #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/timer.h> #include <linux/pci.h> -#include <linux/slab.h> #include <linux/dma-mapping.h> #include <linux/fcntl.h> /* O_ACCMODE */ diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3c64af05fa82..4b12b820c9a6 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -1,5 +1,6 @@ //#define DEBUG #include <linux/spinlock.h> +#include <linux/slab.h> #include <linux/blkdev.h> #include <linux/hdreg.h> #include <linux/virtio.h> diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 1a325fb05c92..18a80ff57ce8 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -49,6 +49,7 @@ #include <linux/blkpg.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/gfp.h> #include <asm/system.h> #include <asm/uaccess.h> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9c09694b2520..82ed403147c0 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -40,6 +40,7 @@ #include <linux/hdreg.h> #include <linux/cdrom.h> #include <linux/module.h> +#include <linux/slab.h> #include <linux/scatterlist.h> #include <xen/xen.h> diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 64f941e0f14b..9114654b54d9 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c @@ -33,6 +33,7 @@ #include <linux/module.h> #include <linux/blkdev.h> #include <linux/bitops.h> +#include <linux/slab.h> #include <asm/setup.h> #include <asm/amigahw.h> |