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 | op-kernel-dev-5a0e3ad6af8660be21ca98a971cd00f331318c05.zip op-kernel-dev-5a0e3ad6af8660be21ca98a971cd00f331318c05.tar.gz |
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 0552258..0182a22 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 3af97d4..035cefe 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 62141ec..4a1b9e74 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 64a223b..5674bd0 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 fa67027..0849280 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 ce0d62c..4d3bc0d 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 c6ddeac..6081e81 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 b61057e..3d6f3d9 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 df8ad96..be3374b 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 5116c65..034e6df 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 bd112c8..cb69929 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 5416c9a..28db925 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 cc923a5..218d091 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 eb2091a..6cd8b70 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 e712cd5..c1e5cd0 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 39c8514..ddf1942 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 bc95469..3b419e3 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 e446082..b3bdb8a 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 821c283..e463657 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 2e88983..0536b5b 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 ad1ba39..2f9470f 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 3c64af0..4b12b82 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 1a325fb..18a80ff 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 9c09694..82ed403 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 64f941e..9114654 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> |