diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/scsi/osst.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/scsi/osst.c')
-rw-r--r-- | drivers/scsi/osst.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 278b352ae78d..de0b1a704fb5 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -51,7 +51,7 @@ static const char * osst_version = "0.99.4"; | |||
51 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/jiffies.h> | 53 | #include <linux/jiffies.h> |
54 | #include <linux/smp_lock.h> | 54 | #include <linux/mutex.h> |
55 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
56 | #include <asm/dma.h> | 56 | #include <asm/dma.h> |
57 | #include <asm/system.h> | 57 | #include <asm/system.h> |
@@ -80,6 +80,7 @@ static const char * osst_version = "0.99.4"; | |||
80 | #include "osst_options.h" | 80 | #include "osst_options.h" |
81 | #include "osst_detect.h" | 81 | #include "osst_detect.h" |
82 | 82 | ||
83 | static DEFINE_MUTEX(osst_int_mutex); | ||
83 | static int max_dev = 0; | 84 | static int max_dev = 0; |
84 | static int write_threshold_kbs = 0; | 85 | static int write_threshold_kbs = 0; |
85 | static int max_sg_segs = 0; | 86 | static int max_sg_segs = 0; |
@@ -1365,7 +1366,7 @@ error: | |||
1365 | /* The values below are based on the OnStream frame payload size of 32K == 2**15, | 1366 | /* The values below are based on the OnStream frame payload size of 32K == 2**15, |
1366 | * that is, OSST_FRAME_SHIFT + OSST_SECTOR_SHIFT must be 15. With a minimum block | 1367 | * that is, OSST_FRAME_SHIFT + OSST_SECTOR_SHIFT must be 15. With a minimum block |
1367 | * size of 512 bytes, we need to be able to resolve 32K/512 == 64 == 2**6 positions | 1368 | * size of 512 bytes, we need to be able to resolve 32K/512 == 64 == 2**6 positions |
1368 | * inside each frame. Finaly, OSST_SECTOR_MASK == 2**OSST_FRAME_SHIFT - 1. | 1369 | * inside each frame. Finally, OSST_SECTOR_MASK == 2**OSST_FRAME_SHIFT - 1. |
1369 | */ | 1370 | */ |
1370 | #define OSST_FRAME_SHIFT 6 | 1371 | #define OSST_FRAME_SHIFT 6 |
1371 | #define OSST_SECTOR_SHIFT 9 | 1372 | #define OSST_SECTOR_SHIFT 9 |
@@ -1483,7 +1484,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst | |||
1483 | int dbg = debugging; | 1484 | int dbg = debugging; |
1484 | #endif | 1485 | #endif |
1485 | 1486 | ||
1486 | if ((buffer = (unsigned char *)vmalloc((nframes + 1) * OS_DATA_SIZE)) == NULL) | 1487 | if ((buffer = vmalloc((nframes + 1) * OS_DATA_SIZE)) == NULL) |
1487 | return (-EIO); | 1488 | return (-EIO); |
1488 | 1489 | ||
1489 | printk(KERN_INFO "%s:I: Reading back %d frames from drive buffer%s\n", | 1490 | printk(KERN_INFO "%s:I: Reading back %d frames from drive buffer%s\n", |
@@ -2295,7 +2296,7 @@ static int osst_write_header(struct osst_tape * STp, struct osst_request ** aSRp | |||
2295 | if (STp->raw) return 0; | 2296 | if (STp->raw) return 0; |
2296 | 2297 | ||
2297 | if (STp->header_cache == NULL) { | 2298 | if (STp->header_cache == NULL) { |
2298 | if ((STp->header_cache = (os_header_t *)vmalloc(sizeof(os_header_t))) == NULL) { | 2299 | if ((STp->header_cache = vmalloc(sizeof(os_header_t))) == NULL) { |
2299 | printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name); | 2300 | printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name); |
2300 | return (-ENOMEM); | 2301 | return (-ENOMEM); |
2301 | } | 2302 | } |
@@ -2483,7 +2484,7 @@ static int __osst_analyze_headers(struct osst_tape * STp, struct osst_request ** | |||
2483 | name, ppos, update_frame_cntr); | 2484 | name, ppos, update_frame_cntr); |
2484 | #endif | 2485 | #endif |
2485 | if (STp->header_cache == NULL) { | 2486 | if (STp->header_cache == NULL) { |
2486 | if ((STp->header_cache = (os_header_t *)vmalloc(sizeof(os_header_t))) == NULL) { | 2487 | if ((STp->header_cache = vmalloc(sizeof(os_header_t))) == NULL) { |
2487 | printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name); | 2488 | printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name); |
2488 | return 0; | 2489 | return 0; |
2489 | } | 2490 | } |
@@ -3130,7 +3131,7 @@ static int osst_flush_write_buffer(struct osst_tape *STp, struct osst_request ** | |||
3130 | } | 3131 | } |
3131 | #if DEBUG | 3132 | #if DEBUG |
3132 | if (debugging) | 3133 | if (debugging) |
3133 | printk(OSST_DEB_MSG "%s:D: Flushing %d bytes, Transfering %d bytes in %d lblocks.\n", | 3134 | printk(OSST_DEB_MSG "%s:D: Flushing %d bytes, Transferring %d bytes in %d lblocks.\n", |
3134 | name, offset, transfer, blks); | 3135 | name, offset, transfer, blks); |
3135 | #endif | 3136 | #endif |
3136 | 3137 | ||
@@ -3810,7 +3811,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo | |||
3810 | 3811 | ||
3811 | if (transfer == 0) { | 3812 | if (transfer == 0) { |
3812 | printk(KERN_WARNING | 3813 | printk(KERN_WARNING |
3813 | "%s:W: Nothing can be transfered, requested %Zd, tape block size (%d%c).\n", | 3814 | "%s:W: Nothing can be transferred, requested %Zd, tape block size (%d%c).\n", |
3814 | name, count, STp->block_size < 1024? | 3815 | name, count, STp->block_size < 1024? |
3815 | STp->block_size:STp->block_size/1024, | 3816 | STp->block_size:STp->block_size/1024, |
3816 | STp->block_size<1024?'b':'k'); | 3817 | STp->block_size<1024?'b':'k'); |
@@ -4697,12 +4698,14 @@ static int __os_scsi_tape_open(struct inode * inode, struct file * filp) | |||
4697 | break; | 4698 | break; |
4698 | 4699 | ||
4699 | if ((SRpnt->sense[2] & 0x0f) == UNIT_ATTENTION) { | 4700 | if ((SRpnt->sense[2] & 0x0f) == UNIT_ATTENTION) { |
4701 | int j; | ||
4702 | |||
4700 | STp->pos_unknown = 0; | 4703 | STp->pos_unknown = 0; |
4701 | STp->partition = STp->new_partition = 0; | 4704 | STp->partition = STp->new_partition = 0; |
4702 | if (STp->can_partitions) | 4705 | if (STp->can_partitions) |
4703 | STp->nbr_partitions = 1; /* This guess will be updated later if necessary */ | 4706 | STp->nbr_partitions = 1; /* This guess will be updated later if necessary */ |
4704 | for (i=0; i < ST_NBR_PARTITIONS; i++) { | 4707 | for (j = 0; j < ST_NBR_PARTITIONS; j++) { |
4705 | STps = &(STp->ps[i]); | 4708 | STps = &(STp->ps[j]); |
4706 | STps->rw = ST_IDLE; | 4709 | STps->rw = ST_IDLE; |
4707 | STps->eof = ST_NOEOF; | 4710 | STps->eof = ST_NOEOF; |
4708 | STps->at_sm = 0; | 4711 | STps->at_sm = 0; |
@@ -4807,9 +4810,9 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) | |||
4807 | { | 4810 | { |
4808 | int ret; | 4811 | int ret; |
4809 | 4812 | ||
4810 | lock_kernel(); | 4813 | mutex_lock(&osst_int_mutex); |
4811 | ret = __os_scsi_tape_open(inode, filp); | 4814 | ret = __os_scsi_tape_open(inode, filp); |
4812 | unlock_kernel(); | 4815 | mutex_unlock(&osst_int_mutex); |
4813 | return ret; | 4816 | return ret; |
4814 | } | 4817 | } |
4815 | 4818 | ||
@@ -4943,9 +4946,9 @@ static long osst_ioctl(struct file * file, | |||
4943 | char * name = tape_name(STp); | 4946 | char * name = tape_name(STp); |
4944 | void __user * p = (void __user *)arg; | 4947 | void __user * p = (void __user *)arg; |
4945 | 4948 | ||
4946 | lock_kernel(); | 4949 | mutex_lock(&osst_int_mutex); |
4947 | if (mutex_lock_interruptible(&STp->lock)) { | 4950 | if (mutex_lock_interruptible(&STp->lock)) { |
4948 | unlock_kernel(); | 4951 | mutex_unlock(&osst_int_mutex); |
4949 | return -ERESTARTSYS; | 4952 | return -ERESTARTSYS; |
4950 | } | 4953 | } |
4951 | 4954 | ||
@@ -5260,14 +5263,14 @@ static long osst_ioctl(struct file * file, | |||
5260 | mutex_unlock(&STp->lock); | 5263 | mutex_unlock(&STp->lock); |
5261 | 5264 | ||
5262 | retval = scsi_ioctl(STp->device, cmd_in, p); | 5265 | retval = scsi_ioctl(STp->device, cmd_in, p); |
5263 | unlock_kernel(); | 5266 | mutex_unlock(&osst_int_mutex); |
5264 | return retval; | 5267 | return retval; |
5265 | 5268 | ||
5266 | out: | 5269 | out: |
5267 | if (SRpnt) osst_release_request(SRpnt); | 5270 | if (SRpnt) osst_release_request(SRpnt); |
5268 | 5271 | ||
5269 | mutex_unlock(&STp->lock); | 5272 | mutex_unlock(&STp->lock); |
5270 | unlock_kernel(); | 5273 | mutex_unlock(&osst_int_mutex); |
5271 | 5274 | ||
5272 | return retval; | 5275 | return retval; |
5273 | } | 5276 | } |
@@ -5850,9 +5853,7 @@ static int osst_probe(struct device *dev) | |||
5850 | /* if this is the first attach, build the infrastructure */ | 5853 | /* if this is the first attach, build the infrastructure */ |
5851 | write_lock(&os_scsi_tapes_lock); | 5854 | write_lock(&os_scsi_tapes_lock); |
5852 | if (os_scsi_tapes == NULL) { | 5855 | if (os_scsi_tapes == NULL) { |
5853 | os_scsi_tapes = | 5856 | os_scsi_tapes = kmalloc(osst_max_dev * sizeof(struct osst_tape *), GFP_ATOMIC); |
5854 | (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *), | ||
5855 | GFP_ATOMIC); | ||
5856 | if (os_scsi_tapes == NULL) { | 5857 | if (os_scsi_tapes == NULL) { |
5857 | write_unlock(&os_scsi_tapes_lock); | 5858 | write_unlock(&os_scsi_tapes_lock); |
5858 | printk(KERN_ERR "osst :E: Unable to allocate array for OnStream SCSI tapes.\n"); | 5859 | printk(KERN_ERR "osst :E: Unable to allocate array for OnStream SCSI tapes.\n"); |