diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-11-28 03:58:46 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-11-28 03:58:46 +0000 |
commit | b63ad0882a16a5d28003e57f2b0b81dee3fb322b (patch) | |
tree | 0a343ce219e2b8b38a5d702d66032c57b83d9720 /drivers/block | |
parent | a9d7bff9a84dba79609a0002e5321b74c4d64c64 (diff) |
Merge with 2.4.0-test11.
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cpqarray.c | 8 | ||||
-rw-r--r-- | drivers/block/ll_rw_blk.c | 51 | ||||
-rw-r--r-- | drivers/block/loop.c | 6 | ||||
-rw-r--r-- | drivers/block/rd.c | 64 |
4 files changed, 64 insertions, 65 deletions
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 0bfa895b7..afbf60ddc 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -44,8 +44,8 @@ #define SMART2_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) -#define DRIVER_NAME "Compaq SMART2 Driver (v 2.4.0)" -#define DRIVER_VERSION SMART2_DRIVER_VERSION(2,4,0) +#define DRIVER_NAME "Compaq SMART2 Driver (v 2.4.1)" +#define DRIVER_VERSION SMART2_DRIVER_VERSION(2,4,1) /* Embedded module documentation macros - see modules.h */ /* Original author Chris Frantz - Compaq Computer Corporation */ @@ -1664,6 +1664,7 @@ static void getgeometry(int ctlr) int ret_code, size; drv_info_t *drv; ctlr_info_t *info_p = hba[ctlr]; + int i; info_p->log_drv_map = 0; @@ -1729,7 +1730,8 @@ static void getgeometry(int ctlr) } info_p->log_drives = id_ctlr_buf->nr_drvs;; - *(__u32*)(info_p->firm_rev) = *(__u32*)(id_ctlr_buf->firm_rev); + for(i=0;i<4;i++) + info_p->firm_rev[i] = id_ctlr_buf->firm_rev[i]; info_p->ctlr_sig = id_ctlr_buf->cfg_sig; printk(" (%s)\n", info_p->product_name); diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index d9d3f8622..ad370bcb7 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -347,10 +347,9 @@ static void generic_plug_device(request_queue_t *q, kdev_t dev) */ static inline void __generic_unplug_device(request_queue_t *q) { - if (q->plugged) { + if (!list_empty(&q->queue_head)) { q->plugged = 0; - if (!list_empty(&q->queue_head)) - q->request_fn(q); + q->request_fn(q); } } @@ -496,7 +495,7 @@ static struct request *__get_request_wait(request_queue_t *q, int rw) add_wait_queue_exclusive(&q->wait_for_request, &wait); for (;;) { - __set_current_state(TASK_UNINTERRUPTIBLE | TASK_EXCLUSIVE); + __set_current_state(TASK_UNINTERRUPTIBLE); spin_lock_irq(&io_request_lock); rq = get_request(q, rw); spin_unlock_irq(&io_request_lock); @@ -683,7 +682,7 @@ static int __make_request(request_queue_t * q, int rw, { unsigned int sector, count; int max_segments = MAX_SEGMENTS; - struct request * req = NULL; + struct request * req = NULL, *freereq = NULL; int rw_ahead, max_sectors, el_ret; struct list_head *head = &q->queue_head; int latency; @@ -733,6 +732,7 @@ static int __make_request(request_queue_t * q, int rw, * Now we acquire the request spinlock, we have to be mega careful * not to schedule or do something nonatomic */ +again: spin_lock_irq(&io_request_lock); /* @@ -791,19 +791,16 @@ static int __make_request(request_queue_t * q, int rw, * are not crucial. */ get_rq: - if ((req = get_request(q, rw)) == NULL) { + if (freereq) { + req = freereq; + freereq = NULL; + } else if ((req = get_request(q, rw)) == NULL) { spin_unlock_irq(&io_request_lock); if (rw_ahead) goto end_io; - req = __get_request_wait(q, rw); - spin_lock_irq(&io_request_lock); - - if (q->head_active) { - head = &q->queue_head; - if (!q->plugged) - head = head->next; - } + freereq = __get_request_wait(q, rw); + goto again; } /* fill up the request-info, and add it to the queue */ @@ -824,6 +821,8 @@ get_rq: out: if (!q->plugged) (q->request_fn)(q); + if (freereq) + blkdev_release_request(freereq); spin_unlock_irq(&io_request_lock); return 0; end_io: @@ -1059,7 +1058,7 @@ int __init blk_dev_init(void) #endif #ifdef CONFIG_ISP16_CDI isp16_init(); -#endif CONFIG_ISP16_CDI +#endif #if defined(CONFIG_IDE) && defined(CONFIG_BLK_DEV_IDE) ide_init(); /* this MUST precede hd_init */ #endif @@ -1099,37 +1098,37 @@ int __init blk_dev_init(void) #endif #ifdef CONFIG_CDU31A cdu31a_init(); -#endif CONFIG_CDU31A +#endif #ifdef CONFIG_ATARI_ACSI acsi_init(); -#endif CONFIG_ATARI_ACSI +#endif #ifdef CONFIG_MCD mcd_init(); -#endif CONFIG_MCD +#endif #ifdef CONFIG_MCDX mcdx_init(); -#endif CONFIG_MCDX +#endif #ifdef CONFIG_SBPCD sbpcd_init(); -#endif CONFIG_SBPCD +#endif #ifdef CONFIG_AZTCD aztcd_init(); -#endif CONFIG_AZTCD +#endif #ifdef CONFIG_CDU535 sony535_init(); -#endif CONFIG_CDU535 +#endif #ifdef CONFIG_GSCD gscd_init(); -#endif CONFIG_GSCD +#endif #ifdef CONFIG_CM206 cm206_init(); #endif #ifdef CONFIG_OPTCD optcd_init(); -#endif CONFIG_OPTCD +#endif #ifdef CONFIG_SJCD sjcd_init(); -#endif CONFIG_SJCD +#endif #ifdef CONFIG_APBLOCK ap_init(); #endif @@ -1150,7 +1149,7 @@ int __init blk_dev_init(void) #endif #ifdef CONFIG_BLK_DEV_LVM lvm_init(); -#endif +#endif return 0; }; diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 329d10c9c..dc5ecd151 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -235,7 +235,7 @@ static int lo_read_actor(read_descriptor_t * desc, struct page *page, unsigned l if (size > count) size = count; - kaddr = (char*)kmap(page); + kaddr = kmap(page); if ((lo->transfer)(lo,READ,kaddr+offset,p->data,size,IV)) { size = 0; printk(KERN_ERR "loop: transfer error block %ld\n", @@ -411,10 +411,6 @@ static int loop_set_fd(struct loop_device *lo, kdev_t dev, unsigned int arg) error = -EINVAL; inode = file->f_dentry->d_inode; - if (!inode) { - printk(KERN_ERR "loop_set_fd: NULL inode?!?\n"); - goto out_putf; - } if (S_ISBLK(inode->i_mode)) { /* dentry will be wired, so... */ diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 6f583c3de..1799ccef5 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -100,7 +100,7 @@ static int rd_hardsec[NUM_RAMDISKS]; /* Size of real blocks in bytes */ static int rd_blocksizes[NUM_RAMDISKS]; /* Size of 1024 byte blocks :) */ static int rd_kbsize[NUM_RAMDISKS]; /* Size in blocks of 1024 bytes */ static devfs_handle_t devfs_handle; -static struct inode *rd_inode[NUM_RAMDISKS]; /* Protected device inodes */ +static struct inode *rd_inode[NUM_RAMDISKS]; /* Protected device inodes */ /* * Parameters for the boot-loading of the RAM disk. These are set by @@ -108,7 +108,7 @@ static struct inode *rd_inode[NUM_RAMDISKS]; /* Protected device inodes */ * architecture-specific setup routine (from the stored boot sector * information). */ -int rd_size = 4096; /* Size of the RAM disks */ +int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */ /* * It would be very desiderable to have a soft-blocksize (that in the case * of the ramdisk driver is also the hardblocksize ;) of PAGE_SIZE because @@ -120,7 +120,7 @@ int rd_size = 4096; /* Size of the RAM disks */ * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that * supposes the filesystem in the image uses a BLOCK_SIZE blocksize). */ -int rd_blocksize = BLOCK_SIZE; /* Size of the RAM disks */ +int rd_blocksize = BLOCK_SIZE; /* blocksize of the RAM disks */ #ifndef MODULE @@ -194,50 +194,53 @@ __setup("ramdisk_blocksize=", ramdisk_blocksize); * 19-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Added devfs support * */ -static void rd_request(request_queue_t * q) +static int rd_make_request(request_queue_t * q, int rw, struct buffer_head *sbh) { unsigned int minor; unsigned long offset, len; struct buffer_head *rbh; - struct buffer_head *sbh; + char *bdata; -repeat: - INIT_REQUEST; - minor = MINOR(CURRENT->rq_dev); + minor = MINOR(sbh->b_rdev); + + if (minor >= NUM_RAMDISKS) + goto fail; - if (minor >= NUM_RAMDISKS) { - end_request(0); - goto repeat; - } - offset = CURRENT->sector << 9; - len = CURRENT->current_nr_sectors << 9; + offset = sbh->b_rsector << 9; + len = sbh->b_size; - if ((offset + len) > rd_length[minor]) { - end_request(0); - goto repeat; - } + if ((offset + len) > rd_length[minor]) + goto fail; - if ((CURRENT->cmd != READ) && (CURRENT->cmd != WRITE)) { - printk(KERN_INFO "RAMDISK: bad command: %d\n", CURRENT->cmd); - end_request(0); - goto repeat; + if (rw==READA) + rw=READ; + if ((rw != READ) && (rw != WRITE)) { + printk(KERN_INFO "RAMDISK: bad command: %d\n", rw); + goto fail; } - sbh = CURRENT->bh; - rbh = getblk(sbh->b_dev, sbh->b_blocknr, sbh->b_size); - if (CURRENT->cmd == READ) { + rbh = getblk(sbh->b_rdev, sbh->b_rsector/(sbh->b_size>>9), sbh->b_size); + /* I think that it is safe to assume that rbh is not in HighMem, though + * sbh might be - NeilBrown + */ + bdata = bh_kmap(sbh); + if (rw == READ) { if (sbh != rbh) - memcpy(CURRENT->buffer, rbh->b_data, rbh->b_size); + memcpy(bdata, rbh->b_data, rbh->b_size); } else if (sbh != rbh) - memcpy(rbh->b_data, CURRENT->buffer, rbh->b_size); + memcpy(rbh->b_data, bdata, rbh->b_size); + bh_kunmap(sbh); mark_buffer_protected(rbh); brelse(rbh); - end_request(1); - goto repeat; + sbh->b_end_io(sbh,1); + return 0; + fail: + sbh->b_end_io(sbh,0); + return 0; } static int rd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -378,7 +381,6 @@ static void __exit rd_cleanup (void) devfs_unregister (devfs_handle); unregister_blkdev( MAJOR_NR, "ramdisk" ); - blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR)); hardsect_size[MAJOR_NR] = NULL; blksize_size[MAJOR_NR] = NULL; blk_size[MAJOR_NR] = NULL; @@ -403,7 +405,7 @@ int __init rd_init (void) return -EIO; } - blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), &rd_request); + blk_queue_make_request(BLK_DEFAULT_QUEUE(MAJOR_NR), &rd_make_request); for (i = 0; i < NUM_RAMDISKS; i++) { /* rd_size is given in kB */ |