diff --git a/scst/kernel/old_unsupported/26_scst-2.6.14-.patch b/scst/kernel/old_unsupported/26_scst-2.6.14-.patch new file mode 100644 index 000000000..c60a17894 --- /dev/null +++ b/scst/kernel/old_unsupported/26_scst-2.6.14-.patch @@ -0,0 +1,77 @@ +--- linux-2.6.12-rc6/drivers/scsi/scsi_lib.c_scst 2005-06-15 16:15:01.000000000 +0400 ++++ linux-2.6.12-rc6/drivers/scsi/scsi_lib.c 2005-06-23 20:28:20.802971272 +0400 +@@ -235,6 +235,61 @@ void scsi_do_req(struct scsi_request *sr + } + EXPORT_SYMBOL(scsi_do_req); + ++/* ++ * Function: scsi_do_req_fifo ++ * ++ * Purpose: Queue a SCSI request ++ * ++ * Arguments: sreq - command descriptor. ++ * cmnd - actual SCSI command to be performed. ++ * buffer - data buffer. ++ * bufflen - size of data buffer. ++ * done - completion function to be run. ++ * timeout - how long to let it run before timeout. ++ * retries - number of retries we allow. ++ * ++ * Lock status: No locks held upon entry. ++ * ++ * Returns: Nothing. ++ * ++ * Notes: This function is used for queueing requests in FIFO order. ++ * It is a copy of scsi_do_req() with only changed the last ++ * parameter of scsi_insert_special_req(). Not sure, if it ++ * breaks quiesce, but, anyway, I don't see another way to ++ * queue requests in FIFO order, which is necessary for SCST. ++ */ ++void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done)(struct scsi_cmnd *), ++ int timeout, int retries) ++{ ++ /* ++ * If the upper level driver is reusing these things, then ++ * we should release the low-level block now. Another one will ++ * be allocated later when this request is getting queued. ++ */ ++ __scsi_release_request(sreq); ++ ++ /* ++ * Our own function scsi_done (which marks the host as not busy, ++ * disables the timeout counter, etc) will be called by us or by the ++ * scsi_hosts[host].queuecommand() function needs to also call ++ * the completion function for the high level driver. ++ */ ++ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd)); ++ sreq->sr_bufflen = bufflen; ++ sreq->sr_buffer = buffer; ++ sreq->sr_allowed = retries; ++ sreq->sr_done = done; ++ sreq->sr_timeout_per_command = timeout; ++ ++ if (sreq->sr_cmd_len == 0) ++ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); ++ ++ scsi_insert_special_req(sreq, 0); ++} ++EXPORT_SYMBOL(scsi_do_req_fifo); ++ + static void scsi_wait_done(struct scsi_cmnd *cmd) + { + struct request *req = cmd->request; +--- linux-2.6.12-rc6/include/scsi/scsi_request.h_scst 2005-06-23 20:08:59.475519880 +0400 ++++ linux-2.6.12-rc6/include/scsi/scsi_request.h 2005-06-23 20:08:26.881474928 +0400 +@@ -54,6 +54,10 @@ extern void scsi_do_req(struct scsi_requ + void *buffer, unsigned bufflen, + void (*done) (struct scsi_cmnd *), + int timeout, int retries); ++extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done) (struct scsi_cmnd *), ++ int timeout, int retries); + + struct scsi_mode_data { + __u32 length; diff --git a/scst/kernel/scst_exec_req_fifo-2.6.15.patch b/scst/kernel/scst_exec_req_fifo-2.6.15.patch new file mode 100644 index 000000000..cba7d34db --- /dev/null +++ b/scst/kernel/scst_exec_req_fifo-2.6.15.patch @@ -0,0 +1,78 @@ +diff -upr linux-2.6.15.6/drivers/scsi/scsi_lib.c linux-2.6.15.6/drivers/scsi/scsi_lib.c +--- linux-2.6.15.6/drivers/scsi/scsi_lib.c 2006-03-05 22:07:54.000000000 +0300 ++++ linux-2.6.15.6/drivers/scsi/scsi_lib.c 2007-07-05 13:11:43.000000000 +0400 +@@ -254,6 +254,61 @@ void scsi_do_req(struct scsi_request *sr + } + EXPORT_SYMBOL(scsi_do_req); + ++/* ++ * Function: scsi_do_req_fifo ++ * ++ * Purpose: Queue a SCSI request ++ * ++ * Arguments: sreq - command descriptor. ++ * cmnd - actual SCSI command to be performed. ++ * buffer - data buffer. ++ * bufflen - size of data buffer. ++ * done - completion function to be run. ++ * timeout - how long to let it run before timeout. ++ * retries - number of retries we allow. ++ * ++ * Lock status: No locks held upon entry. ++ * ++ * Returns: Nothing. ++ * ++ * Notes: This function is used for queueing requests in FIFO order. ++ * It is a copy of scsi_do_req() with only changed the last ++ * parameter of scsi_insert_special_req(). Not sure, if it ++ * breaks quiesce, but, anyway, I don't see another way to ++ * queue requests in FIFO order, which is necessary for SCST. ++ */ ++void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done)(struct scsi_cmnd *), ++ int timeout, int retries) ++{ ++ /* ++ * If the upper level driver is reusing these things, then ++ * we should release the low-level block now. Another one will ++ * be allocated later when this request is getting queued. ++ */ ++ __scsi_release_request(sreq); ++ ++ /* ++ * Our own function scsi_done (which marks the host as not busy, ++ * disables the timeout counter, etc) will be called by us or by the ++ * scsi_hosts[host].queuecommand() function needs to also call ++ * the completion function for the high level driver. ++ */ ++ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd)); ++ sreq->sr_bufflen = bufflen; ++ sreq->sr_buffer = buffer; ++ sreq->sr_allowed = retries; ++ sreq->sr_done = done; ++ sreq->sr_timeout_per_command = timeout; ++ ++ if (sreq->sr_cmd_len == 0) ++ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); ++ ++ scsi_insert_special_req(sreq, 0); ++} ++EXPORT_SYMBOL(scsi_do_req_fifo); ++ + /** + * scsi_execute - insert request and wait for the result + * @sdev: scsi device +diff -upr linux-2.6.15.6/include/scsi/scsi_request.h linux-2.6.15.6/include/scsi/scsi_request.h +--- linux-2.6.15.6/include/scsi/scsi_request.h 2006-03-05 22:07:54.000000000 +0300 ++++ linux-2.6.15.6/include/scsi/scsi_request.h 2007-07-05 13:15:52.000000000 +0400 +@@ -51,4 +51,9 @@ extern void scsi_do_req(struct scsi_requ + void *buffer, unsigned bufflen, + void (*done) (struct scsi_cmnd *), + int timeout, int retries); ++#define SCSI_EXEC_REQ_FIFO_DEFINED ++extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done) (struct scsi_cmnd *), ++ int timeout, int retries); + #endif /* _SCSI_SCSI_REQUEST_H */ diff --git a/scst/kernel/scst_exec_req_fifo-2.6.16.patch b/scst/kernel/scst_exec_req_fifo-2.6.16.patch new file mode 100644 index 000000000..a93f9dbf9 --- /dev/null +++ b/scst/kernel/scst_exec_req_fifo-2.6.16.patch @@ -0,0 +1,80 @@ +diff -upr linux-2.6.16.29/drivers/scsi/scsi_lib.c linux-2.6.16.29/drivers/scsi/scsi_lib.c +--- linux-2.6.16.29/drivers/scsi/scsi_lib.c 2006-09-12 22:02:10.000000000 +0400 ++++ linux-2.6.16.29/drivers/scsi/scsi_lib.c 2007-07-05 12:59:24.000000000 +0400 +@@ -227,6 +227,63 @@ void scsi_do_req(struct scsi_request *sr + } + EXPORT_SYMBOL(scsi_do_req); + ++/* ++ * Function: scsi_do_req_fifo ++ * ++ * Purpose: Queue a SCSI request ++ * ++ * Arguments: sreq - command descriptor. ++ * cmnd - actual SCSI command to be performed. ++ * buffer - data buffer. ++ * bufflen - size of data buffer. ++ * done - completion function to be run. ++ * timeout - how long to let it run before timeout. ++ * retries - number of retries we allow. ++ * ++ * Lock status: No locks held upon entry. ++ * ++ * Returns: Nothing. ++ * ++ * Notes: This function is used for queueing requests in FIFO order. ++ * It is a copy of scsi_do_req() with only changed the last ++ * parameter of scsi_insert_special_req(). Not sure, if it ++ * breaks quiesce, but, anyway, I don't see another way to ++ * queue requests in FIFO order, which is necessary for SCST. ++ */ ++void scsi_do_req_fifo(struct scsi_request *sreq, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done)(struct scsi_cmnd *), ++ int timeout, int retries) ++{ ++ /* ++ * If the upper level driver is reusing these things, then ++ * we should release the low-level block now. Another one will ++ * be allocated later when this request is getting queued. ++ */ ++ __scsi_release_request(sreq); ++ ++ /* ++ * Our own function scsi_done (which marks the host as not busy, ++ * disables the timeout counter, etc) will be called by us or by the ++ * scsi_hosts[host].queuecommand() function needs to also call ++ * the completion function for the high level driver. ++ */ ++ memcpy(sreq->sr_cmnd, cmnd, sizeof(sreq->sr_cmnd)); ++ sreq->sr_bufflen = bufflen; ++ sreq->sr_buffer = buffer; ++ sreq->sr_allowed = retries; ++ sreq->sr_done = done; ++ sreq->sr_timeout_per_command = timeout; ++ ++ if (sreq->sr_cmd_len == 0) ++ sreq->sr_cmd_len = COMMAND_SIZE(sreq->sr_cmnd[0]); ++ ++ sreq->sr_request->flags &= ~REQ_DONTPREP; ++ blk_insert_request(sreq->sr_device->request_queue, sreq->sr_request, ++ 1, sreq); ++} ++EXPORT_SYMBOL(scsi_do_req_fifo); ++ + /** + * scsi_execute - insert request and wait for the result + * @sdev: scsi device +diff -upr linux-2.6.16.29/include/scsi/scsi_request.h linux-2.6.16.29/include/scsi/scsi_request.h +--- linux-2.6.16.29/include/scsi/scsi_request.h 2006-09-12 22:02:10.000000000 +0400 ++++ linux-2.6.16.29/include/scsi/scsi_request.h 2007-07-05 13:01:04.000000000 +0400 +@@ -51,4 +51,9 @@ extern void scsi_do_req(struct scsi_requ + void *buffer, unsigned bufflen, + void (*done) (struct scsi_cmnd *), + int timeout, int retries); ++#define SCSI_EXEC_REQ_FIFO_DEFINED ++extern void scsi_do_req_fifo(struct scsi_request *, const void *cmnd, ++ void *buffer, unsigned bufflen, ++ void (*done) (struct scsi_cmnd *), ++ int timeout, int retries); + #endif /* _SCSI_SCSI_REQUEST_H */ diff --git a/scst/kernel/scst_exec_req_fifo-2.6.18.patch b/scst/kernel/scst_exec_req_fifo-2.6.18.patch new file mode 100644 index 000000000..d4a9d560d --- /dev/null +++ b/scst/kernel/scst_exec_req_fifo-2.6.18.patch @@ -0,0 +1,109 @@ +diff -upr linux-2.6.18.1/drivers/scsi/scsi_lib.c linux-2.6.18.1/drivers/scsi/scsi_lib.c +--- linux-2.6.18.1/drivers/scsi/scsi_lib.c 2006-09-20 07:42:06.000000000 +0400 ++++ linux-2.6.18.1/drivers/scsi/scsi_lib.c 2007-07-04 21:15:32.000000000 +0400 +@@ -367,7 +367,7 @@ free_bios: + } + + /** +- * scsi_execute_async - insert request ++ * __scsi_execute_async - insert request + * @sdev: scsi device + * @cmd: scsi command + * @cmd_len: length of scsi cdb +@@ -378,11 +378,14 @@ free_bios: + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * @flags: or into request flags ++ * @at_head: insert request at head or tail of queue + **/ +-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, ++static inline int __scsi_execute_async(struct scsi_device *sdev, ++ const unsigned char *cmd, + int cmd_len, 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) ++ void (*done)(void *, char *, int, int), gfp_t gfp, ++ int at_head) + { + struct request *req; + struct scsi_io_context *sioc; +@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic + sioc->data = privdata; + sioc->done = done; + +- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async); ++ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async); + return 0; + + free_req: +@@ -427,8 +430,53 @@ free_sense: + kfree(sioc); + return DRIVER_ERROR << 24; + } ++ ++/** ++ * scsi_execute_async - insert request ++ * @sdev: scsi device ++ * @cmd: scsi command ++ * @cmd_len: length of scsi cdb ++ * @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 cmd_len, 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) ++{ ++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer, ++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1); ++} + EXPORT_SYMBOL_GPL(scsi_execute_async); + ++/** ++ * scsi_execute_async_fifo - insert request at tail, in FIFO order ++ * @sdev: scsi device ++ * @cmd: scsi command ++ * @cmd_len: length of scsi cdb ++ * @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_fifo(struct scsi_device *sdev, const unsigned char *cmd, ++ int cmd_len, 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) ++{ ++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer, ++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0); ++} ++EXPORT_SYMBOL_GPL(scsi_execute_async_fifo); ++ + /* + * Function: scsi_init_cmd_errh() + * +diff -upr linux-2.6.18.1/include/scsi/scsi_device.h linux-2.6.18.1/include/scsi/scsi_device.h +--- linux-2.6.18.1/include/scsi/scsi_device.h 2006-09-20 07:42:06.000000000 +0400 ++++ linux-2.6.18.1/include/scsi/scsi_device.h 2007-07-04 21:15:32.000000000 +0400 +@@ -297,6 +297,13 @@ extern int scsi_execute_async(struct scs + int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), + gfp_t gfp); ++#define SCSI_EXEC_REQ_FIFO_DEFINED ++extern int scsi_execute_async_fifo(struct scsi_device *sdev, ++ const unsigned char *cmd, int cmd_len, 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 void scsi_device_reprobe(struct scsi_device *sdev) + { diff --git a/scst/kernel/scst_exec_req_fifo-2.6.21.patch b/scst/kernel/scst_exec_req_fifo-2.6.21.patch new file mode 100644 index 000000000..2be754d13 --- /dev/null +++ b/scst/kernel/scst_exec_req_fifo-2.6.21.patch @@ -0,0 +1,109 @@ +diff -upr linux-2.6.21.1/drivers/scsi/scsi_lib.c linux-2.6.21.1/drivers/scsi/scsi_lib.c +--- linux-2.6.21.1/drivers/scsi/scsi_lib.c 2007-04-28 01:49:26.000000000 +0400 ++++ linux-2.6.21.1/drivers/scsi/scsi_lib.c 2007-06-20 13:19:50.000000000 +0400 +@@ -366,7 +366,7 @@ free_bios: + } + + /** +- * scsi_execute_async - insert request ++ * __scsi_execute_async - insert request + * @sdev: scsi device + * @cmd: scsi command + * @cmd_len: length of scsi cdb +@@ -377,11 +377,14 @@ free_bios: + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * @flags: or into request flags ++ * @at_head: insert request at head or tail of queue + **/ +-int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, ++static inline int __scsi_execute_async(struct scsi_device *sdev, ++ const unsigned char *cmd, + int cmd_len, 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) ++ void (*done)(void *, char *, int, int), gfp_t gfp, ++ int at_head) + { + struct request *req; + struct scsi_io_context *sioc; +@@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic + sioc->data = privdata; + sioc->done = done; + +- blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async); ++ blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async); + return 0; + + free_req: +@@ -427,8 +430,53 @@ free_sense: + kmem_cache_free(scsi_io_context_cache, sioc); + return DRIVER_ERROR << 24; + } ++ ++/** ++ * scsi_execute_async - insert request ++ * @sdev: scsi device ++ * @cmd: scsi command ++ * @cmd_len: length of scsi cdb ++ * @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 cmd_len, 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) ++{ ++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer, ++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 1); ++} + EXPORT_SYMBOL_GPL(scsi_execute_async); + ++/** ++ * scsi_execute_async_fifo - insert request at tail, in FIFO order ++ * @sdev: scsi device ++ * @cmd: scsi command ++ * @cmd_len: length of scsi cdb ++ * @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_fifo(struct scsi_device *sdev, const unsigned char *cmd, ++ int cmd_len, 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) ++{ ++ return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer, ++ bufflen, use_sg, timeout, retries, privdata, done, gfp, 0); ++} ++EXPORT_SYMBOL_GPL(scsi_execute_async_fifo); ++ + /* + * Function: scsi_init_cmd_errh() + * +diff -upr linux-2.6.21.1/include/scsi/scsi_device.h linux-2.6.21.1/include/scsi/scsi_device.h +--- linux-2.6.21.1/include/scsi/scsi_device.h 2007-04-28 01:49:26.000000000 +0400 ++++ linux-2.6.21.1/include/scsi/scsi_device.h 2007-06-20 13:25:07.000000000 +0400 +@@ -298,6 +298,13 @@ extern int scsi_execute_async(struct scs + int timeout, int retries, void *privdata, + void (*done)(void *, char *, int, int), + gfp_t gfp); ++#define SCSI_EXEC_REQ_FIFO_DEFINED ++extern int scsi_execute_async_fifo(struct scsi_device *sdev, ++ const unsigned char *cmd, int cmd_len, 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 int __must_check scsi_device_reprobe(struct scsi_device *sdev) + {