The patch below adds support for the 2.6.29 kernel and also fixes the

checkpatch issues reported by the checkpatch script included with the 2.6.29
kernel and that were not yet reported by the 2.6.28 checkpatch script
(trailing statements should be on the next line / struct should normally be
const).
The patch below has been tested as follows:
- Reran scripts/run-regression-tests -k 2.6.24.7 -k 2.6.25.20 -k 2.6.26.8 -k 2.6.27.21 -k 2.6.28.9 -k 2.6.29 and verified the output.
- Rebuilt, installed and loaded scst, iscsi-scst and srpt as follows:
make -s clean && make -s -C scst install && make -s -C iscsi-scst install && make -s -C srpt install && cd scstadmin && make -s && make -s install && modprobe scst_vdisk && modprobe iscsi-scst && dmesg

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>

with minor cleanups and corrections in put_page_callback-2.6.29.patch



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@717 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-03-25 12:55:27 +00:00
parent 9e5f29c3f6
commit bc96b052d5
20 changed files with 623 additions and 19 deletions
+1 -1
View File
@@ -2755,7 +2755,7 @@ int scst_proc_log_entry_write(struct file *file, const char __user *buf,
* helper data structure and function to create proc entry.
*/
struct scst_proc_data {
struct file_operations seq_op;
const struct file_operations seq_op;
int (*show)(struct seq_file *, void *);
void *data;
};
@@ -0,0 +1,12 @@
diff -uprN ../orig/linux-2.6.24/drivers/Kconfig linux-2.6.24/drivers/Kconfig
--- ../orig/linux-2.6.24/drivers/Kconfig 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/Kconfig 2008-05-13 13:05:55.000000000 +0200
@@ -18,6 +18,8 @@
source "drivers/scsi/Kconfig"
+source "drivers/scst/Kconfig"
+
source "drivers/cdrom/Kconfig"
source "drivers/md/Kconfig"
@@ -0,0 +1,12 @@
diff -upkr -X linux-2.6.29/Documentation/dontdiff linux-2.6.29/drivers/Kconfig linux-2.6.29/drivers/Kconfig
--- linux-2.6.29/drivers/Kconfig 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/drivers/Kconfig 2008-07-24 14:14:46.000000000 +0400
@@ -24,6 +24,8 @@ source "drivers/ide/Kconfig"
source "drivers/scsi/Kconfig"
+source "drivers/scst/Kconfig"
+
source "drivers/ata/Kconfig"
source "drivers/md/Kconfig"
@@ -0,0 +1,11 @@
diff -uprN ../orig/linux-2.6.24/drivers/Makefile linux-2.6.24/drivers/Makefile
--- ../orig/linux-2.6.24/drivers/Makefile 2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/drivers/Makefile 2008-05-13 13:06:34.000000000 +0200
@@ -34,6 +34,7 @@
obj-$(CONFIG_IDE) += ide/
obj-$(CONFIG_FC4) += fc4/
obj-$(CONFIG_SCSI) += scsi/
+obj-$(CONFIG_SCST) += scst/
obj-$(CONFIG_FUSION) += message/
obj-$(CONFIG_IEEE1394) += ieee1394/
obj-y += cdrom/
@@ -0,0 +1,11 @@
diff -upkr -X linux-2.6.29/Documentation/dontdiff linux-2.6.29/drivers/Makefile linux-2.6.29/drivers/Makefile
--- linux-2.6.29/drivers/Makefile 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/drivers/Makefile 2008-07-24 14:15:29.000000000 +0400
@@ -42,6 +42,7 @@ obj-$(CONFIG_ATM) += atm/
obj-y += macintosh/
obj-$(CONFIG_IDE) += ide/
obj-$(CONFIG_SCSI) += scsi/
+obj-$(CONFIG_SCST) += scst/
obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_FUSION) += message/
obj-$(CONFIG_FIREWIRE) += firewire/
+61
View File
@@ -0,0 +1,61 @@
diff -upkr linux-2.6.29/block/blk-ioc.c linux-2.6.29/block/blk-ioc.c
--- linux-2.6.29/block/blk-ioc.c 2008-12-25 02:26:37.000000000 +0300
+++ linux-2.6.29/block/blk-ioc.c 2009-03-23 14:28:48.000000000 +0300
@@ -65,6 +65,21 @@ static void cfq_exit(struct io_context *
rcu_read_unlock();
}
+void __exit_io_context(struct io_context *ioc)
+{
+ if (ioc == NULL)
+ return;
+
+ if (atomic_dec_and_test(&ioc->nr_tasks)) {
+ if (ioc->aic && ioc->aic->exit)
+ ioc->aic->exit(ioc->aic);
+ cfq_exit(ioc);
+
+ put_io_context(ioc);
+ }
+}
+EXPORT_SYMBOL(__exit_io_context);
+
/* Called by the exitting task */
void exit_io_context(void)
{
@@ -75,13 +90,7 @@ void exit_io_context(void)
current->io_context = NULL;
task_unlock(current);
- if (atomic_dec_and_test(&ioc->nr_tasks)) {
- if (ioc->aic && ioc->aic->exit)
- ioc->aic->exit(ioc->aic);
- cfq_exit(ioc);
-
- put_io_context(ioc);
- }
+ __exit_io_context(ioc);
}
struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
@@ -105,6 +114,7 @@ struct io_context *alloc_io_context(gfp_
return ret;
}
+EXPORT_SYMBOL(alloc_io_context);
/*
* If the current task has no IO context then create one and initialise it.
diff -upkr linux-2.6.29/include/linux/iocontext.h linux-2.6.29/include/linux/iocontext.h
--- linux-2.6.29/include/linux/iocontext.h 2008-12-25 02:26:37.000000000 +0300
+++ linux-2.6.29/include/linux/iocontext.h 2009-03-23 14:05:01.000000000 +0300
@@ -103,7 +103,9 @@ static inline struct io_context *ioc_tas
int put_io_context(struct io_context *ioc);
void exit_io_context(void);
struct io_context *get_io_context(gfp_t gfp_flags, int node);
+#define SCST_IO_CONTEXT
struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
+void __exit_io_context(struct io_context *ioc);
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
#else
static inline void exit_io_context(void)
+112
View File
@@ -0,0 +1,112 @@
diff -upr linux-2.6.29/drivers/scsi/scsi_lib.c linux-2.6.29/drivers/scsi/scsi_lib.c
--- linux-2.6.29/drivers/scsi/scsi_lib.c 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/drivers/scsi/scsi_lib.c 2008-07-31 21:20:00.000000000 +0400
@@ -402,7 +402,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
@@ -415,11 +415,14 @@ free_bios:
* @privdata: data passed to done()
* @done: callback function when done
* @gfp: memory allocation 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;
@@ -456,7 +461,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:
@@ -465,8 +468,55 @@ 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.29/include/scsi/scsi_device.h linux-2.6.29/include/scsi/scsi_device.h
--- linux-2.6.29/include/scsi/scsi_device.h 2008-07-14 01:51:29.000000000 +0400
+++ linux-2.6.29/include/scsi/scsi_device.h 2008-07-31 21:20:39.000000000 +0400
@@ -376,6 +376,14 @@ 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)
{
+5 -1
View File
@@ -109,7 +109,11 @@ static int cdrom_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing READ_CAPACITY");
res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0);
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
, NULL
#endif
);
TRACE_DBG("READ_CAPACITY done: %x", res);
+5 -1
View File
@@ -185,7 +185,11 @@ static int disk_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing READ_CAPACITY");
res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0);
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
, NULL
#endif
);
TRACE_DBG("READ_CAPACITY done: %x", res);
+5 -1
View File
@@ -199,7 +199,11 @@ static int modisk_attach(struct scst_device *dev)
TRACE_DBG("%s", "Doing READ_CAPACITY");
res = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
buffer_size, sense_buffer,
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0);
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
, NULL
#endif
);
TRACE_DBG("READ_CAPACITY done: %x", res);
+1 -1
View File
@@ -205,7 +205,7 @@ static struct kmem_cache *user_get_cmd_cachep;
static DEFINE_MUTEX(dev_priv_mutex);
static struct file_operations dev_user_fops = {
static const struct file_operations dev_user_fops = {
.poll = dev_user_poll,
.unlocked_ioctl = dev_user_ioctl,
#ifdef CONFIG_COMPAT
+1 -1
View File
@@ -3267,7 +3267,7 @@ static int vcdrom_change(char *p, char *name)
{
loff_t err;
struct scst_vdisk_dev *virt_dev, *vv;
char *file_name, *fn, *old_fn;
char *file_name, *fn = NULL, *old_fn;
int len;
int res = 0;
+12 -4
View File
@@ -1664,7 +1664,11 @@ static void scst_send_release(struct scst_device *dev)
TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to "
"SCSI mid-level");
rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
sense, 15, 0, 0);
sense, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
, NULL
#endif
);
TRACE_DBG("MODE_SENSE done: %x", rc);
if (scsi_status_is_good(rc)) {
@@ -3093,7 +3097,11 @@ int scst_obtain_device_parameters(struct scst_device *dev)
TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE");
res = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer,
sizeof(buffer), sense_buffer, 15, 0, 0);
sizeof(buffer), sense_buffer, 15, 0, 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
, NULL
#endif
);
TRACE_DBG("MODE_SENSE done: %x", res);
@@ -3139,14 +3147,14 @@ int scst_obtain_device_parameters(struct scst_device *dev)
} else {
#if 0
if ((status_byte(res) == CHECK_CONDITION) &&
SCST_SENSE_VALID(sense_buffer)) {
#else
/*
* 3ware controller is buggy and returns CONDITION_GOOD
* instead of CHECK_CONDITION
*/
if (
if (SCST_SENSE_VALID(sense_buffer)) {
#endif
SCST_SENSE_VALID(sense_buffer)) {
if (scst_analyze_sense(sense_buffer,
sizeof(sense_buffer),
SCST_SENSE_KEY_VALID,