Commit a28b4d4e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] take bio.h out of highmem.h

highmem.h includes bio.h, so just about every compilation unit in the
kernel gets to process bio.h.

The patch moves the BIO-related functions out of highmem.h and into
bio-related headers.  The nested include is removed and all files which
need to include bio.h now do so.
parent c67b85b0
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/bio.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/genhd.h> #include <linux/genhd.h>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/bio.h>
#include <linux/blkpg.h> #include <linux/blkpg.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/version.h> #include <linux/version.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/bio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/elevator.h> #include <linux/elevator.h>
#include <linux/bio.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
......
...@@ -165,6 +165,7 @@ static int print_unex=1; ...@@ -165,6 +165,7 @@ static int print_unex=1;
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bio.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/bio.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/bio.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/major.h> #include <linux/major.h>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/bio.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/file.h> #include <linux/file.h>
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/atomic.h>
#include <linux/bio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/bio.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/mman.h> #include <linux/mman.h>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/raid/md.h> #include <linux/raid/md.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/bio.h>
#include <linux/raid/linear.h> #include <linux/raid/linear.h>
#define MAJOR_NR MD_MAJOR #define MAJOR_NR MD_MAJOR
......
...@@ -209,6 +209,7 @@ ...@@ -209,6 +209,7 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/bio.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/genhd.h> #include <linux/genhd.h>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/raid/md.h> #include <linux/raid/md.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/bio.h>
#include <linux/raid/xor.h> #include <linux/raid/xor.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/raid/multipath.h> #include <linux/raid/multipath.h>
#include <linux/bio.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <asm/atomic.h> #include <asm/atomic.h>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/raid/raid0.h> #include <linux/raid/raid0.h>
#include <linux/bio.h>
#define MAJOR_NR MD_MAJOR #define MAJOR_NR MD_MAJOR
#define MD_DRIVER #define MD_DRIVER
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include <linux/raid/raid1.h> #include <linux/raid/raid1.h>
#include <linux/bio.h>
#define MAJOR_NR MD_MAJOR #define MAJOR_NR MD_MAJOR
#define MD_DRIVER #define MD_DRIVER
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/raid/raid5.h> #include <linux/raid/raid5.h>
#include <linux/bio.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/atomic.h> #include <asm/atomic.h>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/init.h>
#include <linux/ioport.h> // request_region() prototype #include <linux/ioport.h> // request_region() prototype
#include <linux/vmalloc.h> // ioremap() #include <linux/vmalloc.h> // ioremap()
//#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7) //#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,7)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/bio.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/stat.h> #include <linux/stat.h>
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bio.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bio.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
*/ */
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bio.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/iobuf.h> #include <linux/iobuf.h>
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/buffer_head.h> /* for sync_blockdev() */ #include <linux/buffer_head.h> /* for sync_blockdev() */
#include <linux/bio.h>
#include "jfs_incore.h" #include "jfs_incore.h"
#include "jfs_filsys.h" #include "jfs_filsys.h"
#include "jfs_metapage.h" #include "jfs_metapage.h"
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#define __LINUX_BIO_H #define __LINUX_BIO_H
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/highmem.h>
/* Platforms may set this to teach the BIO layer about IOMMU hardware. */ /* Platforms may set this to teach the BIO layer about IOMMU hardware. */
#include <asm/io.h> #include <asm/io.h>
#ifndef BIO_VMERGE_BOUNDARY #ifndef BIO_VMERGE_BOUNDARY
...@@ -47,9 +49,6 @@ struct bio_vec { ...@@ -47,9 +49,6 @@ struct bio_vec {
unsigned int bv_offset; unsigned int bv_offset;
}; };
/*
* weee, c forward decl...
*/
struct bio; struct bio;
typedef void (bio_end_io_t) (struct bio *); typedef void (bio_end_io_t) (struct bio *);
typedef void (bio_destructor_t) (struct bio *); typedef void (bio_destructor_t) (struct bio *);
...@@ -206,4 +205,49 @@ extern inline void bio_init(struct bio *); ...@@ -206,4 +205,49 @@ extern inline void bio_init(struct bio *);
extern int bio_ioctl(kdev_t, unsigned int, unsigned long); extern int bio_ioctl(kdev_t, unsigned int, unsigned long);
#ifdef CONFIG_HIGHMEM
/*
* remember to add offset! and never ever reenable interrupts between a
* bio_kmap_irq and bio_kunmap_irq!!
*
* This function MUST be inlined - it plays with the CPU interrupt flags.
* Hence the `extern inline'.
*/
extern inline char *bio_kmap_irq(struct bio *bio, unsigned long *flags)
{
unsigned long addr;
__save_flags(*flags);
/*
* could be low
*/
if (!PageHighMem(bio_page(bio)))
return bio_data(bio);
/*
* it's a highmem page
*/
__cli();
addr = (unsigned long) kmap_atomic(bio_page(bio), KM_BIO_SRC_IRQ);
if (addr & ~PAGE_MASK)
BUG();
return (char *) addr + bio_offset(bio);
}
extern inline void bio_kunmap_irq(char *buffer, unsigned long *flags)
{
unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ);
__restore_flags(*flags);
}
#else
#define bio_kmap_irq(bio, flags) (bio_data(bio))
#define bio_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
#endif
#endif /* __LINUX_BIO_H */ #endif /* __LINUX_BIO_H */
...@@ -246,12 +246,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn; ...@@ -246,12 +246,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) #define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD)
extern int init_emergency_isa_pool(void); extern int init_emergency_isa_pool(void);
extern void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig); void blk_queue_bounce(request_queue_t *q, struct bio **bio);
extern inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
{
create_bounce(q->bounce_pfn, q->bounce_gfp, bio);
}
#define rq_for_each_bio(bio, rq) \ #define rq_for_each_bio(bio, rq) \
if ((rq->bio)) \ if ((rq->bio)) \
......
...@@ -108,12 +108,7 @@ BUFFER_FNS(Async_Read, async_read) ...@@ -108,12 +108,7 @@ BUFFER_FNS(Async_Read, async_read)
BUFFER_FNS(Async_Write, async_write) BUFFER_FNS(Async_Write, async_write)
BUFFER_FNS(Boundary, boundary) BUFFER_FNS(Boundary, boundary)
/*
* FIXME: this is used only by bh_kmap, which is used only by RAID5.
* Move all that stuff into raid5.c
*/
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
#define touch_buffer(bh) mark_page_accessed(bh->b_page) #define touch_buffer(bh) mark_page_accessed(bh->b_page)
/* If we *know* page->private refers to buffer_heads */ /* If we *know* page->private refers to buffer_heads */
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define _LINUX_HIGHMEM_H #define _LINUX_HIGHMEM_H
#include <linux/config.h> #include <linux/config.h>
#include <linux/bio.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
...@@ -15,45 +14,8 @@ extern struct page *highmem_start_page; ...@@ -15,45 +14,8 @@ extern struct page *highmem_start_page;
/* declarations for linux/mm/highmem.c */ /* declarations for linux/mm/highmem.c */
unsigned int nr_free_highpages(void); unsigned int nr_free_highpages(void);
extern void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig);
extern void check_highmem_ptes(void); extern void check_highmem_ptes(void);
/*
* remember to add offset! and never ever reenable interrupts between a
* bio_kmap_irq and bio_kunmap_irq!!
*/
static inline char *bio_kmap_irq(struct bio *bio, unsigned long *flags)
{
unsigned long addr;
__save_flags(*flags);
/*
* could be low
*/
if (!PageHighMem(bio_page(bio)))
return bio_data(bio);
/*
* it's a highmem page
*/
__cli();
addr = (unsigned long) kmap_atomic(bio_page(bio), KM_BIO_SRC_IRQ);
if (addr & ~PAGE_MASK)
BUG();
return (char *) addr + bio_offset(bio);
}
static inline void bio_kunmap_irq(char *buffer, unsigned long *flags)
{
unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ);
__restore_flags(*flags);
}
#else /* CONFIG_HIGHMEM */ #else /* CONFIG_HIGHMEM */
static inline unsigned int nr_free_highpages(void) { return 0; } static inline unsigned int nr_free_highpages(void) { return 0; }
...@@ -65,12 +27,6 @@ static inline void *kmap(struct page *page) { return page_address(page); } ...@@ -65,12 +27,6 @@ static inline void *kmap(struct page *page) { return page_address(page); }
#define kmap_atomic(page,idx) kmap(page) #define kmap_atomic(page,idx) kmap(page)
#define kunmap_atomic(page,idx) kunmap(page) #define kunmap_atomic(page,idx) kunmap(page)
#define bh_kmap(bh) ((bh)->b_data)
#define bh_kunmap(bh) do { } while (0)
#define bio_kmap_irq(bio, flags) (bio_data(bio))
#define bio_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
#endif /* CONFIG_HIGHMEM */ #endif /* CONFIG_HIGHMEM */
/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ /* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/bio.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/hdreg.h> #include <asm/hdreg.h>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/raid/md.h> #include <linux/raid/md.h>
#include <linux/raid/xor.h> #include <linux/raid/xor.h>
#include <linux/bio.h>
/* /*
* *
......
...@@ -120,7 +120,7 @@ EXPORT_SYMBOL(vmtruncate); ...@@ -120,7 +120,7 @@ EXPORT_SYMBOL(vmtruncate);
EXPORT_SYMBOL(find_vma); EXPORT_SYMBOL(find_vma);
EXPORT_SYMBOL(get_unmapped_area); EXPORT_SYMBOL(get_unmapped_area);
EXPORT_SYMBOL(init_mm); EXPORT_SYMBOL(init_mm);
EXPORT_SYMBOL(create_bounce); EXPORT_SYMBOL(blk_queue_bounce);
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
EXPORT_SYMBOL(kmap_high); EXPORT_SYMBOL(kmap_high);
EXPORT_SYMBOL(kunmap_high); EXPORT_SYMBOL(kunmap_high);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bio.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/mempool.h> #include <linux/mempool.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
...@@ -347,13 +348,15 @@ static void bounce_end_io_read_isa(struct bio *bio) ...@@ -347,13 +348,15 @@ static void bounce_end_io_read_isa(struct bio *bio)
return __bounce_end_io_read(bio, isa_page_pool); return __bounce_end_io_read(bio, isa_page_pool);
} }
void create_bounce(unsigned long pfn, int gfp, struct bio **bio_orig) void blk_queue_bounce(request_queue_t *q, struct bio **bio_orig)
{ {
struct page *page; struct page *page;
struct bio *bio = NULL; struct bio *bio = NULL;
int i, rw = bio_data_dir(*bio_orig), bio_gfp; int i, rw = bio_data_dir(*bio_orig), bio_gfp;
struct bio_vec *to, *from; struct bio_vec *to, *from;
mempool_t *pool; mempool_t *pool;
unsigned long pfn = q->bounce_pfn;
int gfp = q->bounce_gfp;
BUG_ON((*bio_orig)->bi_idx); BUG_ON((*bio_orig)->bi_idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment