1 diff -upr linux-2.6.18/drivers/scsi/scsi_lib.c linux-2.6.18/drivers/scsi/scsi_lib.c
2 --- linux-2.6.18/drivers/scsi/scsi_lib.c 2006-09-20 07:42:06.000000000 +0400
3 +++ linux-2.6.18/drivers/scsi/scsi_lib.c 2007-07-04 21:15:32.000000000 +0400
4 @@ -367,7 +367,7 @@ free_bios:
8 - * scsi_execute_async - insert request
9 + * __scsi_execute_async - insert request
12 * @cmd_len: length of scsi cdb
13 @@ -378,11 +378,14 @@ free_bios:
14 * @timeout: request timeout in seconds
15 * @retries: number of times to retry request
16 * @flags: or into request flags
17 + * @at_head: insert request at head or tail of queue
19 -int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
20 +static inline int __scsi_execute_async(struct scsi_device *sdev,
21 + const unsigned char *cmd,
22 int cmd_len, int data_direction, void *buffer, unsigned bufflen,
23 int use_sg, int timeout, int retries, void *privdata,
24 - void (*done)(void *, char *, int, int), gfp_t gfp)
25 + void (*done)(void *, char *, int, int), gfp_t gfp,
29 struct scsi_io_context *sioc;
30 @@ -418,7 +421,7 @@ int scsi_execute_async(struct scsi_devic
31 sioc->data = privdata;
34 - blk_execute_rq_nowait(req->q, NULL, req, 1, scsi_end_async);
35 + blk_execute_rq_nowait(req->q, NULL, req, at_head, scsi_end_async);
39 @@ -427,8 +430,53 @@ free_sense:
41 return DRIVER_ERROR << 24;
45 + * scsi_execute_async - insert request
46 + * @sdev: scsi device
47 + * @cmd: scsi command
48 + * @cmd_len: length of scsi cdb
49 + * @data_direction: data direction
50 + * @buffer: data buffer (this can be a kernel buffer or scatterlist)
51 + * @bufflen: len of buffer
52 + * @use_sg: if buffer is a scatterlist this is the number of elements
53 + * @timeout: request timeout in seconds
54 + * @retries: number of times to retry request
55 + * @flags: or into request flags
57 +int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
58 + int cmd_len, int data_direction, void *buffer, unsigned bufflen,
59 + int use_sg, int timeout, int retries, void *privdata,
60 + void (*done)(void *, char *, int, int), gfp_t gfp)
62 + return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
63 + bufflen, use_sg, timeout, retries, privdata, done, gfp, 1);
65 EXPORT_SYMBOL_GPL(scsi_execute_async);
68 + * scsi_execute_async_fifo - insert request at tail, in FIFO order
69 + * @sdev: scsi device
70 + * @cmd: scsi command
71 + * @cmd_len: length of scsi cdb
72 + * @data_direction: data direction
73 + * @buffer: data buffer (this can be a kernel buffer or scatterlist)
74 + * @bufflen: len of buffer
75 + * @use_sg: if buffer is a scatterlist this is the number of elements
76 + * @timeout: request timeout in seconds
77 + * @retries: number of times to retry request
78 + * @flags: or into request flags
80 +int scsi_execute_async_fifo(struct scsi_device *sdev, const unsigned char *cmd,
81 + int cmd_len, int data_direction, void *buffer, unsigned bufflen,
82 + int use_sg, int timeout, int retries, void *privdata,
83 + void (*done)(void *, char *, int, int), gfp_t gfp)
85 + return __scsi_execute_async(sdev, cmd, cmd_len, data_direction, buffer,
86 + bufflen, use_sg, timeout, retries, privdata, done, gfp, 0);
88 +EXPORT_SYMBOL_GPL(scsi_execute_async_fifo);
91 * Function: scsi_init_cmd_errh()
93 diff -upr linux-2.6.18/include/scsi/scsi_device.h linux-2.6.18/include/scsi/scsi_device.h
94 --- linux-2.6.18/include/scsi/scsi_device.h 2006-09-20 07:42:06.000000000 +0400
95 +++ linux-2.6.18/include/scsi/scsi_device.h 2007-07-04 21:15:32.000000000 +0400
96 @@ -335,6 +335,13 @@ extern int scsi_execute_async(struct scs
97 int timeout, int retries, void *privdata,
98 void (*done)(void *, char *, int, int),
100 +#define SCSI_EXEC_REQ_FIFO_DEFINED
101 +extern int scsi_execute_async_fifo(struct scsi_device *sdev,
102 + const unsigned char *cmd, int cmd_len, int data_direction,
103 + void *buffer, unsigned bufflen, int use_sg,
104 + int timeout, int retries, void *privdata,
105 + void (*done)(void *, char *, int, int),
108 static inline void scsi_device_reprobe(struct scsi_device *sdev)