Skip to content

Commit

Permalink
[SCSI] remove scsi_request infrastructure
Browse files Browse the repository at this point in the history
With Achim patch the last user (gdth) is switched away from scsi_request
so we an kill it now.  Also disables some code in i2o_scsi that was
broken since the sg driver stopped using scsi_requests.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Christoph Hellwig authored and James Bottomley committed Jun 10, 2006
1 parent 1951d09 commit beb4048
Show file tree
Hide file tree
Showing 19 changed files with 14 additions and 370 deletions.
4 changes: 2 additions & 2 deletions drivers/message/i2o/i2o_scsi.c
Expand Up @@ -65,9 +65,7 @@
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_request.h>
#include <scsi/sg.h>
#include <scsi/sg_request.h>

#define OSM_NAME "scsi-osm"
#define OSM_VERSION "1.316"
Expand Down Expand Up @@ -588,6 +586,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,

mptr = &msg->body[0];

#if 0 /* this code can't work */
#ifdef CONFIG_I2O_EXT_ADAPTEC
if (c->adaptec) {
u32 adpt_flags = 0;
Expand Down Expand Up @@ -624,6 +623,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
*mptr++ = cpu_to_le32(I2O_VENDOR_DPT << 16 | I2O_CMD_SCSI_EXEC);
*mptr++ = cpu_to_le32(adpt_flags | tid);
}
#endif
#endif

msg->u.head[1] = cpu_to_le32(cmd | HOST_TID << 12 | tid);
Expand Down
12 changes: 1 addition & 11 deletions drivers/scsi/constants.c
Expand Up @@ -13,9 +13,9 @@
#include <linux/kernel.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_dbg.h>

Expand Down Expand Up @@ -1261,16 +1261,6 @@ void scsi_print_sense(const char *devclass, struct scsi_cmnd *cmd)
}
EXPORT_SYMBOL(scsi_print_sense);

void scsi_print_req_sense(const char *devclass, struct scsi_request *sreq)
{
const char *name = devclass;

if (sreq->sr_request->rq_disk)
name = sreq->sr_request->rq_disk->disk_name;
__scsi_print_sense(name, sreq->sr_sense_buffer, SCSI_SENSE_BUFFERSIZE);
}
EXPORT_SYMBOL(scsi_print_req_sense);

void scsi_print_command(struct scsi_cmnd *cmd)
{
/* Assume appended output (i.e. not at start of line) */
Expand Down
8 changes: 4 additions & 4 deletions drivers/scsi/gdth.c
Expand Up @@ -716,8 +716,8 @@ static void gdth_scsi_done(struct scsi_cmnd *scp)
{
TRACE2(("gdth_scsi_done()\n"));

if (scp->sc_request)
complete((struct completion *)scp->sc_request);
if (scp->request)
complete((struct completion *)scp->request);
}

int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
Expand All @@ -732,8 +732,8 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
return -ENOMEM;
memset(scp, 0, sizeof(*scp));
scp->device = sdev;
/* use sc_request field to save the ptr. to completion struct. */
scp->sc_request = (struct scsi_request *)&wait;
/* use request field to save the ptr. to completion struct. */
scp->request = (struct request *)&wait;
scp->timeout_per_command = timeout*HZ;
scp->request_buffer = gdtcmd;
scp->cmd_len = 12;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/ipr.c
Expand Up @@ -79,7 +79,6 @@
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_request.h>
#include "ipr.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libata-scsi.c
Expand Up @@ -38,9 +38,9 @@
#include <linux/spinlock.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_transport.h>
#include <linux/libata.h>
#include <linux/hdreg.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/qlogicpti.c
Expand Up @@ -43,7 +43,6 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_host.h>

Expand Down
157 changes: 0 additions & 157 deletions drivers/scsi/scsi.c
Expand Up @@ -63,7 +63,6 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_request.h>

#include "scsi_priv.h"
#include "scsi_logging.h"
Expand Down Expand Up @@ -116,79 +115,6 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = {
};
EXPORT_SYMBOL(scsi_device_types);

/*
* Function: scsi_allocate_request
*
* Purpose: Allocate a request descriptor.
*
* Arguments: device - device for which we want a request
* gfp_mask - allocation flags passed to kmalloc
*
* Lock status: No locks assumed to be held. This function is SMP-safe.
*
* Returns: Pointer to request block.
*/
struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
gfp_t gfp_mask)
{
const int offset = ALIGN(sizeof(struct scsi_request), 4);
const int size = offset + sizeof(struct request);
struct scsi_request *sreq;

sreq = kzalloc(size, gfp_mask);
if (likely(sreq != NULL)) {
sreq->sr_request = (struct request *)(((char *)sreq) + offset);
sreq->sr_device = sdev;
sreq->sr_host = sdev->host;
sreq->sr_magic = SCSI_REQ_MAGIC;
sreq->sr_data_direction = DMA_BIDIRECTIONAL;
}

return sreq;
}
EXPORT_SYMBOL(scsi_allocate_request);

void __scsi_release_request(struct scsi_request *sreq)
{
struct request *req = sreq->sr_request;

/* unlikely because the tag was usually ended earlier by the
* mid-layer. However, for layering reasons ULD's don't end
* the tag of commands they generate. */
if (unlikely(blk_rq_tagged(req))) {
unsigned long flags;
struct request_queue *q = req->q;

spin_lock_irqsave(q->queue_lock, flags);
blk_queue_end_tag(q, req);
spin_unlock_irqrestore(q->queue_lock, flags);
}


if (likely(sreq->sr_command != NULL)) {
struct scsi_cmnd *cmd = sreq->sr_command;

sreq->sr_command = NULL;
scsi_next_command(cmd);
}
}

/*
* Function: scsi_release_request
*
* Purpose: Release a request descriptor.
*
* Arguments: sreq - request to release
*
* Lock status: No locks assumed to be held. This function is SMP-safe.
*/
void scsi_release_request(struct scsi_request *sreq)
{
__scsi_release_request(sreq);
kfree(sreq);
}
EXPORT_SYMBOL(scsi_release_request);

struct scsi_host_cmd_pool {
kmem_cache_t *slab;
unsigned int users;
Expand Down Expand Up @@ -646,73 +572,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
return rtn;
}

/*
* Function: scsi_init_cmd_from_req
*
* Purpose: Queue a SCSI command
* Purpose: Initialize a struct scsi_cmnd from a struct scsi_request
*
* Arguments: cmd - command descriptor.
* sreq - Request from the queue.
*
* Lock status: None needed.
*
* Returns: Nothing.
*
* Notes: Mainly transfer data from the request structure to the
* command structure. The request structure is allocated
* using the normal memory allocator, and requests can pile
* up to more or less any depth. The command structure represents
* a consumable resource, as these are allocated into a pool
* when the SCSI subsystem initializes. The preallocation is
* required so that in low-memory situations a disk I/O request
* won't cause the memory manager to try and write out a page.
* The request structure is generally used by ioctls and character
* devices.
*/
void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
{
sreq->sr_command = cmd;

cmd->cmd_len = sreq->sr_cmd_len;
cmd->use_sg = sreq->sr_use_sg;

cmd->request = sreq->sr_request;
memcpy(cmd->data_cmnd, sreq->sr_cmnd, sizeof(cmd->data_cmnd));
cmd->serial_number = 0;
cmd->bufflen = sreq->sr_bufflen;
cmd->buffer = sreq->sr_buffer;
cmd->retries = 0;
cmd->allowed = sreq->sr_allowed;
cmd->done = sreq->sr_done;
cmd->timeout_per_command = sreq->sr_timeout_per_command;
cmd->sc_data_direction = sreq->sr_data_direction;
cmd->sglist_len = sreq->sr_sglist_len;
cmd->underflow = sreq->sr_underflow;
cmd->sc_request = sreq;
memcpy(cmd->cmnd, sreq->sr_cmnd, sizeof(sreq->sr_cmnd));

/*
* Zero the sense buffer. Some host adapters automatically request
* sense on error. 0 is not a valid sense code.
*/
memset(cmd->sense_buffer, 0, sizeof(sreq->sr_sense_buffer));
cmd->request_buffer = sreq->sr_buffer;
cmd->request_bufflen = sreq->sr_bufflen;
cmd->old_use_sg = cmd->use_sg;
if (cmd->cmd_len == 0)
cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]);
cmd->old_cmd_len = cmd->cmd_len;
cmd->sc_old_data_direction = cmd->sc_data_direction;
cmd->old_underflow = cmd->underflow;

/*
* Start the timer ticking.
*/
cmd->result = 0;

SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n"));
}

/*
* Per-CPU I/O completion queue.
Expand Down Expand Up @@ -809,7 +668,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
{
struct scsi_device *sdev = cmd->device;
struct Scsi_Host *shost = sdev->host;
struct scsi_request *sreq;

scsi_device_unbusy(sdev);

Expand Down Expand Up @@ -839,21 +697,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
* We can get here with use_sg=0, causing a panic in the upper level
*/
cmd->use_sg = cmd->old_use_sg;

/*
* If there is an associated request structure, copy the data over
* before we call the completion function.
*/
sreq = cmd->sc_request;
if (sreq) {
sreq->sr_result = sreq->sr_command->result;
if (sreq->sr_result) {
memcpy(sreq->sr_sense_buffer,
sreq->sr_command->sense_buffer,
sizeof(sreq->sr_sense_buffer));
}
}

cmd->done(cmd);
}
EXPORT_SYMBOL(scsi_finish_command);
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/scsi.h
Expand Up @@ -25,7 +25,6 @@
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_request.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi.h>

Expand Down
12 changes: 1 addition & 11 deletions drivers/scsi/scsi_error.c
Expand Up @@ -26,13 +26,13 @@
#include <linux/delay.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_dbg.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_request.h>

#include "scsi_priv.h"
#include "scsi_logging.h"
Expand Down Expand Up @@ -1671,8 +1671,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
scmd->cmd_len = 0;

scmd->sc_data_direction = DMA_BIDIRECTIONAL;
scmd->sc_request = NULL;
scmd->sc_magic = SCSI_CMND_MAGIC;

init_timer(&scmd->eh_timeout);

Expand Down Expand Up @@ -1769,14 +1767,6 @@ int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
}
EXPORT_SYMBOL(scsi_normalize_sense);

int scsi_request_normalize_sense(struct scsi_request *sreq,
struct scsi_sense_hdr *sshdr)
{
return scsi_normalize_sense(sreq->sr_sense_buffer,
sizeof(sreq->sr_sense_buffer), sshdr);
}
EXPORT_SYMBOL(scsi_request_normalize_sense);

int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
struct scsi_sense_hdr *sshdr)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/scsi_ioctl.c
Expand Up @@ -15,11 +15,11 @@
#include <asm/uaccess.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_request.h>
#include <scsi/sg.h>
#include <scsi/scsi_dbg.h>

Expand Down

0 comments on commit beb4048

Please sign in to comment.