diff options
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r-- | drivers/scsi/sg.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 91e316fe6522..8201387b4daa 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -289,8 +289,8 @@ sg_open(struct inode *inode, struct file *filp) | |||
289 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ | 289 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ |
290 | sdp->sgdebug = 0; | 290 | sdp->sgdebug = 0; |
291 | q = sdp->device->request_queue; | 291 | q = sdp->device->request_queue; |
292 | sdp->sg_tablesize = min(q->max_hw_segments, | 292 | sdp->sg_tablesize = min(queue_max_hw_segments(q), |
293 | q->max_phys_segments); | 293 | queue_max_phys_segments(q)); |
294 | } | 294 | } |
295 | if ((sfp = sg_add_sfp(sdp, dev))) | 295 | if ((sfp = sg_add_sfp(sdp, dev))) |
296 | filp->private_data = sfp; | 296 | filp->private_data = sfp; |
@@ -909,7 +909,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
909 | if (val < 0) | 909 | if (val < 0) |
910 | return -EINVAL; | 910 | return -EINVAL; |
911 | val = min_t(int, val, | 911 | val = min_t(int, val, |
912 | sdp->device->request_queue->max_sectors * 512); | 912 | queue_max_sectors(sdp->device->request_queue) * 512); |
913 | if (val != sfp->reserve.bufflen) { | 913 | if (val != sfp->reserve.bufflen) { |
914 | if (sg_res_in_use(sfp) || sfp->mmap_called) | 914 | if (sg_res_in_use(sfp) || sfp->mmap_called) |
915 | return -EBUSY; | 915 | return -EBUSY; |
@@ -919,7 +919,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
919 | return 0; | 919 | return 0; |
920 | case SG_GET_RESERVED_SIZE: | 920 | case SG_GET_RESERVED_SIZE: |
921 | val = min_t(int, sfp->reserve.bufflen, | 921 | val = min_t(int, sfp->reserve.bufflen, |
922 | sdp->device->request_queue->max_sectors * 512); | 922 | queue_max_sectors(sdp->device->request_queue) * 512); |
923 | return put_user(val, ip); | 923 | return put_user(val, ip); |
924 | case SG_SET_COMMAND_Q: | 924 | case SG_SET_COMMAND_Q: |
925 | result = get_user(val, ip); | 925 | result = get_user(val, ip); |
@@ -1059,7 +1059,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1059 | return -ENODEV; | 1059 | return -ENODEV; |
1060 | return scsi_ioctl(sdp->device, cmd_in, p); | 1060 | return scsi_ioctl(sdp->device, cmd_in, p); |
1061 | case BLKSECTGET: | 1061 | case BLKSECTGET: |
1062 | return put_user(sdp->device->request_queue->max_sectors * 512, | 1062 | return put_user(queue_max_sectors(sdp->device->request_queue) * 512, |
1063 | ip); | 1063 | ip); |
1064 | case BLKTRACESETUP: | 1064 | case BLKTRACESETUP: |
1065 | return blk_trace_setup(sdp->device->request_queue, | 1065 | return blk_trace_setup(sdp->device->request_queue, |
@@ -1261,7 +1261,7 @@ static void sg_rq_end_io(struct request *rq, int uptodate) | |||
1261 | 1261 | ||
1262 | sense = rq->sense; | 1262 | sense = rq->sense; |
1263 | result = rq->errors; | 1263 | result = rq->errors; |
1264 | resid = rq->data_len; | 1264 | resid = rq->resid_len; |
1265 | 1265 | ||
1266 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", | 1266 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", |
1267 | sdp->disk->disk_name, srp->header.pack_id, result)); | 1267 | sdp->disk->disk_name, srp->header.pack_id, result)); |
@@ -1378,7 +1378,8 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1378 | sdp->device = scsidp; | 1378 | sdp->device = scsidp; |
1379 | INIT_LIST_HEAD(&sdp->sfds); | 1379 | INIT_LIST_HEAD(&sdp->sfds); |
1380 | init_waitqueue_head(&sdp->o_excl_wait); | 1380 | init_waitqueue_head(&sdp->o_excl_wait); |
1381 | sdp->sg_tablesize = min(q->max_hw_segments, q->max_phys_segments); | 1381 | sdp->sg_tablesize = min(queue_max_hw_segments(q), |
1382 | queue_max_phys_segments(q)); | ||
1382 | sdp->index = k; | 1383 | sdp->index = k; |
1383 | kref_init(&sdp->d_ref); | 1384 | kref_init(&sdp->d_ref); |
1384 | 1385 | ||
@@ -2056,7 +2057,7 @@ sg_add_sfp(Sg_device * sdp, int dev) | |||
2056 | sg_big_buff = def_reserved_size; | 2057 | sg_big_buff = def_reserved_size; |
2057 | 2058 | ||
2058 | bufflen = min_t(int, sg_big_buff, | 2059 | bufflen = min_t(int, sg_big_buff, |
2059 | sdp->device->request_queue->max_sectors * 512); | 2060 | queue_max_sectors(sdp->device->request_queue) * 512); |
2060 | sg_build_reserve(sfp, bufflen); | 2061 | sg_build_reserve(sfp, bufflen); |
2061 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n", | 2062 | SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n", |
2062 | sfp->reserve.bufflen, sfp->reserve.k_use_sg)); | 2063 | sfp->reserve.bufflen, sfp->reserve.k_use_sg)); |