scsi: Implement sg_printk()
Update the sg driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Doug Gilbert <dgilbert@interlog.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
96eefad2d9
commit
95e159d6dd
|
@ -200,11 +200,11 @@ static ssize_t sg_new_write(Sg_fd *sfp, struct file *file,
|
|||
static int sg_common_write(Sg_fd * sfp, Sg_request * srp,
|
||||
unsigned char *cmnd, int timeout, int blocking);
|
||||
static int sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer);
|
||||
static void sg_remove_scat(Sg_scatter_hold * schp);
|
||||
static void sg_remove_scat(Sg_fd * sfp, Sg_scatter_hold * schp);
|
||||
static void sg_build_reserve(Sg_fd * sfp, int req_size);
|
||||
static void sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size);
|
||||
static void sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp);
|
||||
static Sg_fd *sg_add_sfp(Sg_device * sdp, int dev);
|
||||
static Sg_fd *sg_add_sfp(Sg_device * sdp);
|
||||
static void sg_remove_sfp(struct kref *);
|
||||
static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id);
|
||||
static Sg_request *sg_add_request(Sg_fd * sfp);
|
||||
|
@ -218,6 +218,10 @@ static void sg_device_destroy(struct kref *kref);
|
|||
#define SZ_SG_IOVEC sizeof(sg_iovec_t)
|
||||
#define SZ_SG_REQ_INFO sizeof(sg_req_info_t)
|
||||
|
||||
#define sg_printk(prefix, sdp, fmt, a...) \
|
||||
sdev_printk(prefix, (sdp)->device, "[%s] " fmt, \
|
||||
(sdp)->disk->disk_name, ##a)
|
||||
|
||||
static int sg_allow_access(struct file *filp, unsigned char *cmd)
|
||||
{
|
||||
struct sg_fd *sfp = filp->private_data;
|
||||
|
@ -276,13 +280,15 @@ sg_open(struct inode *inode, struct file *filp)
|
|||
int retval;
|
||||
|
||||
nonseekable_open(inode, filp);
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
|
||||
if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE)))
|
||||
return -EPERM; /* Can't lock it with read only access */
|
||||
sdp = sg_get_dev(dev);
|
||||
if (IS_ERR(sdp))
|
||||
return PTR_ERR(sdp);
|
||||
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_open: flags=0x%x\n", flags));
|
||||
|
||||
/* This driver's module count bumped by fops_get in <linux/fs.h> */
|
||||
/* Prevent the device driver from vanishing while we sleep */
|
||||
retval = scsi_device_get(sdp->device);
|
||||
|
@ -331,7 +337,7 @@ sg_open(struct inode *inode, struct file *filp)
|
|||
q = sdp->device->request_queue;
|
||||
sdp->sg_tablesize = queue_max_segments(q);
|
||||
}
|
||||
sfp = sg_add_sfp(sdp, dev);
|
||||
sfp = sg_add_sfp(sdp);
|
||||
if (IS_ERR(sfp)) {
|
||||
retval = PTR_ERR(sfp);
|
||||
goto out_undo;
|
||||
|
@ -370,7 +376,7 @@ sg_release(struct inode *inode, struct file *filp)
|
|||
|
||||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
||||
return -ENXIO;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_release: %s\n", sdp->disk->disk_name));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, "sg_release\n"));
|
||||
|
||||
mutex_lock(&sdp->open_rel_lock);
|
||||
scsi_autopm_put_device(sdp->device);
|
||||
|
@ -402,8 +408,8 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
|
|||
|
||||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
||||
return -ENXIO;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_read: %s, count=%d\n",
|
||||
sdp->disk->disk_name, (int) count));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_read: count=%d\n", (int) count));
|
||||
|
||||
if (!access_ok(VERIFY_WRITE, buf, count))
|
||||
return -EFAULT;
|
||||
|
@ -588,8 +594,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
|
|||
|
||||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
||||
return -ENXIO;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_write: %s, count=%d\n",
|
||||
sdp->disk->disk_name, (int) count));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_write: count=%d\n", (int) count));
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
if (!((filp->f_flags & O_NONBLOCK) ||
|
||||
|
@ -610,7 +616,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
|
|||
return -EIO; /* The minimum scsi command length is 6 bytes. */
|
||||
|
||||
if (!(srp = sg_add_request(sfp))) {
|
||||
SCSI_LOG_TIMEOUT(1, printk("sg_write: queue full\n"));
|
||||
SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sdp,
|
||||
"sg_write: queue full\n"));
|
||||
return -EDOM;
|
||||
}
|
||||
buf += SZ_SG_HEADER;
|
||||
|
@ -623,7 +630,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
|
|||
if ((opcode >= 0xc0) && old_hdr.twelve_byte)
|
||||
cmd_size = 12;
|
||||
}
|
||||
SCSI_LOG_TIMEOUT(4, printk(
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
|
||||
"sg_write: scsi opcode=0x%02x, cmd_size=%d\n", (int) opcode, cmd_size));
|
||||
/* Determine buffer size. */
|
||||
input_size = count - cmd_size;
|
||||
|
@ -698,7 +705,8 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,
|
|||
|
||||
sfp->cmd_q = 1; /* when sg_io_hdr seen, set command queuing on */
|
||||
if (!(srp = sg_add_request(sfp))) {
|
||||
SCSI_LOG_TIMEOUT(1, printk("sg_new_write: queue full\n"));
|
||||
SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_new_write: queue full\n"));
|
||||
return -EDOM;
|
||||
}
|
||||
srp->sg_io_owned = sg_io_owned;
|
||||
|
@ -767,12 +775,14 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
|
|||
hp->host_status = 0;
|
||||
hp->driver_status = 0;
|
||||
hp->resid = 0;
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n",
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n",
|
||||
(int) cmnd[0], (int) hp->cmd_len));
|
||||
|
||||
k = sg_start_req(srp, cmnd);
|
||||
if (k) {
|
||||
SCSI_LOG_TIMEOUT(1, printk("sg_common_write: start_req err=%d\n", k));
|
||||
SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_common_write: start_req err=%d\n", k));
|
||||
sg_finish_rem_req(srp);
|
||||
return k; /* probably out of space --> ENOMEM */
|
||||
}
|
||||
|
@ -846,8 +856,8 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
|||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
||||
return -ENXIO;
|
||||
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_ioctl: %s, cmd=0x%x\n",
|
||||
sdp->disk->disk_name, (int) cmd_in));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_ioctl: cmd=0x%x\n", (int) cmd_in));
|
||||
read_only = (O_RDWR != (filp->f_flags & O_ACCMODE));
|
||||
|
||||
switch (cmd_in) {
|
||||
|
@ -899,7 +909,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
|||
sfp->low_dma = 1;
|
||||
if ((0 == sfp->low_dma) && (0 == sg_res_in_use(sfp))) {
|
||||
val = (int) sfp->reserve.bufflen;
|
||||
sg_remove_scat(&sfp->reserve);
|
||||
sg_remove_scat(sfp, &sfp->reserve);
|
||||
sg_build_reserve(sfp, val);
|
||||
}
|
||||
} else {
|
||||
|
@ -975,7 +985,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
|||
if (val != sfp->reserve.bufflen) {
|
||||
if (sg_res_in_use(sfp) || sfp->mmap_called)
|
||||
return -EBUSY;
|
||||
sg_remove_scat(&sfp->reserve);
|
||||
sg_remove_scat(sfp, &sfp->reserve);
|
||||
sg_build_reserve(sfp, val);
|
||||
}
|
||||
return 0;
|
||||
|
@ -1198,8 +1208,8 @@ sg_poll(struct file *filp, poll_table * wait)
|
|||
res |= POLLOUT | POLLWRNORM;
|
||||
} else if (count < SG_MAX_QUEUE)
|
||||
res |= POLLOUT | POLLWRNORM;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_poll: %s, res=0x%x\n",
|
||||
sdp->disk->disk_name, (int) res));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_poll: res=0x%x\n", (int) res));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1211,8 +1221,8 @@ sg_fasync(int fd, struct file *filp, int mode)
|
|||
|
||||
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
|
||||
return -ENXIO;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n",
|
||||
sdp->disk->disk_name, mode));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_fasync: mode=%d\n", mode));
|
||||
|
||||
return fasync_helper(fd, filp, mode, &sfp->async_qp);
|
||||
}
|
||||
|
@ -1231,7 +1241,8 @@ sg_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
|||
offset = vmf->pgoff << PAGE_SHIFT;
|
||||
if (offset >= rsv_schp->bufflen)
|
||||
return VM_FAULT_SIGBUS;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_vma_fault: offset=%lu, scatg=%d\n",
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_vma_fault: offset=%lu, scatg=%d\n",
|
||||
offset, rsv_schp->k_use_sg));
|
||||
sa = vma->vm_start;
|
||||
length = 1 << (PAGE_SHIFT + rsv_schp->page_order);
|
||||
|
@ -1267,7 +1278,8 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||
if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data)))
|
||||
return -ENXIO;
|
||||
req_sz = vma->vm_end - vma->vm_start;
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n",
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_mmap starting, vm_start=%p, len=%d\n",
|
||||
(void *) vma->vm_start, (int) req_sz));
|
||||
if (vma->vm_pgoff)
|
||||
return -EINVAL; /* want no offset */
|
||||
|
@ -1330,8 +1342,9 @@ sg_rq_end_io(struct request *rq, int uptodate)
|
|||
result = rq->errors;
|
||||
resid = rq->resid_len;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n",
|
||||
sdp->disk->disk_name, srp->header.pack_id, result));
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sdp,
|
||||
"sg_cmd_done: pack_id=%d, res=0x%x\n",
|
||||
srp->header.pack_id, result));
|
||||
srp->header.resid = resid;
|
||||
ms = jiffies_to_msecs(jiffies);
|
||||
srp->header.duration = (ms > srp->header.duration) ?
|
||||
|
@ -1441,7 +1454,8 @@ sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
|
|||
}
|
||||
k = error;
|
||||
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_alloc: dev=%d \n", k));
|
||||
SCSI_LOG_TIMEOUT(3, sdev_printk(KERN_INFO, scsidp,
|
||||
"sg_alloc: dev=%d \n", k));
|
||||
sprintf(disk->disk_name, "sg%d", k);
|
||||
disk->first_minor = k;
|
||||
sdp->disk = disk;
|
||||
|
@ -1561,8 +1575,7 @@ sg_device_destroy(struct kref *kref)
|
|||
write_unlock_irqrestore(&sg_index_lock, flags);
|
||||
|
||||
SCSI_LOG_TIMEOUT(3,
|
||||
printk("sg_device_destroy: %s\n",
|
||||
sdp->disk->disk_name));
|
||||
sg_printk(KERN_INFO, sdp, "sg_device_destroy\n"));
|
||||
|
||||
put_disk(sdp->disk);
|
||||
kfree(sdp);
|
||||
|
@ -1584,8 +1597,8 @@ sg_remove_device(struct device *cl_dev, struct class_interface *cl_intf)
|
|||
if (val > 1)
|
||||
return; /* only want to do following once per device */
|
||||
|
||||
SCSI_LOG_TIMEOUT(3, printk("%s: %s\n", __func__,
|
||||
sdp->disk->disk_name));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"%s\n", __func__));
|
||||
|
||||
read_lock_irqsave(&sdp->sfd_lock, iflags);
|
||||
list_for_each_entry(sfp, &sdp->sfds, sfd_siblings) {
|
||||
|
@ -1687,7 +1700,8 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
|
|||
int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ;
|
||||
unsigned char *long_cmdp = NULL;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk(KERN_INFO "sg_start_req: dxfer_len=%d\n",
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_start_req: dxfer_len=%d\n",
|
||||
dxfer_len));
|
||||
|
||||
if (hp->cmd_len > BLK_MAX_CDB) {
|
||||
|
@ -1786,7 +1800,9 @@ sg_finish_rem_req(Sg_request *srp)
|
|||
Sg_fd *sfp = srp->parentfp;
|
||||
Sg_scatter_hold *req_schp = &srp->data;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_finish_rem_req: res_used=%d\n", (int) srp->res_used));
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_finish_rem_req: res_used=%d\n",
|
||||
(int) srp->res_used));
|
||||
if (srp->rq) {
|
||||
if (srp->bio)
|
||||
ret = blk_rq_unmap_user(srp->bio);
|
||||
|
@ -1799,7 +1815,7 @@ sg_finish_rem_req(Sg_request *srp)
|
|||
if (srp->res_used)
|
||||
sg_unlink_reserve(sfp, srp);
|
||||
else
|
||||
sg_remove_scat(req_schp);
|
||||
sg_remove_scat(sfp, req_schp);
|
||||
|
||||
sg_remove_request(sfp, srp);
|
||||
|
||||
|
@ -1833,7 +1849,8 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
|
|||
++blk_size; /* don't know why */
|
||||
/* round request up to next highest SG_SECTOR_SZ byte boundary */
|
||||
blk_size = ALIGN(blk_size, SG_SECTOR_SZ);
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_build_indirect: buff_size=%d, blk_size=%d\n",
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_build_indirect: buff_size=%d, blk_size=%d\n",
|
||||
buff_size, blk_size));
|
||||
|
||||
/* N.B. ret_sz carried into this block ... */
|
||||
|
@ -1877,14 +1894,16 @@ retry:
|
|||
}
|
||||
}
|
||||
|
||||
SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, "
|
||||
"ret_sz=%d\n", k, num, ret_sz));
|
||||
SCSI_LOG_TIMEOUT(5, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_build_indirect: k=%d, num=%d, ret_sz=%d\n",
|
||||
k, num, ret_sz));
|
||||
} /* end of for loop */
|
||||
|
||||
schp->page_order = order;
|
||||
schp->k_use_sg = k;
|
||||
SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k_use_sg=%d, "
|
||||
"rem_sz=%d\n", k, rem_sz));
|
||||
SCSI_LOG_TIMEOUT(5, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_build_indirect: k_use_sg=%d, rem_sz=%d\n",
|
||||
k, rem_sz));
|
||||
|
||||
schp->bufflen = blk_size;
|
||||
if (rem_sz > 0) /* must have failed */
|
||||
|
@ -1901,15 +1920,17 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
sg_remove_scat(Sg_scatter_hold * schp)
|
||||
sg_remove_scat(Sg_fd * sfp, Sg_scatter_hold * schp)
|
||||
{
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_remove_scat: k_use_sg=%d\n", schp->k_use_sg));
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_remove_scat: k_use_sg=%d\n", schp->k_use_sg));
|
||||
if (schp->pages && schp->sglist_len > 0) {
|
||||
if (!schp->dio_in_use) {
|
||||
int k;
|
||||
|
||||
for (k = 0; k < schp->k_use_sg && schp->pages[k]; k++) {
|
||||
SCSI_LOG_TIMEOUT(5, printk(
|
||||
SCSI_LOG_TIMEOUT(5,
|
||||
sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_remove_scat: k=%d, pg=0x%p\n",
|
||||
k, schp->pages[k]));
|
||||
__free_pages(schp->pages[k], schp->page_order);
|
||||
|
@ -1927,7 +1948,8 @@ sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer)
|
|||
Sg_scatter_hold *schp = &srp->data;
|
||||
int k, num;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_read_oxfer: num_read_xfer=%d\n",
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, srp->parentfp->parentdp,
|
||||
"sg_read_oxfer: num_read_xfer=%d\n",
|
||||
num_read_xfer));
|
||||
if ((!outp) || (num_read_xfer <= 0))
|
||||
return 0;
|
||||
|
@ -1958,14 +1980,15 @@ sg_build_reserve(Sg_fd * sfp, int req_size)
|
|||
{
|
||||
Sg_scatter_hold *schp = &sfp->reserve;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_build_reserve: req_size=%d\n", req_size));
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_build_reserve: req_size=%d\n", req_size));
|
||||
do {
|
||||
if (req_size < PAGE_SIZE)
|
||||
req_size = PAGE_SIZE;
|
||||
if (0 == sg_build_indirect(schp, sfp, req_size))
|
||||
return;
|
||||
else
|
||||
sg_remove_scat(schp);
|
||||
sg_remove_scat(sfp, schp);
|
||||
req_size >>= 1; /* divide by 2 */
|
||||
} while (req_size > (PAGE_SIZE / 2));
|
||||
}
|
||||
|
@ -1978,7 +2001,8 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
|
|||
int k, num, rem;
|
||||
|
||||
srp->res_used = 1;
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_link_reserve: size=%d\n", size));
|
||||
rem = size;
|
||||
|
||||
num = 1 << (PAGE_SHIFT + rsv_schp->page_order);
|
||||
|
@ -1996,7 +2020,8 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
|
|||
}
|
||||
|
||||
if (k >= rsv_schp->k_use_sg)
|
||||
SCSI_LOG_TIMEOUT(1, printk("sg_link_reserve: BAD size\n"));
|
||||
SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp,
|
||||
"sg_link_reserve: BAD size\n"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2004,7 +2029,8 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp)
|
|||
{
|
||||
Sg_scatter_hold *req_schp = &srp->data;
|
||||
|
||||
SCSI_LOG_TIMEOUT(4, printk("sg_unlink_reserve: req->k_use_sg=%d\n",
|
||||
SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, srp->parentfp->parentdp,
|
||||
"sg_unlink_reserve: req->k_use_sg=%d\n",
|
||||
(int) req_schp->k_use_sg));
|
||||
req_schp->k_use_sg = 0;
|
||||
req_schp->bufflen = 0;
|
||||
|
@ -2110,7 +2136,7 @@ sg_remove_request(Sg_fd * sfp, Sg_request * srp)
|
|||
}
|
||||
|
||||
static Sg_fd *
|
||||
sg_add_sfp(Sg_device * sdp, int dev)
|
||||
sg_add_sfp(Sg_device * sdp)
|
||||
{
|
||||
Sg_fd *sfp;
|
||||
unsigned long iflags;
|
||||
|
@ -2139,15 +2165,18 @@ sg_add_sfp(Sg_device * sdp, int dev)
|
|||
}
|
||||
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
|
||||
write_unlock_irqrestore(&sdp->sfd_lock, iflags);
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: sfp=0x%p\n", sfp));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_add_sfp: sfp=0x%p\n", sfp));
|
||||
if (unlikely(sg_big_buff != def_reserved_size))
|
||||
sg_big_buff = def_reserved_size;
|
||||
|
||||
bufflen = min_t(int, sg_big_buff,
|
||||
max_sectors_bytes(sdp->device->request_queue));
|
||||
sg_build_reserve(sfp, bufflen);
|
||||
SCSI_LOG_TIMEOUT(3, printk("sg_add_sfp: bufflen=%d, k_use_sg=%d\n",
|
||||
sfp->reserve.bufflen, sfp->reserve.k_use_sg));
|
||||
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
|
||||
"sg_add_sfp: bufflen=%d, k_use_sg=%d\n",
|
||||
sfp->reserve.bufflen,
|
||||
sfp->reserve.k_use_sg));
|
||||
|
||||
kref_get(&sdp->d_ref);
|
||||
__module_get(THIS_MODULE);
|
||||
|
@ -2165,17 +2194,15 @@ sg_remove_sfp_usercontext(struct work_struct *work)
|
|||
sg_finish_rem_req(sfp->headrp);
|
||||
|
||||
if (sfp->reserve.bufflen > 0) {
|
||||
SCSI_LOG_TIMEOUT(6,
|
||||
printk("sg_remove_sfp: bufflen=%d, k_use_sg=%d\n",
|
||||
SCSI_LOG_TIMEOUT(6, sg_printk(KERN_INFO, sdp,
|
||||
"sg_remove_sfp: bufflen=%d, k_use_sg=%d\n",
|
||||
(int) sfp->reserve.bufflen,
|
||||
(int) sfp->reserve.k_use_sg));
|
||||
sg_remove_scat(&sfp->reserve);
|
||||
sg_remove_scat(sfp, &sfp->reserve);
|
||||
}
|
||||
|
||||
SCSI_LOG_TIMEOUT(6,
|
||||
printk("sg_remove_sfp: %s, sfp=0x%p\n",
|
||||
sdp->disk->disk_name,
|
||||
sfp));
|
||||
SCSI_LOG_TIMEOUT(6, sg_printk(KERN_INFO, sdp,
|
||||
"sg_remove_sfp: sfp=0x%p\n", sfp));
|
||||
kfree(sfp);
|
||||
|
||||
scsi_device_put(sdp->device);
|
||||
|
|
Loading…
Reference in New Issue