From 7f23e146a122966bd58e5da9c16a0e12385f09fc Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 1 Dec 2005 12:50:13 -0600 Subject: [SCSI] correct some dropped const compiler warnings Make the vendor, model and rev fields in scsi_device pointers to const and update a few prototypes of functions using them. Signed-off-by: James Bottomley --- include/scsi/scsi_device.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 85cfd88461c8..063e32fe036c 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -79,9 +79,9 @@ struct scsi_device { char inq_periph_qual; /* PQ from INQUIRY data */ unsigned char inquiry_len; /* valid bytes in 'inquiry' */ unsigned char * inquiry; /* INQUIRY response data */ - char * vendor; /* [back_compat] point into 'inquiry' ... */ - char * model; /* ... after scan; point to static string */ - char * rev; /* ... "nullnullnullnull" before scan */ + const char * vendor; /* [back_compat] point into 'inquiry' ... */ + const char * model; /* ... after scan; point to static string */ + const char * rev; /* ... "nullnullnullnull" before scan */ unsigned char current_tag; /* current tag */ struct scsi_target *sdev_target; /* used only for single_lun */ -- cgit v1.2.3-59-g8ed1b From 4e06cbd42c41f9e49fcfe5ee45c749eefaae9cf4 Mon Sep 17 00:00:00 2001 From: "Moore, Eric Dean" Date: Thu, 1 Dec 2005 16:51:02 -0700 Subject: [SCSI] pci_ids.h: add subclass code for SAS Controllers Signed-off-by: Eric Moore Signed-off-by: James Bottomley --- include/linux/pci_ids.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 1e737e269db9..aa76fc4e38c2 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -15,6 +15,7 @@ #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_SAS 0x0107 #define PCI_CLASS_STORAGE_OTHER 0x0180 #define PCI_BASE_CLASS_NETWORK 0x02 -- cgit v1.2.3-59-g8ed1b From 829b84675edbe05f11c289946216da4f5c6b8e94 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Tue, 13 Dec 2005 10:29:31 -0700 Subject: [SCSI] Make scsi_transport_spi.h includable by itself Add forward declarations to allow scsi_transport_spi.h to be compiled by itself. Signed-off-by: Matthew Wilcox Signed-off-by: James Bottomley --- include/scsi/scsi_transport_spi.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 6bdc4afb2483..5c9b2e56e5b4 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h @@ -24,6 +24,9 @@ #include struct scsi_transport_template; +struct scsi_target; +struct scsi_device; +struct Scsi_Host; struct spi_transport_attrs { int period; /* value in the PPR/SDTR command */ -- cgit v1.2.3-59-g8ed1b From 6e39b69e7ea9205c5f80aeac3ef999ab8fb1a4cc Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Fri, 11 Nov 2005 05:30:24 -0600 Subject: [SCSI] export blk layer functions needed for blk_execute_rq_nowait To send async requests we need these two functions exported. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- block/ll_rw_blk.c | 6 +++++- include/linux/blkdev.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 99c9ca6d5992..c525b5a2b598 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -2306,6 +2306,8 @@ void blk_execute_rq_nowait(request_queue_t *q, struct gendisk *bd_disk, generic_unplug_device(q); } +EXPORT_SYMBOL_GPL(blk_execute_rq_nowait); + /** * blk_execute_rq - insert a request into queue for execution * @q: queue to insert the request in @@ -2444,7 +2446,7 @@ void disk_round_stats(struct gendisk *disk) /* * queue lock must be held */ -static void __blk_put_request(request_queue_t *q, struct request *req) +void __blk_put_request(request_queue_t *q, struct request *req) { struct request_list *rl = req->rl; @@ -2473,6 +2475,8 @@ static void __blk_put_request(request_queue_t *q, struct request *req) } } +EXPORT_SYMBOL_GPL(__blk_put_request); + void blk_put_request(struct request *req) { unsigned long flags; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a33a31e71bbc..9a68716dcf75 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -558,6 +558,7 @@ extern void blk_unregister_queue(struct gendisk *disk); extern void register_disk(struct gendisk *dev); extern void generic_make_request(struct bio *bio); extern void blk_put_request(struct request *); +extern void __blk_put_request(request_queue_t *, struct request *); extern void blk_end_sync_rq(struct request *rq); extern void blk_attempt_remerge(request_queue_t *, struct request *); extern struct request *blk_get_request(request_queue_t *, int, gfp_t); @@ -579,6 +580,10 @@ extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned extern int blk_rq_map_user_iov(request_queue_t *, struct request *, struct sg_iovec *, int); extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *, int); +extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *, + struct request *, int, + void (*done)(struct request *)); + static inline request_queue_t *bdev_get_queue(struct block_device *bdev) { return bdev->bd_disk->queue; -- cgit v1.2.3-59-g8ed1b From 6e68af666f5336254b5715dca591026b7324499a Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Fri, 11 Nov 2005 05:30:27 -0600 Subject: [SCSI] Convert SCSI mid-layer to scsi_execute_async Add scsi helpers to create really-large-requests and convert scsi-ml to scsi_execute_async(). Per Jens's previous comments, I placed this function in scsi_lib.c. I made it follow all the queue's limits - I think I did at least :), so I removed the warning on the function header. I think the scsi_execute_* functions should eventually take a request_queue and be placed some place where the dm-multipath hw_handler can use them if that failover code is going to stay in the kernel. That conversion patch will be sent in another mail though. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/scsi_error.c | 47 ++------- drivers/scsi/scsi_lib.c | 230 ++++++++++++++++++++++++++++++++++++++------- drivers/scsi/scsi_priv.h | 1 - fs/bio.c | 20 ++++ include/linux/bio.h | 2 + include/scsi/scsi_device.h | 6 ++ 6 files changed, 233 insertions(+), 73 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 18c5d2523014..53ea62d3b53d 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1314,23 +1314,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) } } -/** - * scsi_eh_lock_done - done function for eh door lock request - * @scmd: SCSI command block for the door lock request - * - * Notes: - * We completed the asynchronous door lock request, and it has either - * locked the door or failed. We must free the command structures - * associated with this request. - **/ -static void scsi_eh_lock_done(struct scsi_cmnd *scmd) -{ - struct scsi_request *sreq = scmd->sc_request; - - scsi_release_request(sreq); -} - - /** * scsi_eh_lock_door - Prevent medium removal for the specified device * @sdev: SCSI device to prevent medium removal @@ -1353,29 +1336,17 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd) **/ static void scsi_eh_lock_door(struct scsi_device *sdev) { - struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL); + unsigned char cmnd[MAX_COMMAND_SIZE]; - if (unlikely(!sreq)) { - printk(KERN_ERR "%s: request allocate failed," - "prevent media removal cmd not sent\n", __FUNCTION__); - return; - } + cmnd[0] = ALLOW_MEDIUM_REMOVAL; + cmnd[1] = 0; + cmnd[2] = 0; + cmnd[3] = 0; + cmnd[4] = SCSI_REMOVAL_PREVENT; + cmnd[5] = 0; - sreq->sr_cmnd[0] = ALLOW_MEDIUM_REMOVAL; - sreq->sr_cmnd[1] = 0; - sreq->sr_cmnd[2] = 0; - sreq->sr_cmnd[3] = 0; - sreq->sr_cmnd[4] = SCSI_REMOVAL_PREVENT; - sreq->sr_cmnd[5] = 0; - sreq->sr_data_direction = DMA_NONE; - sreq->sr_bufflen = 0; - sreq->sr_buffer = NULL; - sreq->sr_allowed = 5; - sreq->sr_done = scsi_eh_lock_done; - sreq->sr_timeout_per_command = 10 * HZ; - sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); - - scsi_insert_special_req(sreq, 1); + scsi_execute_async(sdev, cmnd, DMA_NONE, NULL, 0, 0, 10 * HZ, + 5, NULL, NULL, GFP_KERNEL); } diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 1f2782767ca9..eb0cfbfbcf8f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -63,39 +63,6 @@ static struct scsi_host_sg_pool scsi_sg_pools[] = { }; #undef SP - -/* - * Function: scsi_insert_special_req() - * - * Purpose: Insert pre-formed request into request queue. - * - * Arguments: sreq - request that is ready to be queued. - * at_head - boolean. True if we should insert at head - * of queue, false if we should insert at tail. - * - * Lock status: Assumed that lock is not held upon entry. - * - * Returns: Nothing - * - * Notes: This function is called from character device and from - * ioctl types of functions where the caller knows exactly - * what SCSI command needs to be issued. The idea is that - * we merely inject the command into the queue (at the head - * for now), and then call the queue request function to actually - * process it. - */ -int scsi_insert_special_req(struct scsi_request *sreq, int at_head) -{ - /* - * Because users of this function are apt to reuse requests with no - * modification, we have to sanitise the request flags here - */ - sreq->sr_request->flags &= ~REQ_DONTPREP; - blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, - at_head, sreq); - return 0; -} - static void scsi_run_queue(struct request_queue *q); /* @@ -249,8 +216,13 @@ void scsi_do_req(struct scsi_request *sreq, const void *cmnd, /* * head injection *required* here otherwise quiesce won't work + * + * Because users of this function are apt to reuse requests with no + * modification, we have to sanitise the request flags here */ - scsi_insert_special_req(sreq, 1); + sreq->sr_request->flags &= ~REQ_DONTPREP; + blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, + 1, sreq); } EXPORT_SYMBOL(scsi_do_req); @@ -327,6 +299,196 @@ int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, } EXPORT_SYMBOL(scsi_execute_req); +struct scsi_io_context { + void *data; + void (*done)(void *data, char *sense, int result, int resid); + char sense[SCSI_SENSE_BUFFERSIZE]; +}; + +static void scsi_end_async(struct request *req) +{ + struct scsi_io_context *sioc = req->end_io_data; + + if (sioc->done) + sioc->done(sioc->data, sioc->sense, req->errors, req->data_len); + + kfree(sioc); + __blk_put_request(req->q, req); +} + +static int scsi_merge_bio(struct request *rq, struct bio *bio) +{ + struct request_queue *q = rq->q; + + bio->bi_flags &= ~(1 << BIO_SEG_VALID); + if (rq_data_dir(rq) == WRITE) + bio->bi_rw |= (1 << BIO_RW); + blk_queue_bounce(q, &bio); + + if (!rq->bio) + blk_rq_bio_prep(q, rq, bio); + else if (!q->back_merge_fn(q, rq, bio)) + return -EINVAL; + else { + rq->biotail->bi_next = bio; + rq->biotail = bio; + rq->hard_nr_sectors += bio_sectors(bio); + rq->nr_sectors = rq->hard_nr_sectors; + } + + return 0; +} + +static int scsi_bi_endio(struct bio *bio, unsigned int bytes_done, int error) +{ + if (bio->bi_size) + return 1; + + bio_put(bio); + return 0; +} + +/** + * scsi_req_map_sg - map a scatterlist into a request + * @rq: request to fill + * @sg: scatterlist + * @nsegs: number of elements + * @bufflen: len of buffer + * @gfp: memory allocation flags + * + * scsi_req_map_sg maps a scatterlist into a request so that the + * request can be sent to the block layer. We do not trust the scatterlist + * sent to use, as some ULDs use that struct to only organize the pages. + */ +static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, + int nsegs, unsigned bufflen, gfp_t gfp) +{ + struct request_queue *q = rq->q; + int nr_pages = (bufflen + PAGE_SIZE - 1) >> PAGE_SHIFT; + unsigned int data_len = 0, len, bytes, off; + struct page *page; + struct bio *bio = NULL; + int i, err, nr_vecs = 0; + + for (i = 0; i < nsegs; i++) { + page = sgl[i].page; + off = sgl[i].offset; + len = sgl[i].length; + data_len += len; + + while (len > 0) { + bytes = min_t(unsigned int, len, PAGE_SIZE - off); + + if (!bio) { + nr_vecs = min_t(int, BIO_MAX_PAGES, nr_pages); + nr_pages -= nr_vecs; + + bio = bio_alloc(gfp, nr_vecs); + if (!bio) { + err = -ENOMEM; + goto free_bios; + } + bio->bi_end_io = scsi_bi_endio; + } + + if (bio_add_pc_page(q, bio, page, bytes, off) != + bytes) { + bio_put(bio); + err = -EINVAL; + goto free_bios; + } + + if (bio->bi_vcnt >= nr_vecs) { + err = scsi_merge_bio(rq, bio); + if (err) { + bio_endio(bio, bio->bi_size, 0); + goto free_bios; + } + bio = NULL; + } + + page++; + len -= bytes; + off = 0; + } + } + + rq->buffer = rq->data = NULL; + rq->data_len = data_len; + return 0; + +free_bios: + while ((bio = rq->bio) != NULL) { + rq->bio = bio->bi_next; + /* + * call endio instead of bio_put incase it was bounced + */ + bio_endio(bio, bio->bi_size, 0); + } + + return err; +} + +/** + * scsi_execute_async - insert request + * @sdev: scsi device + * @cmd: scsi command + * @data_direction: data direction + * @buffer: data buffer (this can be a kernel buffer or scatterlist) + * @bufflen: len of buffer + * @use_sg: if buffer is a scatterlist this is the number of elements + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * @flags: or into request flags + **/ +int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, + int data_direction, void *buffer, unsigned bufflen, + int use_sg, int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), gfp_t gfp) +{ + struct request *req; + struct scsi_io_context *sioc; + int err = 0; + int write = (data_direction == DMA_TO_DEVICE); + + sioc = kzalloc(sizeof(*sioc), gfp); + if (!sioc) + return DRIVER_ERROR << 24; + + req = blk_get_request(sdev->request_queue, write, gfp); + if (!req) + goto free_sense; + + if (use_sg) + err = scsi_req_map_sg(req, buffer, use_sg, bufflen, gfp); + else if (bufflen) + err = blk_rq_map_kern(req->q, req, buffer, bufflen, gfp); + + if (err) + goto free_req; + + req->cmd_len = COMMAND_SIZE(cmd[0]); + memcpy(req->cmd, cmd, req->cmd_len); + req->sense = sioc->sense; + req->sense_len = 0; + req->timeout = timeout; + req->flags |= REQ_BLOCK_PC | REQ_QUIET; + req->end_io_data = sioc; + + sioc->data = privdata; + sioc->done = done; + + blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async); + return 0; + +free_req: + blk_put_request(req); +free_sense: + kfree(sioc); + return DRIVER_ERROR << 24; +} +EXPORT_SYMBOL_GPL(scsi_execute_async); + /* * Function: scsi_init_cmd_errh() * diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index a8d121c8fbcd..f04e7e11f57a 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -40,7 +40,6 @@ extern void scsi_exit_hosts(void); extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd); extern int scsi_setup_command_freelist(struct Scsi_Host *shost); extern void scsi_destroy_command_freelist(struct Scsi_Host *shost); -extern int scsi_insert_special_req(struct scsi_request *sreq, int); extern void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq); extern void __scsi_release_request(struct scsi_request *sreq); diff --git a/fs/bio.c b/fs/bio.c index 460554b07ff9..4d21ee3873ec 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -385,6 +385,25 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page return len; } +/** + * bio_add_pc_page - attempt to add page to bio + * @bio: destination bio + * @page: page to add + * @len: vec entry length + * @offset: vec entry offset + * + * Attempt to add a page to the bio_vec maplist. This can fail for a + * number of reasons, such as the bio being full or target block + * device limitations. The target block device must allow bio's + * smaller than PAGE_SIZE, so it is always possible to add a single + * page to an empty bio. This should only be used by REQ_PC bios. + */ +int bio_add_pc_page(request_queue_t *q, struct bio *bio, struct page *page, + unsigned int len, unsigned int offset) +{ + return __bio_add_page(q, bio, page, len, offset); +} + /** * bio_add_page - attempt to add page to bio * @bio: destination bio @@ -1228,6 +1247,7 @@ EXPORT_SYMBOL(bio_clone); EXPORT_SYMBOL(bio_phys_segments); EXPORT_SYMBOL(bio_hw_segments); EXPORT_SYMBOL(bio_add_page); +EXPORT_SYMBOL(bio_add_pc_page); EXPORT_SYMBOL(bio_get_nr_vecs); EXPORT_SYMBOL(bio_map_user); EXPORT_SYMBOL(bio_unmap_user); diff --git a/include/linux/bio.h b/include/linux/bio.h index 685fd3720df5..b60ffe32cd21 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -292,6 +292,8 @@ extern struct bio *bio_clone(struct bio *, gfp_t); extern void bio_init(struct bio *); extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); +extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, + unsigned int, unsigned int); extern int bio_get_nr_vecs(struct block_device *); extern struct bio *bio_map_user(struct request_queue *, struct block_device *, unsigned long, unsigned int, int); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 063e32fe036c..e94ca4d36035 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -274,6 +274,12 @@ extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *, int timeout, int retries); +extern int scsi_execute_async(struct scsi_device *sdev, + const unsigned char *cmd, int data_direction, + void *buffer, unsigned bufflen, int use_sg, + int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), + gfp_t gfp); static inline unsigned int sdev_channel(struct scsi_device *sdev) { -- cgit v1.2.3-59-g8ed1b From 17e01f216b611fc46956dcd9063aec4de75991e3 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Fri, 11 Nov 2005 05:31:37 -0600 Subject: [SCSI] add retries field to request for REQ_BLOCK_PC use For tape we need to control the retries. This patch adds a retries counter on the request for REQ_BLOCK_PC commands originating from scsi_execute* to use. REQ_BLOCK_PC commands comming from the block layer SG_IO path continue to use the retires set in the ULD init_command. (scsi_execute* does not set the gendisk so we do not execute the init_command in that path). Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/scsi_lib.c | 4 +++- include/linux/blkdev.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index eb0cfbfbcf8f..365843a1561f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -259,6 +259,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, memcpy(req->cmd, cmd, req->cmd_len); req->sense = sense; req->sense_len = 0; + req->retries = retries; req->timeout = timeout; req->flags |= flags | REQ_BLOCK_PC | REQ_SPECIAL | REQ_QUIET; @@ -472,6 +473,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, req->sense = sioc->sense; req->sense_len = 0; req->timeout = timeout; + req->retries = retries; req->flags |= REQ_BLOCK_PC | REQ_QUIET; req->end_io_data = sioc; @@ -1393,7 +1395,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) cmd->sc_data_direction = DMA_NONE; cmd->transfersize = req->data_len; - cmd->allowed = 3; + cmd->allowed = req->retries; cmd->timeout_per_command = req->timeout; cmd->done = scsi_generic_done; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9a68716dcf75..509e9a03a328 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -184,6 +184,7 @@ struct request { void *sense; unsigned int timeout; + int retries; /* * For Power Management requests -- cgit v1.2.3-59-g8ed1b From defd94b75409b983f94548ea2f52ff5787ddb848 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Mon, 5 Dec 2005 02:37:06 -0600 Subject: [SCSI] seperate max_sectors from max_hw_sectors - export __blk_put_request and blk_execute_rq_nowait needed for async REQ_BLOCK_PC requests - seperate max_hw_sectors and max_sectors for block/scsi_ioctl.c and SG_IO bio.c helpers per Jens's last comments. Since block/scsi_ioctl.c SG_IO was already testing against max_sectors and SCSI-ml was setting max_sectors and max_hw_sectors to the same value this does not change any scsi SG_IO behavior. It only prepares ll_rw_blk.c, scsi_ioctl.c and bio.c for when SCSI-ml begins to set a valid max_hw_sectors for all LLDs. Today if a LLD does not set it SCSI-ml sets it to a safe default and some LLDs set it to a artificial low value to overcome memory and feedback issues. Note: Since we now cap max_sectors to BLK_DEF_MAX_SECTORS, which is 1024, drivers that used to call blk_queue_max_sectors with a large value of max_sectors will now see the fs requests capped to BLK_DEF_MAX_SECTORS. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- block/ll_rw_blk.c | 34 ++++++++++++++++++++++++++-------- block/scsi_ioctl.c | 2 +- drivers/md/dm-table.c | 2 +- drivers/scsi/scsi_lib.c | 2 +- fs/bio.c | 20 +++++++++++--------- include/linux/blkdev.h | 3 ++- 6 files changed, 42 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index c525b5a2b598..d4beb9a89ee0 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c @@ -239,7 +239,7 @@ void blk_queue_make_request(request_queue_t * q, make_request_fn * mfn) q->backing_dev_info.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; q->backing_dev_info.state = 0; q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; - blk_queue_max_sectors(q, MAX_SECTORS); + blk_queue_max_sectors(q, SAFE_MAX_SECTORS); blk_queue_hardsect_size(q, 512); blk_queue_dma_alignment(q, 511); blk_queue_congestion_threshold(q); @@ -555,7 +555,12 @@ void blk_queue_max_sectors(request_queue_t *q, unsigned short max_sectors) printk("%s: set to minimum %d\n", __FUNCTION__, max_sectors); } - q->max_sectors = q->max_hw_sectors = max_sectors; + if (BLK_DEF_MAX_SECTORS > max_sectors) + q->max_hw_sectors = q->max_sectors = max_sectors; + else { + q->max_sectors = BLK_DEF_MAX_SECTORS; + q->max_hw_sectors = max_sectors; + } } EXPORT_SYMBOL(blk_queue_max_sectors); @@ -657,8 +662,8 @@ EXPORT_SYMBOL(blk_queue_hardsect_size); void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b) { /* zero is "infinity" */ - t->max_sectors = t->max_hw_sectors = - min_not_zero(t->max_sectors,b->max_sectors); + t->max_sectors = min_not_zero(t->max_sectors,b->max_sectors); + t->max_hw_sectors = min_not_zero(t->max_hw_sectors,b->max_hw_sectors); t->max_phys_segments = min(t->max_phys_segments,b->max_phys_segments); t->max_hw_segments = min(t->max_hw_segments,b->max_hw_segments); @@ -1293,9 +1298,15 @@ static inline int ll_new_hw_segment(request_queue_t *q, static int ll_back_merge_fn(request_queue_t *q, struct request *req, struct bio *bio) { + unsigned short max_sectors; int len; - if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) { + if (unlikely(blk_pc_request(req))) + max_sectors = q->max_hw_sectors; + else + max_sectors = q->max_sectors; + + if (req->nr_sectors + bio_sectors(bio) > max_sectors) { req->flags |= REQ_NOMERGE; if (req == q->last_merge) q->last_merge = NULL; @@ -1325,9 +1336,16 @@ static int ll_back_merge_fn(request_queue_t *q, struct request *req, static int ll_front_merge_fn(request_queue_t *q, struct request *req, struct bio *bio) { + unsigned short max_sectors; int len; - if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) { + if (unlikely(blk_pc_request(req))) + max_sectors = q->max_hw_sectors; + else + max_sectors = q->max_sectors; + + + if (req->nr_sectors + bio_sectors(bio) > max_sectors) { req->flags |= REQ_NOMERGE; if (req == q->last_merge) q->last_merge = NULL; @@ -2144,7 +2162,7 @@ int blk_rq_map_user(request_queue_t *q, struct request *rq, void __user *ubuf, struct bio *bio; int reading; - if (len > (q->max_sectors << 9)) + if (len > (q->max_hw_sectors << 9)) return -EINVAL; if (!len || !ubuf) return -EINVAL; @@ -2259,7 +2277,7 @@ int blk_rq_map_kern(request_queue_t *q, struct request *rq, void *kbuf, { struct bio *bio; - if (len > (q->max_sectors << 9)) + if (len > (q->max_hw_sectors << 9)) return -EINVAL; if (!len || !kbuf) return -EINVAL; diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 382dea7b224c..4e390dfd3157 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -233,7 +233,7 @@ static int sg_io(struct file *file, request_queue_t *q, if (verify_command(file, cmd)) return -EPERM; - if (hdr->dxfer_len > (q->max_sectors << 9)) + if (hdr->dxfer_len > (q->max_hw_sectors << 9)) return -EIO; if (hdr->dxfer_len) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a6d3baa46f61..a6f2dc66c3db 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -638,7 +638,7 @@ int dm_split_args(int *argc, char ***argvp, char *input) static void check_for_valid_limits(struct io_restrictions *rs) { if (!rs->max_sectors) - rs->max_sectors = MAX_SECTORS; + rs->max_sectors = SAFE_MAX_SECTORS; if (!rs->max_phys_segments) rs->max_phys_segments = MAX_PHYS_SEGMENTS; if (!rs->max_hw_segments) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 54a72f197487..14ad2a785a34 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -462,6 +462,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, req = blk_get_request(sdev->request_queue, write, gfp); if (!req) goto free_sense; + req->flags |= REQ_BLOCK_PC | REQ_QUIET; if (use_sg) err = scsi_req_map_sg(req, buffer, use_sg, bufflen, gfp); @@ -477,7 +478,6 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, req->sense_len = 0; req->timeout = timeout; req->retries = retries; - req->flags |= REQ_BLOCK_PC | REQ_QUIET; req->end_io_data = sioc; sioc->data = privdata; diff --git a/fs/bio.c b/fs/bio.c index 4d21ee3873ec..38d3e8023a07 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -313,7 +313,8 @@ int bio_get_nr_vecs(struct block_device *bdev) } static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page - *page, unsigned int len, unsigned int offset) + *page, unsigned int len, unsigned int offset, + unsigned short max_sectors) { int retried_segments = 0; struct bio_vec *bvec; @@ -327,7 +328,7 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page if (bio->bi_vcnt >= bio->bi_max_vecs) return 0; - if (((bio->bi_size + len) >> 9) > q->max_sectors) + if (((bio->bi_size + len) >> 9) > max_sectors) return 0; /* @@ -401,7 +402,7 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page int bio_add_pc_page(request_queue_t *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { - return __bio_add_page(q, bio, page, len, offset); + return __bio_add_page(q, bio, page, len, offset, q->max_hw_sectors); } /** @@ -420,8 +421,8 @@ int bio_add_pc_page(request_queue_t *q, struct bio *bio, struct page *page, int bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { - return __bio_add_page(bdev_get_queue(bio->bi_bdev), bio, page, - len, offset); + struct request_queue *q = bdev_get_queue(bio->bi_bdev); + return __bio_add_page(q, bio, page, len, offset, q->max_sectors); } struct bio_map_data { @@ -533,7 +534,7 @@ struct bio *bio_copy_user(request_queue_t *q, unsigned long uaddr, break; } - if (__bio_add_page(q, bio, page, bytes, 0) < bytes) { + if (bio_add_pc_page(q, bio, page, bytes, 0) < bytes) { ret = -EINVAL; break; } @@ -647,7 +648,8 @@ static struct bio *__bio_map_user_iov(request_queue_t *q, /* * sorry... */ - if (__bio_add_page(q, bio, pages[j], bytes, offset) < bytes) + if (bio_add_pc_page(q, bio, pages[j], bytes, offset) < + bytes) break; len -= bytes; @@ -820,8 +822,8 @@ static struct bio *__bio_map_kern(request_queue_t *q, void *data, if (bytes > len) bytes = len; - if (__bio_add_page(q, bio, virt_to_page(data), bytes, - offset) < bytes) + if (bio_add_pc_page(q, bio, virt_to_page(data), bytes, + offset) < bytes) break; data += bytes; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 509e9a03a328..a18500d196e1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -702,7 +702,8 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *); #define MAX_PHYS_SEGMENTS 128 #define MAX_HW_SEGMENTS 128 -#define MAX_SECTORS 255 +#define SAFE_MAX_SECTORS 255 +#define BLK_DEF_MAX_SECTORS 1024 #define MAX_SEGMENT_SIZE 65536 -- cgit v1.2.3-59-g8ed1b From 7b16318dea8d9840dac567a2ae8c50ecdea36aea Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 15 Dec 2005 20:17:02 -0600 Subject: Fix up SCSI mismerge I forgot to do a git-update-cache on the merged files ... --- drivers/scsi/scsi_lib.c | 33 +++++++++++++++++++++------------ drivers/scsi/sd.c | 2 +- drivers/scsi/sr.c | 2 +- drivers/scsi/st.c | 2 +- include/scsi/scsi_cmnd.h | 2 +- 5 files changed, 25 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 14ad2a785a34..a7f3f0c84db7 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1259,6 +1259,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd) scsi_io_completion(cmd, cmd->bufflen, 0); } +void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd) +{ + struct request *req = cmd->request; + + BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd)); + memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); + cmd->cmd_len = req->cmd_len; + if (!req->data_len) + cmd->sc_data_direction = DMA_NONE; + else if (rq_data_dir(req) == WRITE) + cmd->sc_data_direction = DMA_TO_DEVICE; + else + cmd->sc_data_direction = DMA_FROM_DEVICE; + + cmd->transfersize = req->data_len; + cmd->allowed = req->retries; + cmd->timeout_per_command = req->timeout; +} +EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd); + static int scsi_prep_fn(struct request_queue *q, struct request *req) { struct scsi_device *sdev = q->queuedata; @@ -1394,18 +1414,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) goto kill; } } else { - memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); - cmd->cmd_len = req->cmd_len; - if (rq_data_dir(req) == WRITE) - cmd->sc_data_direction = DMA_TO_DEVICE; - else if (req->data_len) - cmd->sc_data_direction = DMA_FROM_DEVICE; - else - cmd->sc_data_direction = DMA_NONE; - - cmd->transfersize = req->data_len; - cmd->allowed = req->retries; - cmd->timeout_per_command = req->timeout; + scsi_setup_blk_pc_cmnd(cmd); cmd->done = scsi_generic_done; } } diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9d893f085015..3d3ad7d1b779 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -245,7 +245,7 @@ static int sd_init_command(struct scsi_cmnd * SCpnt) * SG_IO from block layer already setup, just copy cdb basically */ if (blk_pc_request(rq)) { - scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES); + scsi_setup_blk_pc_cmnd(SCpnt); if (rq->timeout) timeout = rq->timeout; diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 7e7398d563cc..a4d9be7c6874 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -320,7 +320,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) * these are already setup, just copy cdb basically */ if (SCpnt->request->flags & REQ_BLOCK_PC) { - scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES); + scsi_setup_blk_pc_cmnd(SCpnt); if (SCpnt->timeout_per_command) timeout = SCpnt->timeout_per_command; diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 894ad53be04b..c4aade8f5345 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -4198,7 +4198,7 @@ static int st_init_command(struct scsi_cmnd *SCpnt) if (!(SCpnt->request->flags & REQ_BLOCK_PC)) return 0; - scsi_setup_blk_pc_cmnd(SCpnt, 0); + scsi_setup_blk_pc_cmnd(SCpnt); SCpnt->done = st_intr; return 1; } diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 20da282d4abb..41cfc29be899 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -151,6 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); extern void scsi_put_command(struct scsi_cmnd *); extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); extern void scsi_finish_command(struct scsi_cmnd *cmd); -extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries); +extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd); #endif /* _SCSI_SCSI_CMND_H */ -- cgit v1.2.3-59-g8ed1b From 1abfd370134553f3b47e3e40a0526e05001409c2 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 15 Dec 2005 16:22:01 -0500 Subject: [SCSI] Rename scsi_print_msg to spi_print_msg Rename scsi_print_msg to spi_print_msg and move its prototype from scsi_dbg.h to scsi_transport_spi.h Signed-off-by: Matthew Wilcox Signed-off-by: James Bottomley --- drivers/scsi/53c700.c | 6 +++--- drivers/scsi/53c7xx.c | 7 ++++--- drivers/scsi/NCR5380.c | 7 ++++--- drivers/scsi/aha152x.c | 7 ++++--- drivers/scsi/arm/acornscsi.c | 7 ++++--- drivers/scsi/atari_NCR5380.c | 7 ++++--- drivers/scsi/scsi_transport_spi.c | 8 ++++---- drivers/scsi/sun3_NCR5380.c | 7 ++++--- drivers/scsi/sym53c8xx_2/sym_hipd.c | 4 ++-- include/scsi/scsi_dbg.h | 1 - include/scsi/scsi_transport_spi.h | 1 + 11 files changed, 34 insertions(+), 28 deletions(-) (limited to 'include') diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index e7ad269041a4..4ce7438608ec 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -857,7 +857,7 @@ process_extended_message(struct Scsi_Host *host, printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ", host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - scsi_print_msg(hostdata->msgin); + spi_print_msg(hostdata->msgin); printk("\n"); /* just reject it */ hostdata->msgout[0] = A_REJECT_MSG; @@ -887,7 +887,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata #ifdef NCR_700_DEBUG printk("scsi%d (%d:%d): message %s: ", host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - scsi_print_msg(hostdata->msgin); + spi_print_msg(hostdata->msgin); printk("\n"); #endif @@ -939,7 +939,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata host->host_no, pun, lun, NCR_700_phase[(dsps & 0xf00) >> 8]); - scsi_print_msg(hostdata->msgin); + spi_print_msg(hostdata->msgin); printk("\n"); /* just reject it */ hostdata->msgout[0] = A_REJECT_MSG; diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c index 9cb5dd48383f..7894b8ea84bd 100644 --- a/drivers/scsi/53c7xx.c +++ b/drivers/scsi/53c7xx.c @@ -282,6 +282,7 @@ #include "scsi.h" #include #include +#include #include "53c7xx.h" #include #include @@ -1724,7 +1725,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { printk ("scsi%d : status ", host->host_no); scsi_print_status (status); printk ("\nscsi%d : message ", host->host_no); - scsi_print_msg (&msg); + spi_print_msg(&msg); printk ("\n"); } else if (hostdata->test_completed == 3) { printk("scsi%d : test 2 no connection with target %d\n", @@ -2313,7 +2314,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct printk ("scsi%d : received message", host->host_no); if (c) printk (" from target %d lun %d ", c->device->id, c->device->lun); - scsi_print_msg ((unsigned char *) hostdata->msg_buf); + spi_print_msg((unsigned char *) hostdata->msg_buf); printk("\n"); } @@ -5540,7 +5541,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) { i > 0 && !check_address ((unsigned long) ptr, 1); ptr += len, i -= len) { printk(" "); - len = scsi_print_msg (ptr); + len = spi_print_msg(ptr); printk("\n"); if (!len) break; diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index cba9655d0f14..9f0ddbe6dc76 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -87,6 +87,7 @@ * the high level code. */ #include +#include #ifndef NDEBUG #define NDEBUG 0 @@ -2377,7 +2378,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { * 3..length+1 arguments * * Start the extended message buffer with the EXTENDED_MESSAGE - * byte, since scsi_print_msg() wants the whole thing. + * byte, since spi_print_msg() wants the whole thing. */ extended_msg[0] = EXTENDED_MESSAGE; /* Accept first byte by clearing ACK */ @@ -2424,7 +2425,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { default: if (!tmp) { printk("scsi%d: rejecting message ", instance->host_no); - scsi_print_msg(extended_msg); + spi_print_msg(extended_msg); printk("\n"); } else if (tmp != EXTENDED_MESSAGE) scmd_printk(KERN_INFO, cmd, @@ -2560,7 +2561,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { if (!(msg[0] & 0x80)) { printk(KERN_ERR "scsi%d : expecting IDENTIFY message, got ", instance->host_no); - scsi_print_msg(msg); + spi_print_msg(msg); abort = 1; } else { /* Accept message by clearing ACK */ diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 9df23b654cec..cb2ee25f213f 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -259,6 +259,7 @@ #include "scsi.h" #include #include +#include #include "aha152x.h" @@ -1845,7 +1846,7 @@ static void msgi_run(struct Scsi_Host *shpnt) #if defined(AHA152X_DEBUG) if (HOSTDATA(shpnt)->debug & debug_msgi) { printk(INFO_LEAD "inbound message %02x ", CMDINFO(CURRENT_SC), MSGI(0)); - scsi_print_msg(&MSGI(0)); + spi_print_msg(&MSGI(0)); printk("\n"); } #endif @@ -1933,7 +1934,7 @@ static void msgi_run(struct Scsi_Host *shpnt) break; printk(INFO_LEAD, CMDINFO(CURRENT_SC)); - scsi_print_msg(&MSGI(0)); + spi_print_msg(&MSGI(0)); printk("\n"); ticks = (MSGI(3) * 4 + 49) / 50; @@ -2031,7 +2032,7 @@ static void msgo_init(struct Scsi_Host *shpnt) int i; printk(DEBUG_LEAD "messages( ", CMDINFO(CURRENT_SC)); - for (i=0; i #include +#include #include "acornscsi.h" #include "msgqueue.h" #include "scsi.h" @@ -1370,7 +1371,7 @@ void acornscsi_sendmessage(AS_Host *host) host->scsi.last_message = msg->msg[0]; #if (DEBUG & DEBUG_MESSAGES) - scsi_print_msg(msg->msg); + spi_print_msg(msg->msg); #endif break; @@ -1392,7 +1393,7 @@ void acornscsi_sendmessage(AS_Host *host) while ((msg = msgqueue_getmsg(&host->scsi.msgs, msgnr++)) != NULL) { unsigned int i; #if (DEBUG & DEBUG_MESSAGES) - scsi_print_msg(msg); + spi_print_msg(msg); #endif i = 0; if (acornscsi_write_pio(host, msg->msg, &i, msg->length, 1000000)) @@ -1488,7 +1489,7 @@ void acornscsi_message(AS_Host *host) #if (DEBUG & DEBUG_MESSAGES) printk("scsi%d.%c: message in: ", host->host->host_no, acornscsi_target(host)); - scsi_print_msg(message); + spi_print_msg(message); printk("\n"); #endif diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 2ae31ceb32a8..57295bcea3e7 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c @@ -74,6 +74,7 @@ * the high level code. */ #include +#include #if (NDEBUG & NDEBUG_LISTS) #define LIST(x,y) \ @@ -2355,7 +2356,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) * 3..length+1 arguments * * Start the extended message buffer with the EXTENDED_MESSAGE - * byte, since scsi_print_msg() wants the whole thing. + * byte, since spi_print_msg() wants the whole thing. */ extended_msg[0] = EXTENDED_MESSAGE; /* Accept first byte by clearing ACK */ @@ -2408,7 +2409,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) default: if (!tmp) { printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO); - scsi_print_msg (extended_msg); + spi_print_msg(extended_msg); printk("\n"); } else if (tmp != EXTENDED_MESSAGE) printk(KERN_DEBUG "scsi%d: rejecting unknown " @@ -2541,7 +2542,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) if (!(msg[0] & 0x80)) { printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO); - scsi_print_msg(msg); + spi_print_msg(msg); do_abort(instance); return; } diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 00a73fc23fcc..59fb69ba790e 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -1072,7 +1072,7 @@ static const char * const extended_msgs[] = { #define NO_EXTENDED_MSGS (sizeof(two_byte_msgs) / sizeof (const char *)) -int scsi_print_msg (const unsigned char *msg) +int spi_print_msg(const unsigned char *msg) { int len = 0, i; if (msg[0] == EXTENDED_MESSAGE) { @@ -1125,11 +1125,11 @@ int scsi_print_msg (const unsigned char *msg) printk("reserved"); return len; } -EXPORT_SYMBOL(scsi_print_msg); +EXPORT_SYMBOL(spi_print_msg); #else /* ifndef CONFIG_SCSI_CONSTANTS */ -int scsi_print_msg (const unsigned char *msg) +int spi_print_msg(const unsigned char *msg) { int len = 0, i; @@ -1153,7 +1153,7 @@ int scsi_print_msg (const unsigned char *msg) printk("%02x ", msg[0]); return len; } -EXPORT_SYMBOL(scsi_print_msg); +EXPORT_SYMBOL(spi_print_msg); #endif /* ! CONFIG_SCSI_CONSTANTS */ #define SETUP_ATTRIBUTE(field) \ diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index c041bfd56e12..25cced91c8a6 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c @@ -70,6 +70,7 @@ * */ #include +#include /* * Further development / testing that should be done : @@ -2378,7 +2379,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) * 3..length+1 arguments * * Start the extended message buffer with the EXTENDED_MESSAGE - * byte, since scsi_print_msg() wants the whole thing. + * byte, since spi_print_msg() wants the whole thing. */ extended_msg[0] = EXTENDED_MESSAGE; /* Accept first byte by clearing ACK */ @@ -2431,7 +2432,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) default: if (!tmp) { printk(KERN_DEBUG "scsi%d: rejecting message ", HOSTNO); - scsi_print_msg (extended_msg); + spi_print_msg(extended_msg); printk("\n"); } else if (tmp != EXTENDED_MESSAGE) printk(KERN_DEBUG "scsi%d: rejecting unknown " @@ -2566,7 +2567,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) if (!(msg[0] & 0x80)) { printk(KERN_DEBUG "scsi%d: expecting IDENTIFY message, got ", HOSTNO); - scsi_print_msg(msg); + spi_print_msg(msg); do_abort(instance); return; } diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index 1010e716162e..8260f040d39c 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c @@ -75,7 +75,7 @@ static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) { sym_print_addr(cp->cmd, "%s: ", label); - scsi_print_msg(msg); + spi_print_msg(msg); printf("\n"); } @@ -84,7 +84,7 @@ static void sym_print_nego_msg(struct sym_hcb *np, int target, char *label, u_ch struct sym_tcb *tp = &np->target[target]; dev_info(&tp->starget->dev, "%s: ", label); - scsi_print_msg(msg); + spi_print_msg(msg); printf("\n"); } diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h index b090a11d7e1c..4d69dee66d4d 100644 --- a/include/scsi/scsi_dbg.h +++ b/include/scsi/scsi_dbg.h @@ -16,7 +16,6 @@ extern void __scsi_print_sense(const char *name, extern void scsi_print_driverbyte(int); extern void scsi_print_hostbyte(int); extern void scsi_print_status(unsigned char); -extern int scsi_print_msg(const unsigned char *); extern const char *scsi_sense_key_string(unsigned char); extern const char *scsi_extd_sense_format(unsigned char, unsigned char); diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 5c9b2e56e5b4..54a89611e9c5 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h @@ -146,5 +146,6 @@ void spi_release_transport(struct scsi_transport_template *); void spi_schedule_dv_device(struct scsi_device *); void spi_dv_device(struct scsi_device *); void spi_display_xfer_agreement(struct scsi_target *); +int spi_print_msg(const unsigned char *); #endif /* SCSI_TRANSPORT_SPI_H */ -- cgit v1.2.3-59-g8ed1b