Commit d5f24b98 authored by Alexander Viro's avatar Alexander Viro Committed by James Bottomley

[PATCH] blk_dev[] is gone

	* remove blk_dev[]
	* removed BLK_DEFAULT_QUEUE
	* moved definition of CURRENT into drivers that used it
	* removed definition of QUEUE from headers
parent 996395f2
...@@ -152,11 +152,6 @@ ...@@ -152,11 +152,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR FLOPPY_MAJOR
#define FLOPPY_DMA 0
#define DEVICE_NAME "floppy"
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#define QUEUE (&floppy_queue)
#include <linux/blk.h> #include <linux/blk.h>
/* Note: FD_MAX_UNITS could be redefined to 2 for the Atari (with /* Note: FD_MAX_UNITS could be redefined to 2 for the Atari (with
...@@ -182,6 +177,12 @@ ...@@ -182,6 +177,12 @@
static struct request_queue floppy_queue; static struct request_queue floppy_queue;
#define MAJOR_NR FLOPPY_MAJOR
#define FLOPPY_DMA 0
#define DEVICE_NAME "floppy"
#define QUEUE (&floppy_queue)
#define CURRENT elv_next_request(&floppy_queue)
/* Disk types: DD */ /* Disk types: DD */
static struct archy_disk_type { static struct archy_disk_type {
const char *name; const char *name;
......
...@@ -111,9 +111,6 @@ ...@@ -111,9 +111,6 @@
#include <linux/major.h> #include <linux/major.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/delay.h> #include <linux/delay.h>
#define MAJOR_NR MFM_ACORN_MAJOR
#define QUEUE (&mfm_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/blkpg.h> #include <linux/blkpg.h>
...@@ -129,6 +126,10 @@ ...@@ -129,6 +126,10 @@
static void (*do_mfm)(void) = NULL; static void (*do_mfm)(void) = NULL;
static struct request_queue mfm_queue; static struct request_queue mfm_queue;
static spinlock_t mfm_lock = SPIN_LOCK_UNLOCKED; static spinlock_t mfm_lock = SPIN_LOCK_UNLOCKED;
#define MAJOR_NR MFM_ACORN_MAJOR
#define QUEUE (&mfm_queue)
#define CURRENT elv_next_request(&mfm_queue)
/* /*
* This sort of stuff should be in a header file shared with ide.c, hd.c, xd.c etc * This sort of stuff should be in a header file shared with ide.c, hd.c, xd.c etc
*/ */
......
...@@ -58,7 +58,6 @@ ...@@ -58,7 +58,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/major.h> #include <linux/major.h>
#define QUEUE (&acsi_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -81,6 +80,8 @@ typedef void Scsi_Device; /* hack to avoid including scsi.h */ ...@@ -81,6 +80,8 @@ typedef void Scsi_Device; /* hack to avoid including scsi.h */
static void (*do_acsi)(void) = NULL; static void (*do_acsi)(void) = NULL;
static struct request_queue acsi_queue; static struct request_queue acsi_queue;
#define QUEUE (&acsi_queue)
#define CURRENT elv_next_request(&acsi_queue)
#define DEBUG #define DEBUG
#undef DEBUG_DETECT #undef DEBUG_DETECT
......
...@@ -78,10 +78,6 @@ ...@@ -78,10 +78,6 @@
#include <asm/amigahw.h> #include <asm/amigahw.h>
#include <asm/amigaints.h> #include <asm/amigaints.h>
#include <asm/irq.h> #include <asm/irq.h>
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&floppy_queue)
#include <linux/blk.h> #include <linux/blk.h>
#undef DEBUG /* print _LOTS_ of infos */ #undef DEBUG /* print _LOTS_ of infos */
...@@ -125,6 +121,11 @@ MODULE_LICENSE("GPL"); ...@@ -125,6 +121,11 @@ MODULE_LICENSE("GPL");
static struct request_queue floppy_queue; static struct request_queue floppy_queue;
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&floppy_queue)
#define CURRENT elv_next_request(&floppy_queue)
/* /*
* Macros * Macros
*/ */
......
...@@ -91,10 +91,6 @@ ...@@ -91,10 +91,6 @@
#include <asm/atariints.h> #include <asm/atariints.h>
#include <asm/atari_stdma.h> #include <asm/atari_stdma.h>
#include <asm/atari_stram.h> #include <asm/atari_stram.h>
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&floppy_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/blkpg.h> #include <linux/blkpg.h>
...@@ -104,6 +100,11 @@ ...@@ -104,6 +100,11 @@
static struct request_queue floppy_queue; static struct request_queue floppy_queue;
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&floppy_queue)
#define CURRENT elv_next_request(&floppy_queue)
/* Disk types: DD, HD, ED */ /* Disk types: DD, HD, ED */
static struct atari_disk_type { static struct atari_disk_type {
const char *name; const char *name;
......
...@@ -39,12 +39,6 @@ static kmem_cache_t *request_cachep; ...@@ -39,12 +39,6 @@ static kmem_cache_t *request_cachep;
static LIST_HEAD(blk_plug_list); static LIST_HEAD(blk_plug_list);
static spinlock_t blk_plug_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED; static spinlock_t blk_plug_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
/* blk_dev_struct is:
* request_queue
* *queue
*/
struct blk_dev_struct blk_dev[MAX_BLKDEV]; /* initialized by blk_dev_init() */
/* /*
* Number of requests per queue. This many for reads and for writes (twice * Number of requests per queue. This many for reads and for writes (twice
* this number, total). * this number, total).
...@@ -138,22 +132,6 @@ void io_schedule_timeout(long timeout) ...@@ -138,22 +132,6 @@ void io_schedule_timeout(long timeout)
atomic_dec(&nr_iowait_tasks); atomic_dec(&nr_iowait_tasks);
} }
/**
* bdev_get_queue: - return the queue that matches the given device
* @bdev: device
*
* Description:
* Given a specific device, return the queue that will hold I/O
* for it. This is either a &struct blk_dev_struct lookup and a
* call to the ->queue() function defined, or the default queue
* stored in the same location.
*
**/
inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{
return bdev->bd_queue;
}
/** /**
* blk_get_backing_dev_info - get the address of a queue's backing_dev_info * blk_get_backing_dev_info - get the address of a queue's backing_dev_info
* @dev: device * @dev: device
...@@ -2186,7 +2164,6 @@ EXPORT_SYMBOL(end_that_request_first); ...@@ -2186,7 +2164,6 @@ EXPORT_SYMBOL(end_that_request_first);
EXPORT_SYMBOL(end_that_request_chunk); EXPORT_SYMBOL(end_that_request_chunk);
EXPORT_SYMBOL(end_that_request_last); EXPORT_SYMBOL(end_that_request_last);
EXPORT_SYMBOL(blk_init_queue); EXPORT_SYMBOL(blk_init_queue);
EXPORT_SYMBOL(bdev_get_queue);
EXPORT_SYMBOL(blk_cleanup_queue); EXPORT_SYMBOL(blk_cleanup_queue);
EXPORT_SYMBOL(blk_queue_make_request); EXPORT_SYMBOL(blk_queue_make_request);
EXPORT_SYMBOL(blk_queue_bounce_limit); EXPORT_SYMBOL(blk_queue_bounce_limit);
......
...@@ -24,12 +24,6 @@ ...@@ -24,12 +24,6 @@
* be sent. * be sent.
*/ */
/* This has to be defined before some of the #includes below */
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&swim_queue)
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -84,6 +78,11 @@ static int floppy_count; ...@@ -84,6 +78,11 @@ static int floppy_count;
static struct floppy_state floppy_states[MAX_FLOPPIES]; static struct floppy_state floppy_states[MAX_FLOPPIES];
static spinlock_t swim_iop_lock = SPIN_LOCK_UNLOCKED; static spinlock_t swim_iop_lock = SPIN_LOCK_UNLOCKED;
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
#define QUEUE (&swim_queue)
#define CURRENT elv_next_request(&swim_queue)
static char *drive_names[7] = { static char *drive_names[7] = {
"not installed", /* DRV_NONE */ "not installed", /* DRV_NONE */
"unknown (1)", /* DRV_UNKNOWN */ "unknown (1)", /* DRV_UNKNOWN */
......
...@@ -166,9 +166,6 @@ ...@@ -166,9 +166,6 @@
*/ */
#include <linux/version.h> #include <linux/version.h>
#define MAJOR_NR AZTECH_CDROM_MAJOR
#define QUEUE (&azt_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include "aztcd.h" #include "aztcd.h"
...@@ -196,6 +193,10 @@ ...@@ -196,6 +193,10 @@
Defines Defines
########################################################################### ###########################################################################
*/ */
#define MAJOR_NR AZTECH_CDROM_MAJOR
#define QUEUE (&azt_queue)
#define CURRENT elv_next_request(&azt_queue)
#define SET_TIMER(func, jifs) delay_timer.expires = jiffies + (jifs); \ #define SET_TIMER(func, jifs) delay_timer.expires = jiffies + (jifs); \
delay_timer.function = (void *) (func); \ delay_timer.function = (void *) (func); \
add_timer(&delay_timer); add_timer(&delay_timer);
......
...@@ -100,9 +100,6 @@ ...@@ -100,9 +100,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR MITSUMI_CDROM_MAJOR
#define QUEUE (&mcd_queue)
#include <linux/blk.h> #include <linux/blk.h>
#define mcd_port mcd /* for compatible parameter passing with "insmod" */ #define mcd_port mcd /* for compatible parameter passing with "insmod" */
...@@ -118,6 +115,10 @@ static int mcd1xhold; ...@@ -118,6 +115,10 @@ static int mcd1xhold;
static int mcdPresent; static int mcdPresent;
static struct request_queue mcd_queue; static struct request_queue mcd_queue;
#define MAJOR_NR MITSUMI_CDROM_MAJOR
#define QUEUE (&mcd_queue)
#define CURRENT elv_next_request(&mcd_queue)
#define QUICK_LOOP_DELAY udelay(45) /* use udelay */ #define QUICK_LOOP_DELAY udelay(45) /* use udelay */
#define QUICK_LOOP_COUNT 20 #define QUICK_LOOP_COUNT 20
......
...@@ -74,9 +74,6 @@ ...@@ -74,9 +74,6 @@
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <asm/io.h> #include <asm/io.h>
#define MAJOR_NR OPTICS_CDROM_MAJOR
#define QUEUE (&opt_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
...@@ -84,6 +81,10 @@ ...@@ -84,6 +81,10 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR OPTICS_CDROM_MAJOR
#define QUEUE (&opt_queue)
#define CURRENT elv_next_request(&opt_queue)
/* Debug support */ /* Debug support */
......
...@@ -75,15 +75,16 @@ ...@@ -75,15 +75,16 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR SANYO_CDROM_MAJOR
#define QUEUE (&sjcd_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include "sjcd.h" #include "sjcd.h"
static int sjcd_present = 0; static int sjcd_present = 0;
static struct request_queue sjcd_queue; static struct request_queue sjcd_queue;
#define MAJOR_NR SANYO_CDROM_MAJOR
#define QUEUE (&sjcd_queue)
#define CURRENT elv_next_request(&sjcd_queue)
#define SJCD_BUF_SIZ 32 /* cdr-h94a has internal 64K buffer */ #define SJCD_BUF_SIZ 32 /* cdr-h94a has internal 64K buffer */
/* /*
......
...@@ -45,9 +45,6 @@ ...@@ -45,9 +45,6 @@
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR HD_MAJOR
#define QUEUE (&hd_queue)
#include <linux/blk.h> #include <linux/blk.h>
#ifdef __arm__ #ifdef __arm__
...@@ -100,6 +97,10 @@ ...@@ -100,6 +97,10 @@
static spinlock_t hd_lock = SPIN_LOCK_UNLOCKED; static spinlock_t hd_lock = SPIN_LOCK_UNLOCKED;
static struct request_queue hd_queue; static struct request_queue hd_queue;
#define MAJOR_NR HD_MAJOR
#define QUEUE (&hd_queue)
#define CURRENT elv_next_request(&hd_queue)
#define TIMEOUT_VALUE (6*HZ) #define TIMEOUT_VALUE (6*HZ)
#define HD_DELAY 0 #define HD_DELAY 0
...@@ -117,8 +118,6 @@ static void bad_rw_intr(void); ...@@ -117,8 +118,6 @@ static void bad_rw_intr(void);
static int reset; static int reset;
static int hd_error; static int hd_error;
#define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0)
/* /*
* This struct defines the HD's and their types. * This struct defines the HD's and their types.
*/ */
......
...@@ -634,17 +634,9 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file * ...@@ -634,17 +634,9 @@ static int do_open(struct block_device *bdev, struct inode *inode, struct file *
} }
} }
if (bdev->bd_contains == bdev) { if (bdev->bd_contains == bdev) {
if (!bdev->bd_openers) if (!bdev->bd_openers) {
bdev->bd_disk = disk; bdev->bd_disk = disk;
if (!bdev->bd_queue) {
if (disk->queue)
bdev->bd_queue = disk->queue; bdev->bd_queue = disk->queue;
else {
struct blk_dev_struct *p = blk_dev + major(dev);
bdev->bd_queue = &p->request_queue;
if (p->queue)
bdev->bd_queue = p->queue(dev);
}
} }
if (bdev->bd_op->open) { if (bdev->bd_op->open) {
ret = bdev->bd_op->open(inode, file); ret = bdev->bd_op->open(inode, file);
......
...@@ -53,19 +53,6 @@ static inline void blkdev_dequeue_request(struct request *req) ...@@ -53,19 +53,6 @@ static inline void blkdev_dequeue_request(struct request *req)
elv_remove_request(req->q, req); elv_remove_request(req->q, req);
} }
#if defined(MAJOR_NR) || defined(IDE_DRIVER)
#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
#if !defined(IDE_DRIVER)
#ifndef QUEUE
# define QUEUE (&blk_dev[MAJOR_NR].request_queue)
#endif
#ifndef CURRENT
# define CURRENT elv_next_request(QUEUE)
#endif
#endif /* !defined(IDE_DRIVER) */
/* /*
* If we have our own end_request, we do not want to include this mess * If we have our own end_request, we do not want to include this mess
*/ */
...@@ -80,7 +67,5 @@ static inline void end_request(struct request *req, int uptodate) ...@@ -80,7 +67,5 @@ static inline void end_request(struct request *req, int uptodate)
end_that_request_last(req); end_that_request_last(req);
} }
#endif /* !LOCAL_END_REQUEST */ #endif /* !LOCAL_END_REQUEST */
#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */
#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
#endif /* _BLK_H */ #endif /* _BLK_H */
...@@ -287,33 +287,13 @@ inline void blk_queue_bounce(request_queue_t *q, struct bio **bio); ...@@ -287,33 +287,13 @@ inline void blk_queue_bounce(request_queue_t *q, struct bio **bio);
if ((rq->bio)) \ if ((rq->bio)) \
for (bio = (rq)->bio; bio; bio = bio->bi_next) for (bio = (rq)->bio; bio; bio = bio->bi_next)
struct blk_dev_struct {
/*
* queue_proc has to be atomic
*/
request_queue_t request_queue;
queue_proc *queue;
void *data;
};
struct sec_size { struct sec_size {
unsigned block_size; unsigned block_size;
unsigned block_size_bits; unsigned block_size_bits;
}; };
/*
* Used to indicate the default queue for drivers that don't bother
* to implement multiple queues. We have this access macro here
* so as to eliminate the need for each and every block device
* driver to know about the internal structure of blk_dev[].
*/
#define BLK_DEFAULT_QUEUE(_MAJOR) &blk_dev[_MAJOR].request_queue
extern struct sec_size * blk_sec[MAX_BLKDEV];
extern struct blk_dev_struct blk_dev[MAX_BLKDEV];
extern void register_disk(struct gendisk *dev); extern void register_disk(struct gendisk *dev);
extern void generic_make_request(struct bio *bio); extern void generic_make_request(struct bio *bio);
extern inline request_queue_t *bdev_get_queue(struct block_device *bdev);
extern void blk_put_request(struct request *); extern void blk_put_request(struct request *);
extern void blk_attempt_remerge(request_queue_t *, struct request *); extern void blk_attempt_remerge(request_queue_t *, struct request *);
extern void __blk_attempt_remerge(request_queue_t *, struct request *); extern void __blk_attempt_remerge(request_queue_t *, struct request *);
...@@ -331,6 +311,11 @@ extern void blk_start_queue(request_queue_t *q); ...@@ -331,6 +311,11 @@ extern void blk_start_queue(request_queue_t *q);
extern void blk_stop_queue(request_queue_t *q); extern void blk_stop_queue(request_queue_t *q);
extern void __blk_stop_queue(request_queue_t *q); extern void __blk_stop_queue(request_queue_t *q);
static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{
return bdev->bd_queue;
}
/* /*
* get ready for proper ref counting * get ready for proper ref counting
*/ */
......
...@@ -341,7 +341,6 @@ EXPORT_SYMBOL(tty_unregister_driver); ...@@ -341,7 +341,6 @@ EXPORT_SYMBOL(tty_unregister_driver);
EXPORT_SYMBOL(tty_std_termios); EXPORT_SYMBOL(tty_std_termios);
/* block device driver support */ /* block device driver support */
EXPORT_SYMBOL(blk_dev);
EXPORT_SYMBOL(bdev_read_only); EXPORT_SYMBOL(bdev_read_only);
EXPORT_SYMBOL(set_device_ro); EXPORT_SYMBOL(set_device_ro);
EXPORT_SYMBOL(bmap); EXPORT_SYMBOL(bmap);
......
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