diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-15 03:32:22 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-15 03:32:22 +0000 |
commit | f1da2c3860e301527d56a1ef0b56c649ee7c4b1b (patch) | |
tree | 562b5d2e8b9cb62eb983d78ff6bcf9789e08fcf6 /drivers/block | |
parent | 00f11569ac8ca73cbcdef8822de1583e79aee571 (diff) |
Merge with Linux 2.4.0-test5-pre1. This works again on Origin UP.
The IP22 cache bugs which are plaguing some machines are still unfixed.
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/acsi_slm.c | 5 | ||||
-rw-r--r-- | drivers/block/ll_rw_blk.c | 84 | ||||
-rw-r--r-- | drivers/block/lvm.c | 9 | ||||
-rw-r--r-- | drivers/block/md.c | 4 | ||||
-rw-r--r-- | drivers/block/paride/paride.c | 27 | ||||
-rw-r--r-- | drivers/block/paride/pg.c | 3 | ||||
-rw-r--r-- | drivers/block/paride/pt.c | 3 | ||||
-rw-r--r-- | drivers/block/ps2esdi.c | 12 | ||||
-rw-r--r-- | drivers/block/rd.c | 14 |
9 files changed, 81 insertions, 80 deletions
diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c index 785a0e551..b8f1c693e 100644 --- a/drivers/block/acsi_slm.c +++ b/drivers/block/acsi_slm.c @@ -66,6 +66,7 @@ not be guaranteed. There are several ways to assure this: #include <linux/mm.h> #include <linux/malloc.h> #include <linux/devfs_fs_kernel.h> +#include <linux/smp_lock.h> #include <asm/pgtable.h> #include <asm/system.h> @@ -269,7 +270,7 @@ static int slm_get_pagesize( int device, int *w, int *h ); /************************* End of Prototypes **************************/ -static struct timer_list slm_timer = { NULL, NULL, 0, 0, slm_test_ready }; +static struct timer_list slm_timer = { function: slm_test_ready }; static struct file_operations slm_fops = { owner: THIS_MODULE, @@ -799,10 +800,12 @@ static int slm_release( struct inode *inode, struct file *file ) device = MINOR(inode->i_rdev); sip = &slm_info[device]; + lock_kernel(); if (file->f_mode & 2) sip->wbusy = 0; if (file->f_mode & 1) sip->rbusy = 0; + unlock_kernel(); return( 0 ); } diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 37e50dbcd..6e094e4d8 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -578,7 +578,6 @@ static inline void attempt_front_merge(request_queue_t * q, static inline void __make_request(request_queue_t * q, int rw, struct buffer_head * bh) { - int major = MAJOR(bh->b_rdev); unsigned int sector, count; int max_segments = MAX_SEGMENTS; struct request * req = NULL; @@ -590,26 +589,6 @@ static inline void __make_request(request_queue_t * q, int rw, count = bh->b_size >> 9; sector = bh->b_rsector; - if (blk_size[major]) { - unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1; - - if (maxsector < count || maxsector - count < sector) { - bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped); - if (!blk_size[major][MINOR(bh->b_rdev)]) - goto end_io; - /* This may well happen - the kernel calls bread() - without checking the size of the device, e.g., - when mounting a device. */ - printk(KERN_INFO - "attempt to access beyond end of device\n"); - printk(KERN_INFO "%s: rw=%d, want=%d, limit=%d\n", - kdevname(bh->b_rdev), rw, - (sector + count)>>1, - blk_size[major][MINOR(bh->b_rdev)]); - goto end_io; - } - } - rw_ahead = 0; /* normal case; gets changed below for READA */ switch (rw) { case READA: @@ -758,9 +737,35 @@ end_io: bh->b_end_io(bh, test_bit(BH_Uptodate, &bh->b_state)); } -int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh) +void generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh) { - int ret; + int major = MAJOR(bh->b_rdev); + + if (blk_size[major]) { + unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1; + unsigned int sector, count; + + count = bh->b_size >> 9; + sector = bh->b_rsector; + + if (maxsector < count || maxsector - count < sector) { + bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped); + if (blk_size[major][MINOR(bh->b_rdev)]) { + + /* This may well happen - the kernel calls bread() + without checking the size of the device, e.g., + when mounting a device. */ + printk(KERN_INFO + "attempt to access beyond end of device\n"); + printk(KERN_INFO "%s: rw=%d, want=%d, limit=%d\n", + kdevname(bh->b_rdev), rw, + (sector + count)>>1, + blk_size[major][MINOR(bh->b_rdev)]); + } + bh->b_end_io(bh, 0); + return; + } + } /* * Resolve the mapping until finished. (drivers are @@ -768,12 +773,9 @@ int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh) * by explicitly returning 0) */ while (q->make_request_fn) { - ret = q->make_request_fn(q, rw, bh); - if (ret > 0) { - q = blk_get_queue(bh->b_rdev); - continue; - } - return ret; + if (q->make_request_fn(q, rw, bh) == 0) + return; + q = blk_get_queue(bh->b_rdev); } /* * Does the block device want us to queue @@ -784,16 +786,13 @@ int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh) if (q && !q->plugged) (q->request_fn)(q); spin_unlock_irq(&io_request_lock); - - return 0; } /* This function can be used to request a number of buffers from a block device. Currently the only restriction is that all buffers must belong to the same device */ -static void __ll_rw_block(int rw, int nr, struct buffer_head * bhs[], - int haslock) +void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]) { struct buffer_head *bh; request_queue_t *q; @@ -840,13 +839,9 @@ static void __ll_rw_block(int rw, int nr, struct buffer_head * bhs[], bh = bhs[i]; /* Only one thread can actually submit the I/O. */ - if (haslock) { - if (!buffer_locked(bh)) - BUG(); - } else { - if (test_and_set_bit(BH_Lock, &bh->b_state)) - continue; - } + if (test_and_set_bit(BH_Lock, &bh->b_state)) + continue; + set_bit(BH_Req, &bh->b_state); /* @@ -865,15 +860,6 @@ sorry: buffer_IO_error(bhs[i]); } -void ll_rw_block(int rw, int nr, struct buffer_head * bh[]) -{ - __ll_rw_block(rw, nr, bh, 0); -} - -void ll_rw_block_locked(int rw, int nr, struct buffer_head * bh[]) -{ - __ll_rw_block(rw, nr, bh, 1); -} #ifdef CONFIG_STRAM_SWAP extern int stram_device_init (void); diff --git a/drivers/block/lvm.c b/drivers/block/lvm.c index 1e2a21cf1..d8cf20d79 100644 --- a/drivers/block/lvm.c +++ b/drivers/block/lvm.c @@ -301,6 +301,7 @@ static spinlock_t lvm_lock = SPIN_LOCK_UNLOCKED; static struct file_operations lvm_chr_fops = { + owner: THIS_MODULE, open: lvm_chr_open, release: lvm_chr_close, ioctl: lvm_chr_ioctl, @@ -517,8 +518,6 @@ static int lvm_chr_open(struct inode *inode, /* Group special file open */ if (VG_CHR(minor) > MAX_VG) return -ENXIO; - MOD_INC_USE_COUNT; - lvm_chr_open_count++; return 0; } /* lvm_chr_open() */ @@ -743,6 +742,7 @@ static int lvm_chr_close(struct inode *inode, struct file *file) "%s -- lvm_chr_close VG#: %d\n", lvm_name, VG_CHR(minor)); #endif + lock_kernel(); #ifdef LVM_TOTAL_RESET if (lvm_reset_spindown > 0) { lvm_reset_spindown = 0; @@ -755,10 +755,7 @@ static int lvm_chr_close(struct inode *inode, struct file *file) lock = 0; /* release lock */ wake_up_interruptible(&lvm_wait); } - -#ifdef MODULE - if (GET_USE_COUNT(&__this_module) > 0) MOD_DEC_USE_COUNT; -#endif + unlock_kernel(); return 0; } /* lvm_chr_close() */ diff --git a/drivers/block/md.c b/drivers/block/md.c index 651c3dd6d..087b5aee1 100644 --- a/drivers/block/md.c +++ b/drivers/block/md.c @@ -3412,7 +3412,7 @@ repeat: currspeed = (j-mddev->resync_mark_cnt)/((jiffies-mddev->resync_mark)/HZ +1) +1; if (currspeed > sysctl_speed_limit_min) { - current->priority = 19; + current->nice = 19; if ((currspeed > sysctl_speed_limit_max) || !is_mddev_idle(mddev)) { @@ -3422,7 +3422,7 @@ repeat: goto repeat; } } else - current->priority = -20; + current->nice = -20; } fsync_dev(read_disk); printk(KERN_INFO "md: md%d: sync done.\n",mdidx(mddev)); diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c index 2315e1d30..b36fdab11 100644 --- a/drivers/block/paride/paride.c +++ b/drivers/block/paride/paride.c @@ -13,10 +13,11 @@ 1.02 GRG 1998.05.05 init_proto, release_proto, ktti 1.03 GRG 1998.08.15 eliminate compiler warning 1.04 GRG 1998.11.28 added support for FRIQ - + 1.05 TMW 2000.06.06 use parport_find_number instead of + parport_enumerate */ -#define PI_VERSION "1.04" +#define PI_VERSION "1.05" #include <linux/module.h> #include <linux/config.h> @@ -238,22 +239,25 @@ static void pi_register_parport( PIA *pi, int verbose) { #ifdef CONFIG_PARPORT - struct parport *pp; - - pp = parport_enumerate(); + struct parport *port; - while((pp)&&(pp->base != pi->port)) pp = pp->next; + port = parport_find_base (pi->port); + if (!port) return; - if (!pp) return; + pi->pardev = parport_register_device(port, + pi->device,NULL, + pi_wake_up,NULL, + 0,(void *)pi); + parport_put_port (port); + if (!pi->pardev) return; - pi->pardev = (void *) parport_register_device( - pp,pi->device,NULL,pi_wake_up,NULL,0,(void *)pi); init_waitqueue_head(&pi->parq); - if (verbose) printk("%s: 0x%x is %s\n",pi->device,pi->port,pp->name); + if (verbose) printk("%s: 0x%x is %s\n",pi->device,pi->port, + port->name); - pi->parname = (char *)pp->name; + pi->parname = (char *)port->name; #endif } @@ -406,6 +410,7 @@ int init_module(void) { int k; for (k=0;k<MAX_PROTOS;k++) protocols[k] = 0; + printk("paride: version %s installed\n",PI_VERSION); return 0; } diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index c282d82a1..e2709ce97 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -171,6 +171,7 @@ static int pg_drive_count; #include <linux/mtio.h> #include <linux/pg.h> #include <linux/wait.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> @@ -604,10 +605,12 @@ static int pg_release (struct inode *inode, struct file *file) if ((unit >= PG_UNITS) || (PG.access <= 0)) return -EINVAL; + lock_kernel(); PG.access--; kfree(PG.bufptr); PG.bufptr = NULL; + unlock_kernel(); return 0; diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 0d3e81838..5cb91ae0a 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -149,6 +149,7 @@ static int pt_drive_count; #include <linux/malloc.h> #include <linux/mtio.h> #include <linux/wait.h> +#include <linux/smp_lock.h> #include <asm/uaccess.h> @@ -773,6 +774,7 @@ static int pt_release (struct inode *inode, struct file *file) if ((unit >= PT_UNITS) || (PT.access <= 0)) return -EINVAL; + lock_kernel(); if (PT.flags & PT_WRITING) pt_write_fm(unit); if (PT.flags & PT_REWIND) pt_rewind(unit); @@ -781,6 +783,7 @@ static int pt_release (struct inode *inode, struct file *file) kfree(PT.bufptr); PT.bufptr = NULL; + unlock_kernel(); return 0; diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c index 61cb27ec7..8ff56a70a 100644 --- a/drivers/block/ps2esdi.c +++ b/drivers/block/ps2esdi.c @@ -114,14 +114,14 @@ static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int); static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_wait_open); int no_int_yet; -static int access_count[MAX_HD] = {0,}; -static char ps2esdi_valid[MAX_HD] = {0,}; -static int ps2esdi_sizes[MAX_HD << 6] = {0,}; -static int ps2esdi_blocksizes[MAX_HD << 6] = {0,}; -static int ps2esdi_drives = 0; +static int access_count[MAX_HD]; +static char ps2esdi_valid[MAX_HD]; +static int ps2esdi_sizes[MAX_HD << 6]; +static int ps2esdi_blocksizes[MAX_HD << 6]; +static int ps2esdi_drives; static struct hd_struct ps2esdi[MAX_HD << 6]; static u_short io_base; -static struct timer_list esdi_timer = {{NULL, NULL}, 0, 0L, ps2esdi_reset_timer}; +static struct timer_list esdi_timer = { function: ps2esdi_reset_timer }; static int reset_status; static int ps2esdi_slot = -1; int tp720esdi = 0; /* Is it Integrated ESDI of ThinkPad-720? */ diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 727c1c543..2db08531a 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -59,6 +59,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/devfs_fs_kernel.h> +#include <linux/smp_lock.h> #include <asm/system.h> #include <asm/uaccess.h> @@ -298,11 +299,14 @@ static int initrd_release(struct inode *inode,struct file *file) { extern void free_initrd_mem(unsigned long, unsigned long); - if (--initrd_users) return 0; - blkdev_put(inode->i_bdev, BDEV_FILE); - iput(inode); - free_initrd_mem(initrd_start, initrd_end); - initrd_start = 0; + lock_kernel(); + if (!--initrd_users) { + blkdev_put(inode->i_bdev, BDEV_FILE); + iput(inode); + free_initrd_mem(initrd_start, initrd_end); + initrd_start = 0; + } + unlock_kernel(); return 0; } |